Drivetrain Sensing#
Introduction#
The Drivetrain Sensing category includes blocks that report real-time values from the VEX IQ (2nd gen) drivetrain, including heading, rotation, turning status, velocity, and stopping mode. These blocks provide useful feedback for autonomous logic and motion monitoring.
Below is a list of available blocks:
drive is done? – Returns a Boolean indicating whether the drivetrain is no longer moving.
drive is moving? – Returns a Boolean indicating whether the drivetrain is currently 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 % or rpm.
drive current – Returns the current (in amps) drawn by the drivetrain’s motors.
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
drive is moving?#
The drive is moving? block returns a Boolean indicating whether the drivetrain is moving.
True - The drivetrain is moving.
False - The drivetrain is not moving.
<drive is moving?>
Parameters |
Description |
---|---|
This block has no parameters. |
Example
drive heading#
The drive heading block returns the drivetrain’s heading angle as a decimal number, in the range 0 to 359.99 degrees.
(drive heading in degrees)
Parameters |
Description |
---|---|
This block has no parameters. |
Example
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 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
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 returns the current speed of the drivetrain in a range from -100% to 100% or -127 rpm to 127 rpm.
(drive velocity in [% v])
Parameters |
Description |
---|---|
unit |
The unit of measurement, which can be one of the following:
|
Example
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 returns the amount of electrical current the motor or motor group is drawing in a range from 0.0 to 1.2 amps (amperes).
(drive current in [amps v])
Parameters |
Description |
---|---|
This block has no parameters. |
Example
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