Log in

View Full Version : Drive Backwards Causes A Rotation Movement


tanogirl
13-02-2015, 14:59
We are using the Logitech Extreme 30 Pro Joystick to control our mechanum drive base this year. Drive forward works fine and so does strafing. When we drive backwards the robot wants to rotate instead. We used smart dash board to locate the problem. When we pull the joystick backwards the Z axis has an input greater than the Y axis input.

Our Code is:


myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), stick.GetTwixt()/3, 0)


We divided the twist input by 3 to try to help with the problem. It helped a little but not much. Any ideas?

Alan Anderson
13-02-2015, 15:34
A twist-style joystick seems obvious for controlling a holonomic drivebase, but in practice it's just too easy to twist it by accident. My suggestion is to use a separate joystick for rotation control.

tanogirl
13-02-2015, 15:43
The problem is our driver gets confused when using two joysticks and prefers one

Ether
13-02-2015, 16:15
When we pull the joystick backwards the Z axis has an input greater than the Y axis input.

Please run a test and post the Z vs Y pairs for Y=0 to Y=max for several values of Y.

tanogirl
13-02-2015, 16:44
Forward=

Y = 1.000
Z = 0.008

Backwards =

Y = -1.000
Z = -0.0062

It's a small difference but it makes the robot rotate.

Ether
13-02-2015, 17:00
Forward=

Y = 1.000
Z = 0.008

Backwards =

Y = -1.000
Z = -0.0062

It's a small difference but it makes the robot rotate.

The above does not agree with your previous post:

When we pull the joystick backwards the Z axis has an input greater than the Y axis input.

tanogirl
13-02-2015, 17:23
Yes the Y axis is greater than the Z axis but the robot still rotates when driving backwards.

Ether
13-02-2015, 17:24
Yes the Y axis is greater than the Z axis but the robot still rotates when driving backwards.

Please post results for Y=0, Y=.2, Y=.4, Y=.6, Y=.8;
repeat for negative Y commands.

If all the Z values are within +/-0.0099,

try adding deadband to your code:

if (fabs(Z)<.01) Z=0;

tanogirl
13-02-2015, 17:30
Where would you put that in the code?

Ether
13-02-2015, 17:32
Where would you put that in the code?

Right after you read the joystick Z axis (i.e. before you use it).