Transmisión#

Introducción#

Un sistema de transmisión permite que el robot se mueva de forma continua o durante distancias establecidas, gire por grados o en una dirección y responda a cambios en su orientación rotacional.

Si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico, la transmisión podrá realizar movimientos de avance, retroceso y giro más precisos al rastrear el rumbo y la rotación del sensor.

La categoría Tren Motriz también incluye métodos de configuración que permiten establecer velocidades de conducción y giro, definir comportamientos de frenado, aplicar tiempos de espera para evitar bloqueos de ejecución y actualizar manualmente los valores de rumbo o rotación del robot. Estas funciones ofrecen flexibilidad al diseñar comportamientos autónomos o ajustes en tiempo real.

This page uses drivetrain as the example drivetrain name. Replace it with your own configured name as needed.

A continuación se muestra una lista de los métodos disponibles:

Acciones: Mover y girar el robot.

  • drive — Drives the robot continuously forward or in reverse using the current drive velocity.

  • driveFor — Drives the robot forward or in reverse for a set distance.

  • turn — Rotates the robot continuously left or right using the current turn velocity.

  • turnFor — Rotates the robot left or right for a specified angle.

  • turnToHeading — Rotates the robot to face a specific absolute heading.

  • turnToRotation — Rotates the robot to reach a specific cumulative rotation.

  • stop — Stops the drivetrain using the configured stopping mode.

  • calibrateDrivetrain — Calibrates the drivetrain’s configured Inertial Sensor, GPS Sensor, or Gyro Sensor.

  • arcade — Drives the drivetrain forward or reverse while turning at the same time.

Mutadores: establecen velocidades de movimiento y giro predeterminadas.

  • setDriveVelocity — Sets the default drive velocity used by drive methods.

  • setTurnVelocity — Sets the default turn velocity used by turn methods.

  • setStopping — Sets how the drivetrain behaves when it stops.

  • setTimeout — Sets how long drive and turn methods try to reach their target before timing out.

  • setHeading — Manually sets the robot’s heading value.

  • setRotation — Manually sets the robot’s cumulative rotation value.

  • setGearRatio — Sets the gear ratio for all motors on the drivetrain.

  • setTurnThreshold — Sets the turn threshold for a drivetrain.

  • setTurnConstant — Sets the turn constant for a drivetrain.

  • setTurnDirectionReverse — Sets a drivetrain to have its direction be reversed.

  • setTurnVelocityMin — Sets the minimum turning velocity used by a drivetrain.

Getters — Devuelven el estado y la posición del robot.

  • isDone — Returns whether a drivetrain is not currently moving.

  • isMoving — Returns whether a drivetrain is currently moving.

  • isTurning — Returns whether a drivetrain is currently turning.

  • heading — Returns the drivetrain’s heading angle.

  • rotation — Returns how much the drivetrain has turned since the project started.

  • velocity — Returns the drivetrain’s current velocity.

  • current — Returns the drivetrain’s current draw.

  • power — Returns the drivetrain’s power usage.

  • torque — Returns the drivetrain’s torque.

  • efficiency — Returns the drivetrain’s efficiency.

  • temperature — Returns the drivetrain motors’ temperature.

  • voltage — Returns the voltage currently applied to the drivetrain.

Constructores: inicializan y configuran manualmente la transmisión.

Comportamiento#

drive#

drive moves the drivetrain forward or in reverse using the current drive velocity. This method runs continuously until another Drivetrain method interrupts it or the project stops.

Default Usage:
Drivetrain.drive(direction);

Overload Usages:
Drivetrain.drive(direction, velocity, units);

Parámetros

Descripción

direction

The direction in which the robot drives:

  • forward
  • reverse

velocity

La velocidad a la que la transmisión se moverá como un doble. Si la velocidad no se especifica o previamente establecida, la velocidad predeterminada es del 50%.

units

The unit to represent the velocity:

  • velocityUnits::pct — percent
  • rpm — rotations per minute
  • dps — degrees per second

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Drive forward and back
  Drivetrain.drive(forward);
  wait(2, seconds);
  Drivetrain.drive(reverse, 25, velocityUnits::pct);
  wait(2, seconds);
  Drivetrain.stop();
}

driveFor#

driveFor moves the drivetrain forward or in reverse for a specified distance using the current drive velocity.

Default Usage:
Drivetrain.driveFor(direction, distance, units, wait);

Overload Usages:
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

direction

The direction in which the robot drives:

  • forward
  • reverse

distance

La distancia que recorrerá la transmisión es el doble.

units

