I couldn’t find any LabVIEW code out there that did differential drive odometry. I probably was looking in the wrong places. Regardless, I decided to try and tackle it myself. Attached is the resulting code in hopes that it will help another team. If nothing else, it is a fun example to play around with.
I put together a sample VI that calculates some useful information if you have a this type of drive system with encoders at each side. The calculations are based on a PDF found here:
http://www.classes.cecs.ucf.edu/eml3804/Odometry.pdf
In your main loop, supply the VI with distance readings from left and right wheel encoders and and the wheelbase of the encoder wheels. It will output Distance Traveled, Heading, and the current X and Y of the robot.
Just as a disclaimer… This VI has only been implemented in the attached sample application. I’ve not seen how it behaves yet with real encoder data. YMMV.
This is my first post here. I’m new to LabVIEW (as I’m sure most of you are) and this is only our team’s second year in FRC. I’ll do my best to answer any questions about the code. Any feedback would be appreciated!
I’ve attached a screenshot of the front panel in action along with the source files.
Enjoy!
-Brian
DifferentialDriveOdometry.zip (58.5 KB)
DifferentialDriveOdometry.zip (58.5 KB)