Drivetrain#

Introduction#

The VEX GO Drivetrain uses a built-in Inertial Sensor to support precise forward, reverse, and turning movements. These blocks allow the robot to move continuously or for set distances, rotate by degrees or to a heading, and respond to changes in its rotational orientation.

The Drivetrain category also includes configuration blocks that let you set drive and turn speeds, define stopping behavior, apply timeouts to avoid execution stalls, and manually update the robot’s heading or rotation values.

Below is a list of all available blocks:

Actions – Move and turn the robot.

  • drive – Drives the robot continuously forward or in reverse.

  • drive for – Drives the robot for a set distance.

  • drive until – Drive until a specified condition.

  • turn – Turns the robot continuously left or right.

  • turn for – Turns the robot a specific number of degrees.

  • turn to heading – Turns the robot to face a specific absolute heading.

  • turn to rotation – Turns the robot to reach a specific cumulative rotation.

  • stop driving – Stops all robot movement.

Settings – Adjust drivetrain settings.

Values – Check movement status.

  • drive is done? – Returns a Boolean indicating whether the drivetrain is no longer moving.

  • drive heading – Returns the drivetrain’s heading angle (0 to 359.99 degrees).

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

  • drive velocity – Returns the drivetrain’s current velocity in %.

Actions#

drive#

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

aria-description goes here#
  drive [forward v]

Parameters

Description

direction

The direction in which the robot drives:

  • forward
  • reverse

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Drive forward then stop.]
  drive [forward v]    
  wait (2) seconds
  stop driving

drive for#

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

aria-description goes here#
  drive [forward v] for [100] [mm v] ▶

Parameters

Description

direction

The direction in which the robot drives:

  • forward
  • reverse

distance

The distance the robot drives, as an integer or decimal.

unit

The unit of measurement that represents the distance:

  • mm – Millimeters
  • inches

expanding arrow

By default, this is a waiting block, so the drivetrain will finish moving before running the next block. To make the drivetrain start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Drive back and forth.]
  drive [forward v] for [100] [mm v] ▶
  drive [reverse v] for [4] [inches v] ▶

drive until#

The drive until block is used to move the drivetrain indefinitely using the current drive velocity until the Eye Sensor detects an object or the robot crashes into an object or wall.

  drive [forward v] until [crash v] ▶

Parameters

Description

direction

The direction in which the robot drives:

  • forward
  • reverse

condition

The condition that stops the drivetrain:

  • crash – When the robot crashes into an object.
  • object – When the Eye Sensor detects an object (Eye Sensor must be installed).

expanding arrow

By default, this is a waiting block, so the drivetrain will finish moving before running the next block. To make the drivetrain start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Turn right after a crash.]
  drive [forward v] until [crash v] ▶
  turn [right v] for (90) degrees ▶

turn#

The turn block turns the drivetrain continuously left or right using the current turn velocity. The drivetrain will keep turning until another Drivetrain block runs or the project stops.

aria-description goes here#
  turn [right v]

Parameters

Description

direction

The direction in which the robot turns:

  • left
  • right

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Turn right and left, then stop.]
  turn [right v]
  wait [2] seconds
  turn [left v]
  wait [2] seconds
  stop driving

turn for#

The turn for block turns the drivetrain left or right for a specific number of degrees using the current turn velocity.

aria-description goes here#
  turn [right v] for (90) degrees ▶

Parameters

Description

direction

The direction in which the robot turns:

  • left
  • right

angle

The number of degrees the robot turns, as an integer or decimal.

expanding arrow

By default, this is a waiting block, so the drivetrain will finish turning before running the next block. To make the drivetrain start turning and immediately run the next block right away, expand the block to say and don’t wait.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Turn right then left.]
  turn [right v] for (90) degrees ▶
  turn [left v] for (90) degrees ▶

turn to heading#

The turn to heading block turns the drivetrain to face a specific heading using the current turn velocity.

aria-description goes here#
  turn to heading [90] degrees ▶

Parameters

Description

heading

The absolute heading the drivetrain will turn to, from -360 to 360 degrees.

expanding arrow

By default, this is a waiting block, so the drivetrain will finish turning before running the next block. To make the drivetrain start turning and immediately run the next block right away, expand the block to say and don’t wait.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Turn to face the cardinal directions.]
  turn to heading [90] degrees ▶
  wait [1] seconds
  turn to heading [180] degrees ▶
  wait [1] seconds
  turn to heading [270] degrees ▶
  wait [1] seconds
  turn to heading [0] degrees ▶

turn to rotation#

The turn to rotation block turns the drivetrain to face a specific rotational value using the current turn velocity.

aria-description goes here#
  turn to rotation (90) degrees ▶

Parameters

Description

rotation

The cumulative rotation value the robot will turn to, as an integer or decimal.

expanding arrow

By default, this is a waiting block, so the drivetrain will finish turning before running the next block. To make the drivetrain start turning and immediately run the next block right away, expand the block to say and don’t wait.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Spin around twice.]
  turn to rotation (720) degrees ▶

