This is my first year in VEX, and I am assigned to program for our robots. One of the functions my teammates told me to finish is the odometry stuff. With the help of some online resources, I did come up with a function that tracks the position and the angle of the robot relative to the starting point. Although we haven’t tested the accuracy, I think we don’t have a problem there.
The main problem I encountered was its role in the autonomous period. I’m not sure if my thoughts are correct, but I think it’s something like: listing out different positions on the field → robot moves to the position → auto correct with PID → do the action you told it to do on the position. But the problem is, if the placement of the robot is off at the start of the round, wouldn’t the whole auton fail? What’s the difference in using odometry with directly writes out the movement functions if both of the methods depend on the initial position?
Thank you for your time to reply. However, most online resources only discuss the calculations behind odometry. Yet the main problem I had was the role of the odometry. If I’m correct, the position of the robot calculated by the odometry algorithm is relative to the robot’s initial position. So if I got the initial position wrong, wouldn’t the whole auton program fail even if your calculations for odometry were correct? I’m just curious about the usual way to solve this problem.
Yes, you are correct that odometry will give you position relative to where your robot starts. Most teams will use a consistent starting location, often lining their robot up with landmarks such as the edge of a field tile. If you truly desire localization that does not depend on starting location, you can employ the VEX GPS sensor, or use distance sensors pointed at walls.
For the distance sensor method, you either use wall resets or Monte Carlo localization. Wall resets work by pointing the distance sensor at a known wall, and using it to correct either your x or y, depending on which wall you point at. Monte Carlo localization is a much more complicated method of localization that uses multiple distances sensors to figure out where the robot is on the field. Monte Carlo localization is complicated and very overkill for anything you need in vex, but if you are interested, I can provide some resources.
Typically you would solve this issue by always placing your robot at a known position before the match. Alternatively, you could use a GPS sensor (although I’ve heard that there are accuracy issues) or multiple distance sensors to determine your absolute position on the field when starting.
Yeah, plain odometry is based off of the initial position. For some, this is good enough and they can eyeball it or use an alignment mechanism. However, a better way to is to implement other sensors to help correct the position such as GPS and/or distance sensors. With these you can fix the estimated position of the robot over time. I’ve never learned how to, but I’ve heard people using Kalman filters.
Thanks for your help!
And yes, the Monte Carlo localization seems to be unnecessary. I think I’ll go with the wall reset method. Thank you for giving me a bigger picture.