Odometry Tracking Algorithm

I am doing odometry off of this website: Odometry - BLRS Wiki (purduesigbots.com)

And i am stuck on step 6:

I have the previous value from step 5 here:
double angle = (left_arc - right_arc)/(tr + tl);

Can somebody help? Sorry if I posted this on the wrong category, I’m new to forums.

You should have a variable that stores the orientation of your bot from the previous loop through your odometry code. You want to initialize the variable before all your code and set it to 0. Something like this:

double prevAngle = 0;

The change in angle is the current angle minus the previous angle

dAngle = angle - prevAngle;

Note: you should declare your angle outside of your odom loop because you most likely want to be using your angle variable in other places for motion control.

1 Like

Category should be VEXcode V5 Tech Support (assuming you aren’t trying to do this in iq)

1 Like