Understanding Inertial Sensor Data from the VEX IQ (2nd gen) Brain

The VEX IQ (2nd generation) Brain has an Inertial Sensor built in. The Inertial Sensor reports data about heading, rotation, orientation, and acceleration in the sensor dashboard and in VEXcode IQ. This article will review what data is presented on the sensor dashboard.

For more information about accessing the sensor dashboard, see this article. 

Diagram illustrating VEX IQ sensors, showcasing their components and functions, designed to enhance understanding of robotics for educational purposes and beginner enthusiasts.


Heading

Diagram illustrating the various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections within the system to aid educational understanding and robotics projects.

Heading is the direction the Brain is facing and is reported compass-style using degrees from 0-359.99.  The 0 point can be set using commands in VEXcode IQ or by calibrating the VEX IQ (2nd generation) Brain. This information also can be used to turn your robot to face a specific location when using a Drivetrain.

Diagram illustrating various VEX IQ sensors, including their names and functions, to support educational resources and documentation for building and programming robots in the VEX IQ Robotics platform.

In the sensor dashboard on the Brain's screen, heading is the first value listed. If you move the Brain while on this screen, you will see the values update in real time.

Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections within the system for educational purposes.

This is set to 0 degrees when the Brain is turned on and the Inertial Sensor calibrates. If you want to reset the heading of your Brain, select the check button on the Brain. This will reset the heading and rotation to 0 degrees, and all data on the Inertial Sensor sensor dashboard will be based on this new starting location.

VEXcode IQ Blocks VEXcode IQ Python
Diagram illustrating the various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections within the system for educational and beginner robotics applications.
drivetrain.turn_to_heading(90, DEGREES)
VEXcode IQ C++
int main()
{
Drivetrain.turnToHeading(90, degrees);
}

In VEXcode IQ, the [Turn to heading] block, turn_to_heading Python command, and turnToHeading C++ command can be used to turn the robot to a specific heading.

VEXcode IQ Blocks VEXcode IQ Python
Diagram of VEX IQ sensors, showcasing various types and their placements on a robot, illustrating how they interact with the environment for educational robotics projects.
drivetrain.set_heading(0, DEGREES)
VEXcode IQ C++
int main()
{
Drivetrain.setHeading(0, degrees);
}

Similar to the calibrate option in the sensor dashboard, the heading can be set while the project is being run using the [Set drive heading] block, set_heading Python command, or setHeading C++ command.


Rotation

Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections for educational robotics projects.

Rotation is reported when the robot spins around the center axis of the Brain. The amount of degrees reported on the sensor dashboard indicates the direction of the turn and the degree value of the turns the Brain has completed since calibration. Unlike heading, the numeric values are not limited to the 0-359.99 degrees. The robot can rotate counter-clockwise for a negative value or clockwise for a positive value and will continue to increase the degree value to match the number of rotations the Inertial Sensor within the Brain reports. 

Diagram illustrating the various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections to enhance educational robotics projects and programming with VEXcode IQ.

In the sensor dashboard on the Brain's screen, rotation is the second value listed. If you rotate the Brain while on this screen, you will see the values update in real time. 

Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections within the system for educational purposes.

This is set to 0 degrees when the Brain is turned on and the Inertial Sensor calibrates. If you want to reset the rotation of your robot, select the check button on the Brain. This will reset the heading and rotation to 0 degrees, and all data on the Inertial Sensor sensor dashboard will be based on this new starting location.

VEXcode IQ Blocks VEXcode IQ Python
Diagram of VEX IQ sensors, illustrating various types and their applications in robotics projects, designed to enhance understanding of sensor integration for educational purposes.
drivetrain.turn_to_rotation(90, DEGREES)
VEXcode IQ C++
int main()
{
Drivetrain.turnToRotation(90, degrees);
}

In VEXcode IQ, the [Turn to rotation] block, turn_to_rotation Python command, and turnToRotation C++ command can be used to turn the robot for a specific number of degrees.

VEXcode IQ Blocks VEXcode IQ Python
Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections for educational robotics projects.
drivetrain.set_rotation(0, DEGREES)
VEXcode IQ C++
int main()
{
Drivetrain.setRotation(0, degrees);
}

Similar to the calibrate option in the sensor dashboard, the rotation value can be set while the project is being run using the [Set drive rotation] block, set_rotationPython command, or setRotation C++ command.


Pitch, Roll, and Yaw

Diagram of VEX IQ sensors, illustrating their types and functions within the VEX IQ Robotics platform, designed for educational purposes and beginner robotics enthusiasts.

Pitch, roll, and yaw are the orientation angle of the Brain along a specified axis. Pitch represents the y-axis and the angle of the robot tilting forward and backwards. Values for pitch range from -90 degrees to 90 degrees. 

Diagram illustrating the various sensors available for the VEX IQ Robotics platform, highlighting their functions and connections within the robotics system for educational purposes.

Roll represents the x-axis and the angle of the robot tilting left and right. Values for roll range from -180 degrees to 180 degrees. 

Diagram illustrating the various sensors available for the VEX IQ Robotics platform, highlighting their functions and applications in educational robotics projects.

Yaw represents the z-axis and the angular rotation of the robot. Values for yaw range from -180 degrees to 180 degrees.

Diagram illustrating various sensors used in the VEX IQ Robotics platform, showcasing their placement and functionality to enhance robot performance and programming capabilities for educational purposes.

Pitch, roll, and yaw are shown on the sensor dashboard beneath heading and rotation.

Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections for educational robotics projects.

The Pitch, Roll, Yaw example project in VEXcode IQ can be used to show how to detect the orientation angle of the Brain along the y, x, and z axes. The Touch LED will be set to different colors depending on how the orientation angle of the Brain changes to indicate pitch, roll, and yaw.

For information on how to open an example project in VEXcode IQ, see one of the following articles.


Acceleration on the x, y, and z axes

Diagram illustrating the various sensors available for the VEX IQ Robotics platform, highlighting their functions and applications in educational robotics projects.

The acceleration of section on the sensor dashboard reports the acceleration value of the Inertial Sensor along a specified axis. Acceleration along the x, y, and z axes are shown on the sensor dashboard to the right using the abbreviations, "ax," "ay," and "az." Each of these reports a range from -4.0 to 4.0 Gs.

While the Brain is resting on a surface, you will see a value of roughly -1.0 Gs. this is due to the force of gravity on the Brain while at rest.

Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections within the system, aimed at enhancing educational robotics experiences for beginners.

The Detecting Acceleration example project in VEXcode IQ can be used to show how to detect the acceleration of the Brain along the x, y, and z axes. The Touch LED will display different colors depending on what axis the Brain is tilted.

For information on how to open an example project in VEXcode IQ, see one of the following articles.


Rate of rotation on the x, y, and z axes

Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections within the system for educational purposes.

The gyro rate of section on the sensor dashboard reports the rate of rotation value of the Inertial Sensor along a specified axis. The rate of rotation along the x, y, and z axes are shown on the sensor dashboard to the right using the abbreviations, "gx," "gy," and "gz." Each of these reports a range from -1000.0 to 1000.0 degrees per second.

VEXcode IQ Blocks VEXcode IQ Python
Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections for educational robotics projects.
brain_inertial.gyro_rate(AxisType.XAXIS, VelocityUnits.DPS)
VEXcode IQ C++
int main()
{
BrainInertial.gyroRate(xaxis, dps)
}

In VEXcode IQ, the (Gyro rate) block, gyro_rate Python command, and gyroRate C++ command can be used to report the rate of rotation of a specific axis while a project is running.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: