Inertial Sensor Going Completely Haywire

I’m trying to get an accurate turning method in auton, and I thought the Inertial Sensor would be the way to do that. I created a program to turn the robot to the left, but the issue is that the turning varies wildly from run to run and the angles are just not precise.

Here is a list of the issue:

  1. Sensor does not read rotation correctly (a full 360 turn only requires 305 degrees in the code). A lot of the turns are completely wrong for the angles required. For example, I have a 135 degree turn in the pic below but only have 80 degrees set as the turn. However, this consistently puts me in the same spot.

  2. Margin of error extremely high (99 degrees will put me on the left of a tower while 99.1 will put me to the right of a tower consistently)

  3. Will attempt to error correct when over-shooting but only occasionally (sporadically)

  4. The brain shows the heading as the correct absolute angle but when I attempt to print out the heading value to terminal, the angle is completely incorrect (registers as 0 degrees initially no matter where you’re facing)

I don’t know why these things happen, but I’ve heard only good things from other teams so I figure it must be my code. We have the sensor wired up and attached the way the vex-site recommends, so I don’t think it’s a build issue.


One thing to note is that your pause between checks is .1 seconds (in which the bot will turn a noticeable amount) as well as the motors coasting to a stop (I believe that’s a coast, it might be better to just use motor.stop(hold))

for number 4 you might not be printing the results properly, we’d have to see that line of code


That makes a lot of sense. I’ve edited the code and will report my results tomorrow when I have access to the robot, but this seems like it was what I needed.

1 Like

make sure the V5 brain is fully updated to vexos 1.0.9


Your sensor might not be calibrating fully. Instead of your calibration code try this:

while(iSensor.isCalibrating()) {

My gyro usually takes 3-4 seconds to calibrate, so you might not be giving it enough time.