Ok so I understand the math behind odometry, but I’m not sure how to code it. How did you guys learn to code Odom? Also how do you use Odom and PID together. PID I know how to code and have made POD code before.
1 Like
Here’s a popular guide to odometry:
introduction_to_pid_controllers_ed2.pdf (400.2 KB)
I’ll do a step by step walkthrough of my own code which is 2 wheel odom using an IMU
- Declare all variables
- Find difference in encoder rotation
- Convert difference to distance
- Update previous values
- Create orientation value in radians
- Update previous values of orientation
- Convert local x and y change into global x and y change
- Update global x and y values
For PIDs it’s a simple matter of using your robot x and y to do whatever you want. For example you could drive to a point using the robots x and y.
I just read through this, I feel like I have a good grasp on PID now! Also for students who are not quite in Calculus I feel like the concepts discussed in the document would be very useful before you head into a calc class.