Quote:
Originally Posted by kinganu123
I figure I might as well throw in my two cents. The code (at least for my team's untested implementation) will look a lot like RobotDrive's mecanumDrive_Polar/Cartesian. - You want to take the joystick degrees and break it up into x and y vectors (kind of like what you do in physics).
- Use the magnitude to compute the size of the x and y vectors.
- Divide by the original x and y vectors so that you can bring your magnitudes back to a scale of -1 to 1. Without this last step, you robot won't be able to go diagonal at max speed.
|
If you extend or emulate mecanumDrive, you will also want to make some adjustments for the different amount of force you are capable of providing in each direction. If you turned all four tank wheels forward, and the two strafe wheels to the right, you wouldn't go off in a 45-degree angle right of forward, but a 26-degree angle right of forward (assuming equal weight loading on each wheel and equivalent wheels all around, ignoring differences in roller cross-friction). For a classic 5-wheel H-drive with the same assumptions, the answer would be only 14 degrees from forward.