Transmisión#
Introducción#
El tren motriz controla el movimiento de un robot, permitiéndole avanzar, girar y detenerse con precisión.
También puede funcionar como un sistema de transmisión inteligente cuando se configura con un sensor giroscópico o un sensor inercial cerebral.
For the examples below, the configured drivetrain will be named Drivetrain
and will be used in all subsequent examples throughout this API documentation when referring to drivetrain
and smartdrive
class methods.
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.
driveFor – Mueve el sistema de transmisión en una dirección específica durante una distancia establecida.
turn – Gira la transmisión hacia la izquierda o hacia la derecha indefinidamente.
turnFor – Gira la transmisión hacia la izquierda o hacia la derecha durante una distancia determinada.
turnToHeading – Gira una transmisión inteligente hacia un rumbo específico.
turnToRotation – Gira una transmisión inteligente a un valor de rotación especificado.
stop – Detiene un sistema de transmisión.
calibrateDrivetrain – Calibra la transmisión.
Mutadores: establecen velocidades de movimiento y giro predeterminadas.
setDriveVelocity – Establece la velocidad de movimiento predeterminada para un tren motriz.
setTurnVelocity – Establece la velocidad de giro predeterminada para un tren motriz.
setStopping – Establece el modo de detención de un tren motriz.
setTimeout – Establece un límite de tiempo para las funciones del tren motriz.
setHeading – Establece el rumbo de una transmisión inteligente.
setRotation – Establece la rotación de la transmisión inteligente.
setGearRatio – Establece la relación de transmisión para todos los motores del tren motriz.
setTurnThreshold – Establece el umbral de giro para la transmisión inteligente.
setTurnConstant – Establece la constante de giro para la transmisión inteligente.
setTurnDirectionReverse – Establece la dirección de giro esperada para rumbo positivo.
Getters – Devuelven el estado y la posición del robot.
isDone – Devuelve si un tren motriz no se está moviendo actualmente.
isMoving – Devuelve si un tren motriz se está moviendo actualmente.
heading – Devuelve el rumbo actual de un sistema de transmisión inteligente.
rotación – Devuelve el valor de rotación actual de una transmisión inteligente.
velocidad – Devuelve la velocidad actual de un sistema de transmisión.
current – Devuelve la corriente actual de una transmisión.
potencia – Devuelve la potencia promedio del sistema de transmisión inteligente.
torque – Devuelve el torque promedio del tren motriz.
eficiencia – Devuelve la eficiencia promedio del sistema de transmisión.
temperatura – Devuelve la temperatura promedio de la transmisión.
Constructores: inicializan y configuran manualmente la transmisión.
drivetrain – Crea un tren de transmisión básico.
smartdrive – Crea un sistema de transmisión configurado con un sensor giroscópico o un sensor inercial cerebral.
Comportamiento#
drive#
drive
moves the drivetrain in a specified direction indefinitely.
Default Usage:
Drivetrain.drive(direction);
Overload Usages:
Drivetrain.drive(direction, velocity, units);
Parámetros |
Descripción |
---|---|
dirección |
The direction in which to drive:
|
velocidad |
La velocidad a la que se moverá la transmisión, como valor de punto flotante o entero. Si no se especifica, la velocidad predeterminada es del 50 %. |
unidades |
The unit that represents the velocity:
|
// Example coming soon
driveFor#
driveFor
moves the drivetrain in a specified direction for a set distance.
Default Usage:
Drivetrain.driveFor(direction, distance, units, wait);
Overload Usages:
Drivetrain.driveFor(direction, distance, units, wait);
Drivetrain.driveFor(direction, distance, units, velocity, units_v, wait);
Drivetrain.driveFor(distance, units, wait);
Drivetrain.driveFor(distance, units, velocity, units_v, wait);
Parámetros |
Descripción |
---|---|
dirección |
The direction in which to drive:
|
distancia |
La distancia que la transmisión debe recorrer es el doble. |
unidades |
The unit that represents the distance:
|
esperar |
Optional.
|
velocidad |
La velocidad a la que la transmisión se moverá como un doble. Si no se especifica, la velocidad predeterminada es del 50 %. |
unidades_v |
The unit that represents the velocity:
|
// Example coming soon
turn#
turn
turns the drivetrain left or right indefinitely.
Default Usage:
Drivetrain.turn(direction);
Overload Usages:
Drivetrain.turn(direction, velocity, units);
Parámetros |
Descripción |
---|---|
dirección |
The direction in which to turn:
right |
velocidad |
La velocidad a la que la transmisión girará en doble. Si no se especifica, la velocidad predeterminada es del 50 %. |
unidades |
The unit that represents the velocity:
|
// Example coming soon
turnFor#
turnFor
turns the drivetrain left or right for a set distance.
Default Usage:
Drivetrain.turnFor(direction, angle, units, wait);
Overload Usages:
Drivetrain.turnFor(direction, angle, units, velocity, units_v, wait);
Drivetrain.turnFor(angle, units, wait);
Drivetrain.turnFor(angle, units, velocity, units_v, wait);
Parámetros |
Descripción |
---|---|
dirección |
The direction in which to turn:
|
ángulo |
La cantidad de grados que la transmisión girará como un doble. |
unidades |
The unit that represents the rotational value:
|
velocidad |
La velocidad a la que la transmisión girará en doble. Si no se especifica, la velocidad predeterminada es del 50 %. |
unidades_v |
The unit that represents the velocity:
|
esperar |
Optional.
|
// Example coming soon
turnToHeading#
turnToHeading
turns a smart drivetrain to a specified heading.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Default Usage:
Drivetrain.turnToHeading(angle, units, wait);
Overload Usages:
Drivetrain.turnToHeading(angle, units, velocity, units_v, wait);
Parámetros |
Descripción |
---|---|
ángulo |
El encabezado para girar la transmisión para que quede como un flotante o un entero. |
unidades |
The unit that represents the rotational value:
|
velocidad |
La velocidad a la que girará el motor o el grupo de motores, como valor de punto flotante o entero. Si no se especifica la velocidad, la predeterminada es del 50 %. |
unidades_v |
The unit that represents the velocity:
|
esperar |
Optional.
|
// Example coming soon
turnToRotation#
turnToRotation
turns a smart drivetrain to a specified rotational value.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Default Usage:
Drivetrain.turnToRotation(angle, units, wait);
Overload Usages:
Drivetrain.turnToRotation(angle, units, velocity, units_v, wait);
Parámetros |
Descripción |
---|---|
ángulo |
El encabezado para girar la transmisión para que quede como un flotante o un entero. |
unidades |
The unit that represents the rotational value:
|
velocidad |
La velocidad a la que girará el motor o el grupo de motores, como valor de punto flotante o entero. Si no se especifica la velocidad, la predeterminada es del 50 %. |
unidades_v |
The unit that represents the velocity:
|
esperar |
Optional.
|
// Example coming soon
stop#
stop
stops a drivetrain.
Default Usage:
Drivetrain.stop();
Overload Usages:
Drivetrain.stop(mode);
Parámetros |
Descripción |
---|---|
modo |
How the drivetrain will stop:
|
// Example coming soon
calibrateDrivetrain#
calibrateDrivetrain
calibrates the drivetrain.
Usage:
Drivetrain.calibrateDrivetrain();
// Example coming soon
Mutadores#
setDriveVelocity#
setDriveVelocity
sets the default moving velocity for a drivetrain. This velocity setting will be used for subsequent calls to any drivetrain functions if a specific velocity is not provided.
Usage:
Drivetrain.setDriveVelocity(velocity, units);
Parámetros |
Descripción |
---|---|
velocidad |
La velocidad a la que el tren motriz se moverá como un doble. |
unidades |
The unit that represents the velocity:
|
// Example coming soon
setTurnVelocity#
setTurnVelocity
sets the default turning velocity for a drivetrain. This velocity setting will be used for subsequent calls to any drivetrain functions if a specific velocity is not provided.
Usage:
Drivetrain.setTurnVelocity(velocity, units);
Parámetros |
Descripción |
---|---|
velocidad |
La velocidad a la que el tren motriz girará como un doble. |
unidades |
The unit that represents the velocity:
|
setStopping#
setStopping
sets the stopping mode for a drivetrain.
Usage:
Drivetrain.setStopping(mode);
Parámetros |
Descripción |
---|---|
modo |
How the drivetrain will stop:
|
// Example coming soon
setTimeout#
setTimeout
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.setTimeout(time, units);
Parámetros |
Descripción |
---|---|
tiempo |
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 número entero. |
unidades |
The unit that represents the time:
|
// Example coming soon
setHeading#
setHeading
sets the heading of a smart drivetrain.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.setHeading(value, units);
Parámetros |
Descripción |
---|---|
valor |
El nuevo título como doble. |
unidades |
The unit that represents the heading:
|
// Example coming soon
setRotation#
setRotation
sets the rotation for the smart drivetrain.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.setRotation(value, units);
Parámetros |
Descripción |
---|---|
valor |
El nuevo valor rotacional como doble. |
unidades |
The unit that represents the heading:
|
// Example coming soon
setGearRatio#
setGearRatio
sets the gear ratio for all motors on the Drivetrain.
Usage:
Drivetrain.setGearRatio(mode);
Parámetros |
Descripción |
---|---|
modo |
Gear Ratio options:
|
// Example coming soon
setTurnThreshold#
setTurnThreshold
method sets the turn threshold for the Smartdrive. The threshold value is used to determine that turns are complete. If this is too large, then turns will not be accurate. If too small, then turns may not complete.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.setTurnThreshold(t);
Parámetros |
Descripción |
---|---|
el |
The new turn threshold in |
// Example coming soon
setTurnConstant#
setTurnConstant
method sets the turn constant for the Smartdrive. The Smart Drivetrain uses a simple P controller when doing turns. This constant, generally known as kp, is the gain used in the equation that turns angular error into motor velocity.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.setTurnConstant(kp);
Parámetros |
Descripción |
---|---|
kp |
La nueva constante de giro está en el rango de 0,1 a 4,0. El valor predeterminado es 1,0. |
// Example coming soon
setTurnDirectionReverse#
setTurnDirectionReverse
method sets the expected turn direction for positive heading.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.setTurnDirectionReverse(value);
Parámetros |
Descripción |
---|---|
valor |
A boolean value to set the reversed flag to |
// Example coming soon
Captadores#
isDone#
isDone
returns a Boolean indicating whether a drivetrain is not currently moving.
true
– The drivetrain is not moving.false
– The drivetrain is moving.
Usage:
Drivetrain.isDone()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
// Example coming soon
isMoving#
isMoving
returns a Boolean indicating whether a drivetrain is currently moving.
true
– The drivetrain is moving.false
– The drivetrain is not moving.
Usage:
Drivetrain.isMoving()
Parámetros |
Descripción |
---|---|
Este método no tiene parámetros. |
// Example coming soon
heading#
heading
returns the current heading of a smart drivetrain as a double.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.heading(units)
Parámetros |
Descripción |
---|---|
unidades |
Optional. The unit that represents the rotational value:
|
// Example coming soon
rotation#
rotation
returns the current rotational value of a smart drivetrain as a double.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.rotation(units)
Parámetros |
Descripción |
---|---|
unidades |
Optional. The unit that represents the rotational value:
|
// Example coming soon
velocity#
velocity
returns the current velocity of a drivetrain as a double.
Usage:
Drivetrain.velocity(units)
Parámetros |
Descripción |
---|---|
unidades |
The unit that represents the velocity:
|
// Example coming soon
current#
current
returns the current current of a drivetrain as a double.
Usage:
Drivetrain.current(units)
Parámetros |
Descripción |
---|---|
unidades |
Optional. The unit that represents the current:
|
// Example coming soon
power#
power(units)
returns the average power of the Smart Drivetrain as a double.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.power(units)
Parámetros |
Descripción |
---|---|
unidades |
The only valid unit for power is |
// Example coming soon
torque#
torque
returns the average torque of the Drivetrain as a double.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.torque(units)
Parámetros |
Descripción |
---|---|
unidades |
A valid torque Unit:
|
// Example coming soon
efficiency#
efficiency
returns the average efficiency of the Drivetrain as a double.
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Usage:
Drivetrain.efficiency(units)
Parámetros |
Descripción |
---|---|
unidades |
The only valid unit for efficiency is |
// Example coming soon
temperature#
The temperature()
method returns the average temperature of the Drivetrain as a double.
Usage:
Drivetrain.temperature(units)
Nota: Este método solo funcionará con una transmisión que haya sido configurada con un sensor giroscópico o un sensor inercial cerebral.
Parámetros |
Descripción |
---|---|
unidades |
The only valid unit for temperature is |
// Example coming soon
Constructores#
Drivetrain#
Se crea un sistema de transmisión utilizando el siguiente constructor:
The drivetrain
constructor creates a drivetrain object.
Usage:
drivetrain(lm, rm, wheelTravel, trackWidth, wheelBase, unit, externalGearRatio);
Parámetro |
Descripción |
---|---|
|
El nombre del Motor o Grupo Motor izquierdo. |
|
El nombre del Motor o Grupo Motor derecho. |
|
Circunferencia de las ruedas motrices. El valor predeterminado es 300 mm. |
|
Ancho de vía del tren motriz. El valor predeterminado es 320 mm. |
|
Distancia entre ejes del tren motriz. El valor predeterminado es 320 mm. |
|
A valid distanceUnit for the units that wheelTravel, trackWidth and wheelBase are specified in. The default is |
|
La relación de transmisión utilizada para compensar las distancias de conducción si se utilizan engranajes. |
Los Motores y/o los Grupos de motores deben crearse primero antes de poder usarse para crear un objeto con el constructor de la clase drivetrain.
// Create the Motors.
motor left_motor = motor(PORT1,false);
motor right_motor = motor(PORT2, true);
// Construct a 2-Motor drivetrain "Drivetrain" with the
// drivetrain class.
drivetrain Drivetrain = drivetrain(left_motor, right_motor, 259.34, 320, 40, mm, 1);
Si va a fabricar un sistema de transmisión con 4 motores, deberá crear los Motores por separado antes de agruparlos en un Grupo de motores.
// Create the left Motors and group them under the
// motor_group "leftMotors".
motor leftMotorA = motor(PORT1, false);
motor leftMotorB = motor(PORT2, false);
motor_group leftMotors = motor_group(leftMotorA, leftMotorB);
// Create the right Motors and group them under the
// MotorGroup "rightMotors".
motor rightMotorA = motor(PORT3, true);
motor rightMotorB = motor(PORT4, true);
motor_group rightMotors = motor_group(rightMotorA, rightMotorB);
// Construct a 4-Motor drivetrain "Drivetrain" with the
// drivetrain class.
drivetrain Drivetrain = drivetrain(leftMotors, rightMotors, 259.34, 320, 40, mm, 1);
This Drivetrain
object will be used in all subsequent examples throughout this API documentation when referring to drivetrain class methods.
Para incorporar un Sensor inercial o un Sensor giroscópico para una funcionalidad de giro mejorada en su transmisión, puede incluirlo al crear un objeto usando el constructor de clase smartdrive.
Smartdrive#
Un sistema de transmisión inteligente se crea utilizando el siguiente constructor:
The smartdrive
constructor creates a smartdrive object. This object can do everything a drivetrain can do but has additional methods that include use of an Inertial Sensor or Gyro in order to make more accurate turns.
Usage:
smartdrive(lm, rm, guido, wheelTravel, trackWidth, wheelBase, unit, externalGearRatio);
Parámetro |
Descripción |
---|---|
|
El nombre del Motor o Grupo Motor izquierdo. |
|
El nombre del Motor o Grupo Motor derecho. |
|
El nombre del dispositivo que se utiliza para detectar el ángulo o la orientación del robot. Puede ser cualquier Sensor inercial o Sensor giroscópico. |
|
Circunferencia de las ruedas motrices. El valor predeterminado es 300 mm. |
|
Ancho de vía del sistema de propulsión inteligente. El valor predeterminado es 320 mm. |
|
Distancia entre ejes del Smart Drivetrain. La distancia predeterminada es de 320 mm. |
|
A valid distanceUnit for the units that wheelTravel, trackWidth and wheelBase are specified in. The default is |
|
La relación de transmisión utilizada para compensar las distancias de conducción si se utilizan engranajes. |
Los Motores y/o los Grupos de motores deben crearse primero antes de poder usarse para crear un objeto con el constructor de clase smartdrive.
// Create the Motors.
motor left_motor = motor(PORT1,false);
motor right_motor = motor(PORT2, true);
// Create the Inertial Sensor
inertial Inertial = inertial(PORT3);
// Construct a 2-Motor Smart Drivetrain "Smartdrive" with the
// smartdrive class.
smartdrive Smartdrive = smartdrive(left_motor, right_motor, Inertial, 259.34, 320, 40, mm, 1);
Si va a fabricar un sistema de transmisión inteligente de 4 motores, deberá crear los Motores por separado antes de agruparlos en un Grupo de motores.
// Create the left Motors and group them under the
// motor_group "leftMotors".
motor leftMotorA = motor(PORT1, false);
motor leftMotorB = motor(PORT2, false);
motor_group leftMotors = motor_group(leftMotorA, leftMotorB);
// Create the right Motors and group them under the
// MotorGroup "rightMotors".
motor rightMotorA = motor(PORT3, true);
motor rightMotorB = motor(PORT4, true);
motor_group rightMotors = motor_group(rightMotorA, rightMotorB);
// Create the Inertial Sensor
inertial Inertial = inertial(PORT5);
// Construct a 4-Motor smartdrive "Smartdrive" with the
// smartdrive class.
smartdrive Smartdrive = smartdrive(leftMotors, rightMotors, Inertial, 259.34, 320, 40, mm, 1);
This Smartdrive
object will be used in all subsequent examples throughout this API documentation when referring to smartdrive class methods.
Para crear un objeto sin una funcionalidad Sensor inercial o Sensor giroscópico, cree un objeto utilizando el constructor de clase drivetrain.