With mecanum, if you have a 3-axis joy stick, there's like a whole ~16 lines of code to write.
Something like (in pseudocode):
Spoiler for Spoliered the code in case you want to learn it, and not be told the answers:
Code:
motor arrangement:
A------D
| |
| |
| |
B------C
Joystick axes
Y
|
+--X
/
T
Code:
double y = joy.y;
double x = joy.x;
double t = joy.t;
double a = x + y + t;
double b = -x + y + t;
double c = -x + -y + t;
double d = x + -y + t;
double factor = max(a,b,c,d);
if (factor > 1){
a /= factor;
b /= factor;
c /= factor;
d /= factor;
}
motorA.set(a);
motorB.set(c);
motorC.set(b);
motorD.set(d);
Note: I make no warranty that this is entirely correct, or that the signs are actually correct. It's more the pattern of the signs that matters. This is what 857 has used last two times we've done mecanum.