WPILib Mecanum Function Not Strafing Properly

Hi,
We solved this problem a while ago with a code modification, but after reading some posts here, I want to find the problem. It seems that the WPILib RobotDrive mecanum functions work pretty well for most teams, but for some reason, when we tried it to strafe with it, two of the wheels turned in the wrong direction, thereby making the robot just jump and shake as all the wheels cancelled out. We got some code from chiefdelphi that takes the joysticks and uses that to calculate our mecanum drive, to the same effect. When we flipped the “strafe” joystick value on two of the wheels’ inverse kinematic equations, it seemed to work. Just wondering why we would have need to do that.
I’m always happy to provide more information if I can, so just ask.

Are the rollers on your wheels making an X or an O from the top. The need to make an X from the top (O form the bottom).

Two of your motors should be inverted (in code, or by switching the pos and ground). This is because the motors on one side will spin in the oposite direction on one side of the bot when they are given the same signal.

Are you Using C++, Java, or LabView?

They are making the X on top.

I’m pretty sure they’re properly inverted because forward and rotation worked, just not strafe. I figure that since we’d be using the RobotDrive class (I thought it went without saying due to the forum I’m in, we’re using C++) it was naturally set up for the inverted motors and did it automatically.

OK, please state which direction each of the four wheels were turning.

**

If you had control of the front motor on one side swapped with the rear motor on that side, you’d probably get the results you’re seeing. Start by verifying that the motors you’re telling the code about are actually on the corners you’re telling it they’re on.

That sounds promising now that you mention it. Unfortunately, I’m not working on the robot for a bit, so I’ll have to look into that and get back to you guys in a couple days.