How to program mecanum wheels with two joysticks

My rookie team is going to use macanum wheels this year for our robot and we were wondering how to program it in Labview to where one joystick controls forward movement (When the joystick is forward the robot moves forward, and when the joystick is to the left the robot goes left), and one joystick for turning the robot.

Team Up Next 3528

That’s easy. Use the Cartesian variety of Holonomic Drive. Connect the X and Y axes of the “translation” joystick to the X and Y inputs of the Drive vi. Connect the X axis of the “rotation” joystick to the Rotation input of the Drive vi.

Make sure you open a 4 Motor Drive in the Begin vi, with all the right PWM channels assigned to all the right motors. Depending in how you decide to wire the motors, you will probably need to set two of the Invert inputs to True, but don’t just guess. Run the robot forward and make sure all the motors go the direction you expect them to. Once that’s done, double-check with rotation. Then you can try strafing.

My team is running into a snag with the Holonomic VI. We can run forwards and backwards just fine. We can even turn left and right; no problem. We are having trouble strafing. When we try to do it the robot just stands in place with all 4 wheels spinning. We put it on blocks and noticed that when we ask for a strafe, the front wheels go forward and the back wheels go backward. This does not make sense given the “X” pattern we have set for the wheels.

My programmer did a great job creating his own drive code that works as intended, but does not have the Gyro support the holonomic VI has. So a few questions:

1.Will it be easier to: a: change the NI VI to allow us to strafe correctly or b: integrate the gyro to stabilize our drive base using our own code?

  1. how would we go about doing ‘A’?

  2. how would we go about doing ‘B’?

I am not aware of any issues with the LabVIEW vi. So I don’t think you want to change it. Your problem likely lies elsewhere. If you would post your code I’d bet someone here could help you find it (the problem).

or b: integrate the gyro to stabilize our drive base using our own code?

Not sure what you mean by “stabilize” your drive base. The gyro support in the LabVIEW vi is for field-centric control of the translation commands. If your drive base is not “stable” (e.g. turns when not commanded), the gyro support in the LabVIEW vi will not stop it from doing so. It will simply make it so the vehicle keeps going in the commanded direction while rotating. If you want to add the aforementioned gyro support (ie field-centric control) to your own code, all that is required is to do a coordinate rotation of the translation portion of the command.

If you want to use the gyro to prevent unwanted rotation, or to make the robot turn and align with a joystick direction command, that can be done, but it’s a separate problem from the field-centric gyro support built in to the LabVIEW vi.

**

I’ll get the code posted tomorrow, however, I swear there doesn’t seem to be as much drift while driving with the NI VI than with our homemade code. Maybe it’s just me.

What do you mean by “drift”? Could you please be more specific.

**

Sorry for the vague terminology. By “drift” I mean unwanted rotation. We start driving forward but slowly rotate to the left or right while maintaining the same vector of velocity. The drive tries to change this yaw rotation, to put it in aeronautical terms, but creates a whole other set of problems (think new car driver who isn’t looking far enough ahead of where they are).

while maintaining the same vector of velocity: does this mean a) while maintaining the same joystick direction command or b) while the vehicle maintains a constant direction

The drive tries to change this yaw rotation : did you mean the driver tries to change this yaw rotation? If not, what did you mean?

creates a whole other set of problems : what sort of problems? Could you give a couple of examples please?

I re-read your earlier posts and you never stated whether you are using omni or mec wheels.

**

a video is worth at least 2000 words…

We keep the same joystick position and the yaw rotation changes. It could be due to slight differences in the wheels or motor strengths.

What I mean about problems is the over correction that “small” corrections can make.

BTW: it’s mech wheels in an “X” formation

\ /
\ /
\ /

/
/
/ \

Those are likely candidates. Three others might be 1) not all the rollers are spinning freely 2) the frame is so rigid that not all 4 wheels have sufficient normal force to prevent slipping 3) calibration and/or tolerance differences in the motor controllers

**