The units representing the distance:

  • mm — millimeters
  • inches — inches
  • cm — centimeters

wait

Optional.

  • true (default) — The project waits until driveFor is complete before executing the next line of code.
  • false — The project starts the action and moves on to the next line of code right away, without waiting for driveFor to finish.

velocity

La velocidad a la que la transmisión se moverá como un doble. Si la velocidad no se especifica o previamente establecida, la velocidad predeterminada es del 50%.

units_v

The unit to represent the velocity:

  • velocityUnits::pct — percent
  • rpm — rotations per minute
  • dps — degrees per second

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Drive 200 mm, then back 200 mm
  Drivetrain.driveFor(forward, 200, mm);
  Drivetrain.driveFor(reverse, 200, mm);
}

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

direction

The direction in which to turn:

  • left
  • right

velocity

La velocidad a la que la transmisión girará en doble. Si no se especifica la velocidad o se ha establecido previamente en#setturnvelocity, la velocidad predeterminada es del 50 %.

units

The unit that represents the velocity:

  • velocityUnits::pct — percent
  • rpm — rotations per minute
  • dps — degrees per second

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Turn right, then left, then stop
  Drivetrain.turn(right);
  wait(2, seconds);
  Drivetrain.turn(left);
  wait(2, seconds);
  Drivetrain.stop();
}

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

direction

The direction in which to turn:

  • left
  • right

angle

La cantidad de grados que la transmisión girará como un doble.

units

The unit that represents the rotational value:

  • degrees
  • turns

velocity

La velocidad a la que la transmisión girará en doble. Si no se especifica la velocidad o se ha establecido previamente en#setturnvelocity, la velocidad predeterminada es del 50 %.

units_v

The unit that represents the velocity:

  • velocityUnits::pct — percent
  • rpm — rotations per minute
  • dps — degrees per second

wait

Optional.

  • true (default) — The project waits until turnFor is complete before executing the next line of code.
  • false — The project starts the action and moves on to the next line of code right away, without waiting for turnFor to finish.

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Turn right then left
  Drivetrain.turnFor(right, 90, degrees);
  wait(1, seconds);
  Drivetrain.turnFor(left, 90, degrees);
}

turnToHeading#

turnToHeading turns a smart drivetrain to a specified heading.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Default Usage:
Drivetrain.turnToHeading(angle, units, wait);

Overload Usages:
Drivetrain.turnToHeading(angle, units, velocity, units_v, wait);

Parámetros

Descripción

angle

El rumbo para girar la transmisión para hacerla quedar en posición doble.

units

The unit that represents the rotational value:

  • degrees
  • turns

velocity

La velocidad a la que la transmisión girará como un doble. Si la velocidad no se especifica o previamente establecida, la velocidad predeterminada es del 50%.

units_v

The unit that represents the velocity:

  • velocityUnits::pct — percent
  • rpm — rotations per minute
  • dps — degrees per second

wait

Optional.

  • true (default) — The project waits until turnToHeading is complete before executing the next line of code.
  • false — The project starts the action and moves on to the next line of code right away, without waiting for turnToHeading to finish.

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Face the cardinal directions
  Drivetrain.turnToHeading(90, degrees);
  wait(1, seconds);
  Drivetrain.turnToHeading(180, degrees);
  wait(1, seconds);
  Drivetrain.turnToHeading(270, degrees);
  wait(1, seconds);
  Drivetrain.turnToHeading(0, degrees);
}

turnToRotation#

turnToRotation turns a smart drivetrain to a specified rotational value.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Default Usage:
Drivetrain.turnToRotation(angle, units, wait);

Overload Usages:
Drivetrain.turnToRotation(angle, units, velocity, units_v, wait);

Parámetros

Descripción

angle

El valor rotacional para girar la transmisión para que quede orientada como un doble.

units

The unit that represents the rotational value:

  • degrees
  • turns

velocity

La velocidad a la que la transmisión girará como un doble. Si la velocidad no se especifica o previamente establecida, la velocidad predeterminada es del 50%.

units_v

The unit that represents the velocity:

  • velocityUnits::pct — percent
  • rpm — rotations per minute
  • dps — degrees per second

wait

Optional.

  • true (default) — The project waits until turnToRotation is complete before executing the next line of code.
  • false — The project starts the action and moves on to the next line of code right away, without waiting for turnToRotation to finish.

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Turn left, then spin clockwise to face right
  Drivetrain.turnToRotation(-90, degrees);
  wait(1, seconds);
  Drivetrain.turnToRotation(450, degrees);
}

stop#

stop stops a drivetrain.