stop driving#

The stop driving block immediately stops all movement of the drivetrain.

aria-description goes here#
  stop driving

Parameters

Description

This block has no parameters.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Drive forward then stop.]
  drive [forward v]    
  wait (2) seconds
  stop driving

set drive velocity#

The set drive velocity block sets the default movement speed as a percentage for all subsequent movement blocks in the project.

aria-description goes here#
  set drive velocity to [50] %

Parameters

Description

velocity

Sets the default movement velocity from 0% to 100%.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Drive at different velocities.]
  drive [forward v] for [100] [mm v] ▶
  wait [1] seconds
  [Drive slow.]
  set drive velocity to [20] %
  drive [forward v] for [100] [mm v] ▶
  wait [1] seconds
  [Drive fast.]  
  set drive velocity to [100] %
  drive [forward v] for [100] [mm v] ▶

set turn velocity#

The set turn velocity block sets the default velocity as a percentage for all subsequent turn blocks in the project.

aria-description goes here#
  set turn velocity to [50] %

Parameters

Description

velocity

Sets the default turn velocity from 0% to 100%.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Turn at different velocities.]
  turn [right v] for [180] degrees ▶
  wait [1] seconds
  [Turn fast.]
  set turn velocity to [100] %
  turn [right v] for [180] degrees ▶

set drive stopping#

The set drive stopping block sets how the drivetrain behaves when drivetrain movement ends.

aria-description goes here#
  set drive stopping to [brake v]

Parameters

Description

stopping behavior

Sets how the drivetrain stops:

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

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Drive, then coast to a stop.]
  set drive velocity to [100] %
  set drive stopping to [coast v]
  drive [forward v]
  wait [2] seconds
  stop driving

set drive timeout#

The set drive timeout block sets a time limit for how long a Drivetrain block 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 block.

Note: The Drivetrain’s time limit is used to prevent Drivetrain blocks that do not reach their target position from stopping the execution of other blocks in the stack.

aria-description goes here#
  set drive timeout to [1] seconds

Parameters

Description

time

The maximum number of seconds a Drivetrain block will run before stopping and moving to the next block.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Drive as far as possible for 1 second before turning right.]
  set drive timeout to [1] seconds
  drive [forward v] for [25] [inches v] ▶
  turn [right v] for [90] degrees ▶

set drive heading#

The set drive heading block sets the Inertial Sensor’s current heading to a specified value.

aria-description goes here#
  set drive heading to [0] degrees

Parameters

Description

heading

The heading value to assign, in degrees.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Face the new 0 degree heading.]
  set drive heading to [90] degrees
  turn to heading [0] degrees ▶

set drive rotation#

The set drive rotation block sets the Inertial Sensor’s current cumulative rotation value.

aria-description goes here#
  set drive rotation to (0) degrees

Parameters

Description

rotation

The cumulative rotation value to assign, in degrees.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Spin counterclockwise two times.]
  set drive rotation to [720] degrees
  turn to rotation [0] degrees ▶

Values#

drive is done?#

The drive is done? block returns a Boolean indicating whether the drivetrain is not moving.

  • True - The drivetrain is not moving.

  • False - The drivetrain is moving.

    <drive is done?>

Parameters

Description

This block has no parameters.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Turn when the drivetrain is done moving forward.]
  drive [forward v] for [100] [mm v] ◀ and don't wait
  wait [0.25] seconds
  forever
  if <drive is done?> then
  turn [right v] for [180] degrees ▶
  break
  else
  print [Still moving...] ▶
  wait [0.1] seconds
  clear all rows

drive heading#

The drive heading block returns the drivetrain’s heading angle in a range from 0 to 359.99 degrees.

    (drive heading in degrees)

Parameters

Description

This block has no parameters.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Display the heading while turning.]
  turn [right v] for [450] degrees ◀ and don't wait
  forever
  clear all rows
  print (drive heading in degrees) ▶
  wait [0.1] seconds

drive rotation#

The drive rotation block returns how much the drivetrain has turned since the project started, in degrees: positive for clockwise, negative for counterclockwise.

    (drive rotation in degrees)

Parameters

Description

This block has no parameters.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Display the rotation while turning.]
  turn [right v] for [450] degrees ◀ and don't wait
  forever
  clear all rows
  print (drive rotation in degrees) ▶
  wait [0.1] seconds

drive velocity#

The drive velocity block returns the current speed of the drivetrain in a range from -100% to 100%.

    (drive velocity in %)

Parameters

Description

This block has no parameters.

Example

aria-description goes here#
  when started :: hat events
  [Build Used: Code Base 2.0]
  [Display the velocity of the robot before and while moving.]
  print [Start: ] ▶
  print (drive velocity in %) ▶
  set cursor to next row
  drive [forward v]
  wait [0.5] seconds
  print [Moving: ] ▶
  print (drive velocity in %) ▶
  stop driving