Inertial turn is not accurate

I’m working on creating an accurate turn code using the inertial sensor, but when I tell it to turn 90 degrees, it turns just a bit more than 90. Could it be a placement issue?

Any advice would help.

- Henry 344E

A few things before I get to your actual question: First, have you already tried setting this up as a 4-motor Drivetrain instead of 4 separate motors? This will give you some built-in turn and drive functions that work pretty well for a lot of robots. Second, if you have a good reason not use a Drivetrain, I recommend setting it up as two motor groups (left side and right side), which will cut your amount of code in half and make it easier to avoid mistakes. And finally, reverse the motors in the right side group using the switch in the devices setup, so forward and reverse are relative to the robot rather than the motor.

Your code turns off the motors when the robot reaches the correct heading, but it’s still turning at some speed and so it passes that heading before it has time to slow down and stop. You need to give it a chance to correct the overshoot by turning back the other way. Most people do that with PID. Here’s the link everyone recommends for getting with that.

This will be a little tedious to code in Blocks but people have done it. And you may be OK with just the P part of PID.

I’m using an X-Drive so I cannot use drivetrain or motor groups.

I have a drive straight P already. How would you suggest implementing a PID or P into this turn code?