Default Usage:
Drivetrain.stop();

Overload Usages:
Drivetrain.stop(mode);

Parámetros

Descripción

mode

The stopping behavior to use when the drivetrain stops:

  • brake — Stops immediately.
  • coast — Slows gradually to a stop.
  • hold — Stops and resists movement using motor feedback.
If the stopping mode is not specified or previously set, the default behavior is brake.

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Drive forward, then coast to a stop
  Drivetrain.setDriveVelocity(100, percent);
  Drivetrain.drive(forward);
  wait(2, seconds);
  Drivetrain.stop(coast);
}

calibrateDrivetrain#

calibrateDrivetrain calibrates the drivetrain.

Este es un método generado por la configuración del robot de VEXcode al configurar una transmisión en la ventana Dispositivos. No funcionará fuera de VEXcode V5.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Usage:
Drivetrain.calibrateDrivetrain();

Parámetros

Descripción

Este método no tiene parámetros.

arcade#

arcade moves the drivetrain forward or reverse while turning at the same time. This method runs continuously until another Drivetrain method interrupts it or the project stops.

Usage:
Drivetrain.arcade(drivePower, turnPower, units);

Parámetros

Descripción

drivePower

La velocidad de avance o retroceso es doble. Un número positivo indica avance, uno negativo indica retroceso.

turnPower

La velocidad para girar a la izquierda o a la derecha es doble. Un número positivo girará a la derecha, uno negativo girará a la izquierda.

units

Optional. The unit that represents the power values:

  • percentUnits::pct — percent

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Drive forward and left for 2 seconds
  Drivetrain.arcade(25, -25);
  wait(2, seconds);
  Drivetrain.driveFor(forward, 12, inches);
}

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

velocity

La velocidad a la que el tren motriz se moverá como un doble.

units

The unit that represents the velocity:

  • percent — percent
  • rpm — rotations per minute
  • dps — degrees per second

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Try default, slow, then fast
  Drivetrain.driveFor(forward, 150, mm);
  wait(1, seconds);
  Drivetrain.setDriveVelocity(20, percent);
  Drivetrain.driveFor(forward, 150, mm);
  wait(1, seconds);
  Drivetrain.setDriveVelocity(100, percent);
  Drivetrain.driveFor(forward, 150, mm);
}

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

velocity

La velocidad a la que el tren motriz girará como un doble.

units

The unit that represents the velocity:

  • percent — percent
  • rpm — rotations per minute
  • dps — degrees per second

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Try default, slow, then fast
  Drivetrain.turnFor(right, 360, degrees);
  wait(1, seconds);
  Drivetrain.setTurnVelocity(20, percent);
  Drivetrain.turnFor(right, 360, degrees);
  wait(1, seconds);
  Drivetrain.setTurnVelocity(100, percent);
  Drivetrain.turnFor(right, 360, degrees);
}

setStopping#

setStopping sets the stopping mode for a drivetrain.

Usage:
Drivetrain.setStopping(mode);

Parámetros

Descripción

mode

How the drivetrain will stop:

  • brake — Stops immediately.
  • coast — Slows gradually to a stop.
  • hold — Stops and resists movement using motor feedback.

setTimeout#

setTimeout sets a time limit for how long a Drivetrain command will wait to reach its target. If the robot cannot complete the movement within the set time, it will stop automatically and continue with the next command.

Nota: El límite de tiempo del tren motriz se utiliza para evitar que los comandos del tren motriz que no alcanzan su posición objetivo detengan la ejecución de otros comandos.

Usage:
Drivetrain.setTimeout(time, units);

Parámetros

Descripción

time

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.

units

The unit that represents the time:

  • seconds
  • msec — milliseconds

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Start turning if drive took too long
  Drivetrain.setTimeout(1, seconds);
  Drivetrain.driveFor(forward, 25, inches);
  Drivetrain.turnFor(right, 90, degrees);
}

setHeading#

setHeading sets the heading of a smart drivetrain.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Usage:
Drivetrain.setHeading(value, units);

Parámetros

Descripción

value

El nuevo título como doble.

units

The unit that represents the heading:

  • degrees
  • turns

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Face the new 0 degrees
  Drivetrain.setHeading(90, degrees);
  Drivetrain.turnToHeading(0, degrees);
}

setRotation#

setRotation sets the rotation for the smart drivetrain.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Usage:
Drivetrain.setRotation(value, units);

Parámetros

Descripción

value

El nuevo valor rotacional como doble.

units

