Quote:
Originally Posted by thinker&planner
Our team has been trying to develop a program to allow us to drive our robot "Tank" style with two joysticks yet still have parallel control of the side-to-side movement of Macanum at the same time.
|
To get the full three degrees of freedom that a mecanum drivetrain supports, the user interface needs to generate three commands:
- go forward/backward
- strafe right/left
- rotate clockwise/counterclockwise
Let's call the above three commands FWD, STR, and RCW, respectively.
Then you provide those three commands to the mecanumDrive_Cartesian method method like so:
FWD goes to Y input
STR goes to X input
RCW goes to rotation input
So how do you generate FWD, STR, and RCW from 2 joysticks using only the Y axis of each joystick? You don't. You need a third input. But if you want to drive the mecanum like a tank (ie, no strafing), you can do this:
FWD = (YL+YR)/2
RCW = (YL-YR)/2
STR = 0
A very awkward (for the driver) way to get all three degrees of freedom from a 2-joystick "tank drive" setup would be to use the X-axis of, say, the left joystick (XL) for strafe. Then you could do this:
FWD = (YL+YR)/2
RCW = (YL-YR)/2
STR = XL
Or you could use the right joystick for arcade drive, and use the X-axis of the left joystick to strafe:
FWD = YR
RCW = XR
STR = XL
Some teams have used a 3-axis joystick with a mecanum to get a Halo drive plus rotate:
FWD = Y
RCW = Twist
STR = X
Another option is to use modes with a single 2-axis joystick:
Arcade mode with button one pressed:
FWD = Y
RCW = X
STR = 0
Halo mode with button one not pressed:
FWD = Y
RCW = 0
STR = X