vex inertial sensor code

Would this code do what I think it would as the code uses the inertial sensor heading value to give us 90 degree turns with a .25 degree error on either side of 90?

You would probably have to set one side to forward and the other to reverse to turn. This may work, but it won’t be reliable. If you want to do consistent and accurate turns, I recommend you look into PID controllers. This document will help you get it set up.

Thanks for the feedback, All four of our motor have to go forward or reverse to turn so that’s fine. I have a PID made and in testing rn but idk how I would implement the inertial sensor into it, If I would even need to do that.

You use the inertial sensor to calculate the error:

double error = target - Inertial.rotation();