Questions about how Odom and code

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

  1. Declare all variables
  2. Find difference in encoder rotation
  3. Convert difference to distance
  4. Update previous values
  5. Create orientation value in radians
  6. Update previous values of orientation
  7. Convert local x and y change into global x and y change
  8. 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.