Quote:
Originally Posted by Bart
Hey, I'm currently trying to figure out how to change the magnitude of the holonomic drive system. I tried the obvious approach (Changing the first float) however, with out current code, nothing seemed to change at all. Could someone look it over and tell me what they think? We basically want the spin of the robot to be dependent on the value returned by the joystick throttle:
|
I am not sure which part of your code you said not working. Mecanum drive requires 3 joystick axes. According to your code, you are using one joystick. If that's the case, make sure your joystick has 3 axes. Since you are using the GetMagnitude(), it is computing the magnitude by doing sqrt(x*x + y*y), and the direction is computed by atan2(x, -y). So you should make sure that the Y axis of your joystick is controlling the forward/backward movement, the X axis is controlling your sideway movement. Then for the turn, make sure you are using the correct joystick axis for it. At first, we were reading the twist axis for the turn, but it was wrong. This is because our Microsoft Side Winder joystick maps twist to the Z-axis, not twist or throttle. So make sure you reads the correct axis.