|
Re: Programming a Crab Drive System
In software there are two main things to consider:
How many seperate steering motors are there (each module independent or are some together?)
Is it infinite of fixed-range?
If you have a single steering motor with a fixed range, there isn't much to it. You can run a P or PID control to angle, and if the angle is -90 and it is suddenly set to 90 you can invert the motor instead of rotating the pod. You also have to check, and if the front has changed, then change which motors are "right" and "left" to the tank drive. That's about all you can do.
If you have two pairs of steering motors, you can do a little more with steering. If you want to curve while driving, you can partially rotate the front and rear pods (with the rear pods inverse of the front ones). This can help augment tank steering, but is not as perfect as independent steering.
If you have a system with independent control of four wheel pods, then you can adjust each one separately to turn. You would take a point in space, of which the angle is 90 degrees off the desired translation angle, and which the distance from the center of the robot is the desired rotation. If the rotation axis is within a deadband, just set the wheels to the translation angle. If it gets out of the deadband, scale it so that a little rotation is very far from the robot but max is in the center of the robot. Then, add or subtract from this point to get the offset from each pod, and take do some math to find the angle for each wheel (take the arctangent of the X and Y, swapping X and Y). I have not seen many FIRST robots operate this way.
If you have an infinite system, you need to look at which path is the simplest: Check to see if the error between the current angle and desired angle is greater than the error between the current angle and the inverse of the desired angle. Whichever one is shortest is the path to take. If you go for the inverse of desired angle, set the motor negative to compensate.
Our lunacy bot had four wheel independent steer, and the operator controls were too difficult for the operator, so we have a "tank-hybrid" system where the average of the X axis determines the translation and the Y axis is a tank drive (rotating more than 45 degrees swaps some motors so the front is right and the rear is left, or vice-versa).
EDIT: I will post pictures to help explain the independent steering math later.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor
"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Last edited by apalrd : 23-04-2010 at 11:25.
|