My issue is that whenever I turn in place my robot position changes. I believe this is because the perpendicular wheel is moving and I haven’t found a fix yet. My robot uses an inertial sensor, one parallel wheel, and one perpendicular wheel. OdomRotationX is the perpendicular wheel.
My solution would be to subtract (changeinAngle * strafe distance from center) from your distance calculated from the strafe wheel. This should subtract the arc length the wheel travels when you turn so it doesn’t affect your results anymore.
That didn’t seem to work. When I plugged in the distance it made the issue worse. Then I tried using a small number and that seemed to make it better. So something like .09 was helping keep the numbers closer to 0 but it still was leaving issues.
Edit: I think I need to use the Arc Length Formula so when I get the chance I will try that.
Can you explain ow your doing this because I’m actually struggling with the same problem. When ever it turns my coordinates change as if the robot goes in a circle. based on the distance my tracking wheel has gone for the radius.
So I used the formula for calculating the circumference of a circle multiplied by the change in angle of the robot, and you subtract this from the wheels distance traveled. I wasn’t able to get it perfect because I couldn’t get the right distance to the center of the tracking wheel, which you use as the radius.
Arc length: distance traveled by the mid encoder
Radius: distance from the mid encoder to the center of rotation
With these values, you can calculate theta. Then, you can compare the arc length theta with the actual rotation of the chassis and figure out how much horizontal distance the robot actually traveled.