Inertial Sensing#

To make Inertial Sensor blocks appear in VEXcode V5, an Inertial Sensor must be configured in the Devices window.

For information about how Inertial Sensors work, read Using the Inertial Sensor with VEX V5

Acceleration of#

The Acceleration of block is used to report the acceleration value from one of the axes (x, y, or z) on the Inertial Sensor.

  ([Inertial20 v] acceleration of [X v] axis :: #5cb0d6)

The Acceleration of block reports a range from -4.0 to 4.0 Gs.

Choose which Gyro/Inertial Sensor to use.

Illustration of an acceleration device used for measuring motion and speed in robotics applications.

Choose which axis to use:

  • x - The X-axis reports acceleration when the Inertial Sensor moves forward to backward.

  • y - The Y-axis reports acceleration when the Inertial Sensor moves side to side.

  • z - The Z-axis reports acceleration when the Inertial Sensor moves up to down.

Diagram illustrating the acceleration axis in V5 Brain Sensing, showing x, y, and z acceleration values.

In this example, the Drivetrain will move forward and print its current X-axis acceleration while moving.

  when started :: hat events
  [Drive forward for 1 second.]
  drive [forward v]
  wait (1) seconds
  [Print the X-axis acceleration while the Drivetrain is moving.]
  print ([BrainInertial v] acceleration of [X v] axis in g :: #5cb0d6) on [Brain v] ◀ and set cursor to next row

Gyro Rate of#

The Gyro Rate of block is used to report the rate of rotation from one of the axes (x, y, or z) on the Inertial Sensor.

  ([Inertial20 v] gyro rate to [X v] axis :: #5cb0d6)

The Gyro Rate of block reports a range from -1000.0 to 1000.0 in dps (degrees per second).

Choose which Gyro/Inertial Sensor to use.

Image of a gyro rate device displaying orientation and rotation data for robotics applications.

Choose which axis to use:

  • x - The X-axis reports rate of rotation when the Inertial Sensor rotates on the X-Axis (based on the orientation of the sensor).

  • y - The Y-axis reports rate of rotation when the Inertial Sensor rotates on the Y-Axis (based on the orientation of the sensor).

  • z - The Z-axis reports rate of rotation when the Inertial Sensor rotates in the Z-Axis (based on the orientation of the sensor).

Graphical representation of gyro rate sensing data showing orientation and rotation angles of a V5 Inertial Sensor.

In this example, the Drivetrain will turn to the right and print its current X-axis gyro rate while turning.

  when started :: hat events
  [Turn towards the right 1 second.]
  turn [right v]
  wait (1) seconds
  [Print the X-axis gyro rate while the Drivetrain is turning.]
  print ([BrainInertial v] acceleration of [x v] axis in g :: #5cb0d6) on [Brain v] ◀ and set cursor to next row

Orientation of#

The Orientation of block is used to report the orientation angle of the inertial sensor.

  ([Inertial20 v] orientation of [roll v])

Choose which Gyro/Inertial Sensor to use.

Image of a brain sensing device with various sensor readings displayed on the screen, including timer and battery status.

Choose which orientation to use:

  • roll - The Y-axis represents roll, which reports a value between -180 to +180 degrees.

  • pitch - The X-axis represents pitch, which reports a value between -90 to +90 degrees.

  • yaw - The Z-axis represents yaw, which reports a value between -180 to +180 degrees.

Flowchart illustrating various sensing blocks and their functionalities for the V5 Brain and controller system.

In this example, the Drivetrain will turn to the right and print its current roll as it turns.

  when started :: hat events
  [Turn towards the right for 1 second.]
  turn [right v]
  wait (1) seconds
  [Print the roll while the Drivetrain is turning.]
  print ([BrainInertial v] orientation of [roll v]) on [Brain v] ◀ and set cursor to next row