Inertial sensor doesnt set heading properly

Whenever I try to calibrate the inertial sensor, it works fine. Then, when the code starts reading the gyro, I notice it will constantly tick up until it reaches a point. That angle is the angle it is from a certain point, that always being the same every time I restart the code / bot
My inertial sensor is called Gyro

while(true) {
inertial::quaternion Inertial_quaternion;
Inertial_quaternion = Gyro.orientation();
Brain.Screen.setCursor(1, 1);

1 Like

How have you mounted the inertial sensor ? if it is at an angle when you calibrate it will slowly drift to match the angle it is mounted at. What does the dashboard show ? does it do the same thing as your code ?


The dashboard on the v5 will only show acceleration, so that’s not helpful. I will remount the gyro tomorrow and see if that helps.

dashboard shows roll, pitch and yaw in addition to raw gyro and accelerometer data. Which angle are you having trouble with ?


I just updated the firmware to 1.0.9, and now it works.

1 Like

yes, I should have asked that, vexos 1.0.9 is required for correct inertial sensor operation.


Hi, Could you please paste the link for firmware 1.0.9? Thanks.

You can update your brain to the later vexOS using VEXcode V5 Text or Blocks, or by downloading the stand alone firmware updates from this page.


Thanks. Updated the brain but same problem. My robot is just spinning several rotations before it stops. Here is part of my code…

insangle = GyroAccel.heading(rotationUnits::raw);
wait(20, msec);

It gives me tiny readings which led to the robot spinning before reaching a set heading.

Is there a proper way of reading from the new V5 Inertial sensor?  

Thanks again

raw is not supported, use degrees or turns
(see the example code in VEXcode)


It is very good that the new IMU gives students easy to use heading and rotation values (by handling internally challenging geometry related to qurternions).

However, it would be great if there was an option to return timestamped raw measurements from individual gyro and accelerometer sensors.

If measurements from inertial sensor are used in conjunction with other sensors (i.e. encoders) by some sort of the filtering algorithm to achieve sensor fusion, then it is better to handle everything in the higher level algorithm, instead of passing partially pre-processed filtered/smoothed data to the upstream filter.

The raw measurements don’t have to come at high data rate. As long as they are timestamped this should work well with filters.


I’ll see if we can add that in a future vexos/sdk release, we already have timestamp on incoming messages, should not be too hard to add but there will still be an some error between when the data was actually available to read inside the IMU and when it arrives at the V5 brain.