The unit that represents the rotation:

  • degrees
  • turns

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Spin counterclockwise for 2 turns, then face forward
  Drivetrain.setRotation(720, degrees);
  Drivetrain.turnToRotation(0, degrees);
}

setGearRatio#

setGearRatio sets the gear ratio for all motors on the drivetrain.

Usage:
Drivetrain.setGearRatio(mode);

Parámetros

Descripción

mode

Gear Ratio options:

  • ratio1_1 — A gear unit that is defined as 1:1 gearing.
  • ratio2_1 — A gear unit that is defined as 2:1 gearing.
  • ratio3_1 — A gear unit that is defined as 3:1 gearing.

// Set 2:1 gear ratio
Drivetrain.setGearRatio(ratio2_1);

setTurnThreshold#

setTurnThreshold sets the turn threshold for a smart drivetrain. 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 está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Usage:
Drivetrain.setTurnThreshold(threshold);

Parámetros

Descripción

threshold

The new turn threshold in degrees as a double. The default for a smart drivetrain is 1 degree.

// Increase turn threshold to 5 degrees
Drivetrain.setTurnThreshold(5);

setTurnConstant#

setTurnConstant sets the turn constant for a smart drivetrain. Smart drivetrains use 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 está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

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.

// Increase turn gain to 2.0
Drivetrain.setTurnConstant(2.0);

setTurnDirectionReverse#

setTurnDirectionReverse sets the smart drivetrain to be reversed.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Usage:
Drivetrain.setTurnDirectionReverse(value);

Parámetros

Descripción

value

A Boolean value to set the reversed flag to true or false.

setTurnVelocityMin#

setTurnVelocityMin sets the minimum turning velocity used by a drivetrain. This prevents the drivetrain from slowing below a minimum speed while turning, which helps avoid stalling or incomplete turns.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Usage:
Drivetrain.setTurnVelocityMin(velocity);

Parámetros

Descripción

velocity

La velocidad mínima de giro es el doble.

Captadores#

isDone#

isDone returns a Boolean indicating whether driveFor, turnToHeading, turnToRotation, or turnFor is not running.

  • true — The drivetrain is not moving towards a target.

  • false — The drivetrain is moving towards a target.

Usage:
Drivetrain.isDone()

Parámetros

Descripción

Este método no tiene parámetros.

isMoving#

isMoving returns a Boolean indicating whether driveFor, turnToHeading, turnToRotation, or turnFor is still running.

  • true — The drivetrain is moving towards a target.

  • false — The drivetrain is not moving towards a target.

Usage:
Drivetrain.isMoving()

Parámetros

Descripción

Este método no tiene parámetros.

isTurning#

isTurning returns a Boolean indicating whether turnToHeading, turnToRotation, or turnFor is still running.

  • true — The drivetrain is currently rotating to a target.

  • false — The drivetrain is not currently rotating to a target.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Usage:
Drivetrain.isTurning()

Parámetros

Descripción

Este método no tiene parámetros.

heading#

heading returns the current heading of a smart drivetrain from 0–359.99 degrees as a double.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Usage:
Drivetrain.heading(units)

Parámetros

Descripción

units

Optional. The unit that represents the rotational value:

  • degrees (default)
  • turns

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Display heading after a long turn
  Drivetrain.turnFor(right, 450, degrees);
  Brain.Screen.print("Heading: %f", Drivetrain.heading(degrees));
}

rotation#

rotation returns the current rotational value of a smart drivetrain as a double.

Nota: Este método solo está disponible si la transmisión está configurada con un Sensor inercial, Sensor GPS o Sensor giroscópico en la ventana Dispositivos.

Usage:
Drivetrain.rotation(units)

Parámetros

Descripción

units

Optional. The unit that represents the rotational value:

  • degrees (default)
  • turns

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Display rotation after a long turn
  Drivetrain.turnFor(right, 450, degrees);
  Brain.Screen.print("Rotation: %f", Drivetrain.rotation(degrees));
}

velocity#

velocity returns the current velocity of a drivetrain as a double.

Usage:
Drivetrain.velocity(units)

Parámetros

Descripción

units

The unit that represents the velocity:

  • percent
  • rpm — rotations per minute
  • dps — degrees per second

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Show velocity before and during motion
  Brain.Screen.print("Resting: %f", Drivetrain.velocity(percent));
  Drivetrain.drive(forward, 100, velocityUnits::pct);
  wait(1, seconds);
  Brain.Screen.newLine();
  Brain.Screen.print("Moving: %f", Drivetrain.velocity(percent));
  Drivetrain.stop();
}

current#

current returns the drivetrain’s current as a double.

