Transmisión#
Introducción#
El sistema de transmisión controla el movimiento del robot, permitiéndole avanzar, girar y detenerse con precisión.
A continuación se muestra una lista de todos los métodos:
Acciones: Mover y girar el robot.
drive – Mueve el tren motriz en una dirección específica indefinidamente.
drive_for – Mueve el sistema de transmisión durante una distancia determinada.
drive_until – Mueve el tren motriz hasta que se cumple una condición.
turn – Gira la transmisión hacia la izquierda o hacia la derecha indefinidamente.
turn_for – Gira la transmisión durante una distancia determinada.
turn_to_heading – Gira la transmisión hacia un rumbo específico.
turn_to_rotation – Gira la transmisión a una rotación específica.
stop – Detiene una transmisión con un comportamiento configurable.
Mutadores: establecen velocidades de movimiento y giro predeterminadas.
set_drive_velocity – Establece la velocidad de movimiento predeterminada para el tren motriz.
set_turn_velocity – Establece la velocidad de movimiento de giro para el tren motriz.
set_stopping – Establece el comportamiento de detención (frenado, inercia o retención).
set_timeout – Limita el tiempo que una función de transmisión espera antes de darse por vencida si se bloquea el movimiento.
set_heading – Establece el rumbo de una transmisión en un valor específico.
set_rotation – Establece la rotación de una transmisión en un valor específico.
Getters – Devuelven el estado y la posición del robot.
get_heading – Devuelve el rumbo actual de una transmisión.
get_rotation – Devuelve la rotación actual de una transmisión.
get_velocity – Devuelve la velocidad actual de un sistema de transmisión.
get_yaw – Devuelve la guiñada del robot en grados.
get_roll – Devuelve el giro del robot en grados.
get_pitch – Devuelve la inclinación del robot en grados.
get_crashed – Devuelve si el robot se ha bloqueado.
is_stopped – Devuelve si un tren motriz no se está moviendo actualmente.
Comportamiento#
drive#
drive
moves the drivetrain in a specified direction indefinitely.
Usage:
drivetrain.drive(direction)
Parámetros |
Descripción |
---|---|
|
The direction in which to drive:
|
def main():
# Drive forward then stop
drivetrain.drive(FORWARD)
wait(2, SECONDS)
drivetrain.stop()
# Start threads — Do not delete
start_thread(main)
drive_for#
drive_for
moves the drivetrain in a specified direction for a set distance.
Usage:
drivetrain.drive_for(direction, distance, units, wait)
Parámetros |
Descripción |
---|---|
|
The direction in which to drive:
|
|
La distancia que debe recorrer el tren motriz, expresada en forma de número flotante o entero. |
|
The unit that represents the distance:
|
|
Optional.
|
# Example coming soon
drive_until#
drive_until
moves the drivetrain forward until a certain condition is met.
Usage:
drivetrain.drive_until(condition, wait)
Parámetros |
Descripción |
---|---|
|
La condición que detiene la transmisión:
|
|
Optional.
|
# Example coming soon
turn#
turn
turns the drivetrain left or right indefinitely.
Usage:
drivetrain.turn(direction)
Parámetros |
Descripción |
---|---|
|
The direction in which to turn:
|
# Example coming soon
turn_for#
turn_for
turns the drivetrain left or right for a specified angle or rotations.
Usage:
drivetrain.turn_for(direction, angle, wait)
Parámetros |
Descripción |
---|---|
|
The direction in which to turn:
|
|
La cantidad de grados que girará la transmisión como un número flotante o entero. |
|
Optional.
|
# Example coming soon
turn_to_heading#
turn_to_heading
turns a drivetrain to a specified heading.
Usage:
drivetrain.turn_to_heading(angle, wait)
Parámetros |
Descripción |
---|---|
|
El rumbo para girar la transmisión para que quede como un flotante o un entero en grados. |
|
Optional.
|
# Example coming soon
turn_to_rotation#
turn_to_rotation
turns a drivetrain to a specified rotation.
Usage:
drivetrain.turn_to_rotation(angle, wait)
Parámetros |
Descripción |
---|---|
|
La rotación para girar la transmisión para que quede orientada como un flotador o un número entero en grados. |
|
Optional.
|
# Example coming soon
stop#
stop
stops a drivetrain.
Usage:
drivetrain.stop()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
Mutadores#
set_drive_velocity#
set_drive_velocity
sets the default moving velocity for a drivetrain. This velocity setting will be used for subsequent calls to any drivetrain functions.
Usage:
drivetrain.set_drive_velocity(velocity)
Parámetros |
Descripción |
---|---|
|
La velocidad a la que se moverá la transmisión como un valor flotante o entero del 0 % al 100 %. |
# Example coming soon
set_turn_velocity#
set_turn_velocity
sets the default turning velocity for a drivetrain. This velocity setting will be used for subsequent calls to any drivetrain functions.
Usage:
drivetrain.set_turn_velocity(velocity)
Parámetros |
Descripción |
---|---|
|
La velocidad a la que girará la transmisión como un valor flotante o entero del 0 % al 100 %. |
# Example coming soon
set_stopping#
set_stopping
sets the stopping mode for a drivetrain.
Usage:
drivetrain.set_stopping(brake)
Parámetros |
Descripción |
---|---|
|
How the drivetrain will stop:
|
# Example coming soon
set_timeout#
set_timeout
sets a time limit for how long a drivetrain function will wait to reach its target. If the drivetrain cannot complete the movement within the set time, it will stop automatically and continue with the next function.
Nota: El límite de tiempo del tren motriz se utiliza para evitar que las funciones del tren motriz que no alcanzan su posición objetivo detengan la ejecución del resto del proyecto.
Usage:
drivetrain.set_timeout(value, units)
Parámetros |
Descripción |
---|---|
|
El número máximo de segundos que una función de motor se ejecutará antes de detenerse y pasar a la siguiente función como un entero o un punto flotante. |
|
Opcional. Unidad que representa el tiempo:
|
# Example coming soon
set_heading#
set_heading
sets the heading of the drivetrain to a specified value.
Usage:
drivetrain.set_heading(value)
Parámetros |
Descripción |
---|---|
|
El valor a utilizar para el nuevo rumbo en grados. |
# Example coming soon
set_rotation#
set_rotation
sets the rotation of the drivetrain to a specified value.
Usage:
drivetrain.set_rotation(value)
Parámetros |
Descripción |
---|---|
|
El valor a utilizar para la nueva rotación en grados. |
# Example coming soon
Captadores#
get_heading#
get_heading
returns the current heading of the drivetrain as a float in degrees.
Usage:
drivetrain.get_heading()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
get_rotation#
get_rotation
returns the current rotation of the Inertial Sensor in degrees.
Usage:
drivetrain.get_rotation()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
get_velocity#
get_velocity
returns the current velocity of the drivetrain as a float in percent.
Usage:
drivetrain.get_velocity()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
get_yaw#
get_yaw
returns the current yaw of the robot as a float in degrees.
Usage:
drivetrain.get_yaw()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
get_roll#
get_roll
returns the current roll of the robot as a float in degrees.
Usage:
drivetrain.get_roll()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
get_pitch#
get_pitch
returns the current pitch of the robot as a float in degrees.
Usage:
drivetrain.get_pitch()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
get_crashed#
get_crashed
returns a Boolean indicating whether or not the robot has crashed.
True
– The robot has crashed.False
– The robot has not crashed.
Usage:
drivetrain.get_crashed()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon
is_stopped#
is_stopped
returns a Boolean indicating whether a drivetrain is not currently moving.
True
– The drivetrain is stopped.False
– The drivetrain is moving.
Usage:
drivetrain.is_stopped()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
# Example coming soon