|
Getting final vector from left & right drive encoders
Hey all,
I’ve been racking my brain trying to solve this problem, and despite not being able to find anything with some light searching, I suspect others may have attempted the same things, so I’m looking for input.
This is the first year our team has used encoders at all; nevertheless, I have been successful in wiring them up, and getting the distance traveled in metres. So on the technical side, everything is a-okay.
I have the distanced traveled on the left and right sides for each time the code loops. What I want to do with this is somehow add the vectors so I get the change in robot heading and displacement since the loop last ran. I would then want to add each of the vectors together to get a final displacement/heading of the robot, relative to the start position. With this I want to figure out where on the field the robot is.
From there I would, presumably, set waypoints for the robot to move towards sequentially.
So let’s say the left side has moved 4 arbitrary distance units, and the right side has moved 5 arbitrary distance units. I want to know the direction/heading that the robot has moved along, and the distance that the robot has traveled in that direction. I would then add them (using vector addition, I presume) to know the approximate location of the robot on the field.
I hope I’m explaining myself clearly. Also, we use LabVIEW in production, but I can interpret C++ and JAVA (and pseudocode, of course) so really the question is platform-independent. If it's any help, the 'bot is 6-wheel with a drop-centre off six CIM motors, all controlled by Victor 888s & an FRC cRIO-II.
Thanks,
Eric Bryce
Last edited by eat4fun : 12-02-2013 at 21:24.
Reason: Added information
|