Usage:
Drivetrain.current(units)

Parámetros

Descripción

units

The unit that represents the current:

  • percent
  • amp (default)

power#

power returns the average power of the smart drivetrain as a double.

Usage:
Drivetrain.power(units)

Parámetros

Descripción

units

The unit that represents the power:

  • watt

torque#

torque returns the average torque of the drivetrain as a double.

Usage:
Drivetrain.torque(units)

Parámetros

Descripción

units

A valid torque Unit:

  • Nm (default) — newton meters
  • InLb — inch pounds

efficiency#

efficiency returns the average efficiency of the drivetrain as a double.

Usage:
Drivetrain.efficiency(units)

Parámetros

Descripción

units

The unit that represents the efficiency:

  • percent

temperature#

temperature returns the average temperature of the drivetrain as a double.

Usage:
Drivetrain.temperature(units)

Parámetros

Descripción

units

The unit that represents the temperature:

  • percent

voltage#

voltage returns the voltage currently applied to the drivetrain motors.

Usage:
Drivetrain.voltage(units)

Parámetros

Descripción

units

The unit that represents the voltage:

  • volt

Constructores#

Constructors are used to manually create drivetrain and smartdrive objects, which are necessary for configuring a drivetrain outside of VEXcode.

drivetrain#

drivetrain creates a drivetrain without an Inertial Sensor, GPS Sensor, or Gyro Sensor.

Usage:
drivetrain(l, r, wheelTravel, trackWidth, wheelBase, unit, externalGearRatio);

Parámetro

Descripción

l

El nombre del [motor o grupo motor] izquierdo (Motion/motor_and_motor_group.md).

r

El nombre del motor o grupo motor.

wheelTravel

La circunferencia de las ruedas motrices es doble. El valor predeterminado es 320 milímetros.

trackWidth

El ancho de vía del tren motriz es doble. El valor predeterminado es 320 milímetros.

wheelBase

La distancia entre ejes del tren motriz es doble. El valor predeterminado es de 130 milímetros.

unit

The units that represent wheelTravel, trackWidth and wheelBase:

  • mm (default) — millimeters
  • inches

externalGearRatio

La relación de transmisión utilizada para compensar las distancias de conducción si se utiliza un engranaje doble. El valor predeterminado es 1.0.

Note: Motors and/or motor groups must be created first before they can be used to create an object with the drivetrain constructor.

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Create the motors
  motor leftMotor = motor(PORT1, false);
  motor rightMotor = motor(PORT2, true);

  /*
  Create a drivetrain with the following values:
  wheelTravel: 259.34
  trackWidth: 320
  wheelBase: 40
  units: MM
  externalGearRatio: 1
  */
  drivetrain Drivetrain = drivetrain(leftMotor, rightMotor, 259.34, 320, 40, mm, 1);
}

smartdrive#

smartdrive creates a drivetrain configured with an Inertial Sensor, GPS Sensor, or Gyro Sensor.

Usage:
smartdrive(lm, rm, guido, wheelTravel, trackWidth, wheelBase, unit, externalGearRatio);

Parámetro

Descripción

lm

El nombre del [motor o grupo motor] izquierdo (Motion/motor_and_motor_group.md).

rm

El nombre del motor o grupo motor.

guido

El nombre del Sensor inercial, Sensor GPS o Sensor giroscópico.

wheelTravel

La circunferencia de las ruedas motrices es doble. El valor predeterminado es 320 milímetros.

trackWidth

El ancho de vía del tren motriz es doble. El valor predeterminado es 320 milímetros.

wheelBase

La distancia entre ejes del tren motriz es doble. El valor predeterminado es de 130 milímetros.

unit

The units that represent wheelTravel, trackWidth and wheelBase:

  • mm (default) — millimeters
  • inches

externalGearRatio

La relación de transmisión utilizada para compensar las distancias de conducción si se utiliza un engranaje doble. El valor predeterminado es 1.0.

Note: Motors and/or motor groups must be created first before they can be used to create an object with the smartdrive constructor.

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Create the motors
  motor leftMotor = motor(PORT1, false);
  motor rightMotor = motor(PORT2, true);

  // Create an Inertial sensor in Port 3
  inertial myInertial = inertial(PORT3);

  /*
  Create a drivetrain with the following values:
  wheelTravel: 259.34
  trackWidth: 320
  wheelBase: 40
  units: MM
  externalGearRatio: 1
  */
  smartdrive Smartdrive = smartdrive(leftMotor, rightMotor, myInertial, 259.34, 320, 40, mm, 1);
}