Drivetrain Sensing#

To make Drivetrain blocks appear in VEXcode V5, a Drivetrain must be configured in the Devices window.

Configure without a Gyro:

Configure with a Gyro:

For information about how Drivetrains work, read Creating a V5 Drivetrain.

Drivetrain Calibrate#

The Drivetrain Calibrate block is used to calibrate the Drivetrain’s sensor. It is recommended that this block is used at the start of the project.

  calibrate drivetrain

The Drivetrain must remain still for calibration process to succeed, which takes approximately 2 seconds.

In this example, the Drivetrain’s sensor will calibrate for 2 seconds before printing the current heading in degrees.

  when started :: hat events
  [Calibrate the Drivetrain, wait 2 seconds before doing anything.]
  calibrate drivetrain
  wait (2) seconds
  print (drive heading in degrees) on [Brain v] ◀ and set cursor to next row

Drive is Done?#

The Drive is Done? block is used to report if the Drivetrain has completed its movement.

  <drive is done?>

The Drive is Done? block reports True when the Drivetrain’s motors have completed their movement.

The Drive is Done? block reports False when the Drivetrain’s motors are still moving.

Drive is Moving?#

The Drive is Moving? block is used to report if the Drivetrain is currently moving.

  <drive is moving?>

The Drive is Moving? block reports True when the Drivetrain’s motors are moving.

The Drive is Moving? block reports False when the Drivetrain’s motors are not moving.

Drive Heading#

The Drive Heading block is used to report the direction that the Drivetrain is facing by using the Inertial sensor’s current angular position.

  (drive heading in degrees)

The Drive Heading block reports a range from 0.0 to 359.99 degrees.

In this example, the Drivetrain will turn to the right for 1 second before its current heading is printed on the Brain’s screen.

  when started :: hat events
  [Turn towards the right for 1 second.]
  turn [right v]
  wait (1) seconds
  [Print Drivetrain's current heading after 1 second.]
  print (drive heading in degrees) on [Brain v] ◀ and set cursor to next row 

Drive Rotation#

The Drive Rotation block is used to report the Drivetrain’s angle of rotation.

  (drive rotation in degrees)

A clockwise direction is reported as a positive value, and a counterclockwise value is reported as a negative value.

In this example, the Drivetrain will turn to the left for 1 second before its current rotation is printed on the Brain’s screen.

  when started :: hat events
  [Turn towards the left for 1 second.]
  turn [left v]
  wait (1) seconds
  [Print Drivetrain's current rotation after 1 second.]
  print (drive rotation in degrees) on [Brain v] ◀ and set cursor to next row 

Drive Velocity#

The Drive Velocity block is used to report the current velocity of the Drivetrain.

  drive velocity in [% v]

The Drive Velocity block reports a range from -100% to 100% or -600rpm to 600rpm.

Choose the units to report in, percent (%) or rotations per minute (rpm).

Image showing various units of drive velocity for a robot's drivetrain sensing system.

In this example, the Drivetrain will drive forward for 1 second before its current velocity is printed on the Brain’s screen.

  when started :: hat events
  [Drive forward for 1 second.]
  drive [forward v]
  wait (1) seconds
  [Print Drivetrain's current velocity after 1 second.]
  print (drive velocity in [% v]) on [Brain v] ◀ and set cursor to next row

Drive Current#

The Drive Current block is used to report the amount of current (power) that the Drivetrain is currently using.

  (drive current amps)

In this example, the Drivetrain will drive forward for 1 second before its current is printed on the Brain’s screen.

  when started :: hat events
  [Drive forward for 1 second.]
  drive [forward v]
  wait (1) seconds
  [Print Drivetrain's current after 1 second.]
  print (drive current amps) on [Brain v] ◀ and set cursor to next row

Drive Power#

The Drive Power block is used to report the amount of power output the Drivetrain is currently generating.

(drive power in watts)

In this example, the Drivetrain will drive forward for 1 second before its current power is printed on the Brain’s screen.

  when started :: hat events
  [Drive forward for 1 second.]
  drive [forward v]
  wait (1) seconds
  [Print Drivetrain's current power after 1 second.]
  print (drive power in watts) on [Brain v] ◀ and set cursor to next row 

Drive Torque#

The Drive Torque block is used to report the amount of torque (rotational force) the Drivetrain is currently using.

  (drive torque in [Nm v])

The Drive Torque block reports a range from 0.0 to 18.6 inch-pounds (InLB) or 0.0 to 2.1 Newton-meters (Nm).

Choose the units to report in, Nm or InLb.

Image showing various drive torque units for V5 Brain motor control and performance monitoring.

In this example, the Drivetrain will drive forward for 1 second before its current torque is printed on the Brain’s screen.

  when started :: hat events
  [Drive forward for 1 second.]
  drive [forward v]
  wait (1) seconds
  [Print Drivetrain's current torque after 1 second.]
  print (drive torque in [Nm v]) on [Brain v] ◀ and set cursor to next row 

Drive Efficiency#

The Drive Efficiency block is used to report the efficiency of the Drivetrain.

  (drive efficiency in %) 

The Drive Efficiency block reports a range from 0% to 100%, determined by the value of the power (in watts) the motor is using (input), versus the amount of power (in watts) the motor is providing (output).

An V5 Drivetrain typically reaches a maximum efficiency of 65% under normal use cases.

In this example, the Drivetrain will drive forward for 1 second before its current efficiency is printed on the Brain’s screen.

  when started :: hat events
  [Drive forward for 1 second.]
  drive [forward v]
  wait (1) seconds
  [Print Drivetrain's current efficiency after 1 second.]
  print (drive efficiency in %) on [Brain v] ◀ and set cursor to next row

Drive Temperature#

The Drive Temperature block is used to report the temperature of the V5 Smart Motors powering the Drivetrain.

  (drive temperature in %)

The Drive Temperature block reports a range from 0% to 100%.

In this example, the Drivetrain will drive forward for 1 second before its current temperature is printed on the Brain’s screen.

  when started :: hat events
  [Drive forward for 1 second.]
  drive [forward v]
  wait (1) seconds
  [Print Drivetrain's current temperature after 1 second.]
  print (drive temperature in %) on [Brain v] ◀ and set cursor to next row