# Odometry is inaccurate when turning

We have developed an odometry/position tracking system based on two idler wheels (one vertically oriented and one horizontally oriented) and an inertial sensor for our heading. However, it is not 100% accurate, because the wheels spin when making turns in place, which messes up the calculations. Is there a way to account for these encoder readings when turning in place so the position remains the same (i.e the x and y coordinates don’t change during point turns)? thanks

3 Likes

You could try to temporarily turn off the tracing system while turning or have an extra Sensor to check it is correct or have it only change when it is triggered

If you place the wheels as close to the center of the robot as possible, you can mitigate the ticks accumulated from turning. Also, to do this, you’d need three wheels (one horizontal, two vertical); this way, you can place one vertical wheel on the left and one vertical wheel on the right, so that when you turn, the ticks accumulated will cancel out assuming you take the average between the two vertical wheels. Worst case scenario, you can reset the value of the encoders everytime you reach a new segment, so after you turn, you can reset the encoders back to zero to start a clean slate with your odometry. However, resetting it after each segment would make your odometry function based on offset instead of absolutely. That would be the one downside to doing that.

1 Like

I’m not sure what your math looks like but yes, you should absolutely be accounting for encoder spin when turning (not just in place). Normally there’s some constant that represents the distance from your tracking wheels to the ‘tracking center’, aka the point on your robot that you’re actually tracking (generally at/near your turning center so that you don’t see your coordinates change much while turning in place as you described). I have a video here from an explanation I gave to some members of my team which goes over the math outlined in this document.

Edit: I realized that I didn’t clarify; the resources I linked use three tracking wheels, two parallel with each other and one perpendicular from those, however, as long as you have the IMU you only need one of the ‘parallel’ ones. All you do is replace the initial angle calculation with the angle reading from the IMU.

4 Likes