Questions about mecanum wheels

My team decided to use mecanum wheels this year, which are currently being assembled, but are not yet on our test robot. Using the advice that has already been posted, our programming team made some code that we think is correct. It wasn’t quite as simple as converting xy to polar, we had to make our brains hurt with radian-degree conversions,and angles being shifted 90deg, but the code we have seems to work correctly. Since the wheels aren’t actually on the robot yet, we can’t see how it moves, but from what I’ve read about mecanum wheels, the motors are spinning in the correct directions based on the input from the joystick. My only concern is that often times the motors are not going at full speed:

Rotation(which we have on a separate joystick) works fine, pushing it all the way one direction sets -1 or 1 to each side based on which direction we’re tuning.

However, for all other situations, the motors are rarely at full power. I have a feeling this is the way the sin and cos functions in holomicdrive.vi inherently are going to work to make sure your speed is consistent in any direction, but I am still worried.

When we push the main joystick full forward, and give the holonomicdrive.vi the equivalent of 1 magnitude, 0 heading, and 0 rotation, the motors all go in the same direction but at about ~70% power. A similar thing happens when we strafe straight sideways, the motors are all going in the correct direction to cancel force vectors for sideways motion, but it is not at 100%.

The only other time any motor ever gets to 100% besides purely rotating, is when we push the joystick into one of its corners. In that case, two motors go to 100%.

We want to get as much power out of our drive system as possible, even if it means the robot will move slower in certain directions. Even just for full forward or backward, I would like to be able to set all the motors to 100% forward without any extra functions.

Is there anything we can do about this? Is this how mecanum wheels are supposed to work? I could always make a button that sets full power to all the wheels, but having it built into the regular control system would be better.

Thanks.

What is your wheel config?

Here is the code I’ve done for off season projects, you may want to add dead zones. This also does not have the power problems -

                if (ws.ButtonState.Two == true)
                {
                    leftmotorcontrol.motors[0].Velocity = -100 * (ws.AccelState.Values.X - ws.AccelState.Values.Y + turn); // front left
                    leftmotorcontrol.motors[1].Velocity = -100 * (ws.AccelState.Values.X + ws.AccelState.Values.Y + turn); // rear left
                    rightmotorcontrol.motors[0].Velocity = 100 *(ws.AccelState.Values.X + ws.AccelState.Values.Y - turn); // front right
                    rightmotorcontrol.motors[1].Velocity = 100 * (ws.AccelState.Values.X - ws.AccelState.Values.Y - turn); // rear right
                }
                else
                {
                    leftmotorcontrol.motors[0].Velocity = 0.00;
                    leftmotorcontrol.motors[1].Velocity = 0.00;
                    rightmotorcontrol.motors[0].Velocity = 0.00;
                    rightmotorcontrol.motors[1].Velocity = 0.00;
                }

The if statement is a safety measure

I was using a wiimote so the “joystick values” (Really i used the accelerometers) gave an output of -1 to 1, you get a 0 - 255?. Its really simple just add up the x,y,z(rotation) and give each wheel the values they need.Diagrams help alot.

Are you using two or one joystick?

Take a look at this thread -
http://www.chiefdelphi.com/forums/showthread.php?t=79456&highlight=wiimote

PM me if you need more help

A piece of advice that I’d give is to also use a PID controller. This way you can tweak values to however you’d like them. Also makes for smoother control.

Jacob

You could always write your own “HolonomicDrive.vi” to make the calculations the way you expect them to be made.

the WPILib Joystick class has a GetDirectionDegrees and GetDirectionRadians, I’m sure Labview has something similar

the WPILib Joystick class has a GetDirectionDegrees and GetDirectionRadians, I’m sure Labview has something similar
Actually it unfortunately doesn’t (At least as far as we can tell). We also had to do the conversion from X/Y axis to direction/magnitude.

When we push the main joystick full forward, and give the holonomicdrive.vi the equivalent of 1 magnitude, 0 heading, and 0 rotation, the motors all go in the same direction but at about ~70% power.
This is also true and is how the holonomic vi is coded.

If you want to change it so that your motors are running at full power I’d advise making a copy of the holonomic vi and reworking the math inside of it to your liking.

I don’t know how you are doing your direction and magnitude calculations but in LabVIEW, we used the ATAN2 function for direction which takes the joystick x and y as inputs. While you still have to do Radian-Degree conversions, I believe this will handle the Quadrant issues for you. Then, for the magnitude, we simply did sqrt(x^2+y^2).

In LabVIEW, you can also use “Re/Im To Polar Function”.

Actually, labview DOES have this function in an easy-to-use VI that can output degrees and magnitude from your joystick direction.

Edit: Doh, Joe beat me to it. That’s what I get for leaving the window open while I go out to a machine breakdown :rolleyes: