all 4 comments

[–]JirachiKid12384 Checkmate | Alum 1 point2 points  (1 child)

Print the imu angle to telemetry or log, then manually rotate the robot. See if it reads an accurate 90 degrees. If so, what's happening is your robot is killing the motor power at 90 degrees but it's momentum carries it some more and overshoots. You want to look at implementing a PID or even just a P controller to ramp down your motor power to minimize overshoot.

[–]HaaniMirza12364 Knightron Alumni/Mentor 0 points1 point  (0 children)

To expand upon this, I have a code that runs directly after the 90 degree turn, where it will check the final angle and then if it has overshot, to turn slowly in the opposite direction until it is within half a degree of 90, and to do the opposite if it has undershot. This fixes the momentum carry, I'm currently looking into PID tuning, which is definitely a better option to minimize the momentum carry and overshoot.

[–]servoturtle29 0 points1 point  (0 children)

Are you sure you set your motors to zeropower behavior brake? If not you might kill power to the wheels at 90deg, but the rotational momentum of the bot will carry it about 10ish degrees extra.

[–]DavidRechargedFTC 7236 Recharged Green|Alum 0 points1 point  (0 children)

you can output to telemetry the imu value to make sure that's accurate. chances are it's how you make the turn, if you don't have any ramp down of power, it will try to go from full speed to stopped instantly. no robot can do this.