Best way to control the mechanum wheels

So I’ve heard that it’s easier to control the robot with four mechunum wheels with an x-box controller. Is this true? If it is true how do you program that, because I’m our teams programmer?

First, before touching any code, write down everything on paper. Now I personally have no experience with mechanum drive, but I do have lots of experiences when the robot goes haywire because I used the wrong operation or something silly like that. Always double check before hitting “run”.

I would say if the X axis (or what ever you are trying to control the strafing with) is past a certain point then switch to “strafing” mode. Then make the wheels rotate based on the x axis. Its quiet simple IMHO. I assume you would have the same code for the regular 4, 6, 8 wheel drive then tag on the strafing.

slow down there i forgot to say this our first year with mecanum wheels should we just stick to the basics with the joysticks?

You should use a joystick with a twist axis. Forward and back make the robot go forward and back, side to side makes it strafe, and twisting the joystick turns the robot. I have no idea about the programming though, I do mechanical/CAD.

1 Like

No, I say go for it bro. If you do not have the resources to build a prototype, I can make a software simulator for you. It won’t be a robot driving on screen, but I can do motors on screen displaying its PWMs. First get the regular 4 wheel drive working with 1 joystick (the xbox controller in this case) then I will assist you with the mechanum drive. From the looks of it, its just the 4 wheel arcade with some extra

There are enough people here that do have experience with mechanum drive and have learned from those experiences. As it is with rules questions, only post when you are positive you are correct opposed to what you think is right. (I try to practice this and if you notice, I rarely, if ever, post in technical threads :o )

PS: for all I know, what you said was 100% correct and if so, I apologize.

And you’re starting during build?

Stick to the joysticks. There’s prewritten code around somewhere; you would of course have to find it in your favorite language and tweak it for your robot.

I don’t recommend doing mecanum in the six weeks if you haven’t done it before; if you do it that way, KISS is a MUST. Start with stuff that’s already out there.

David, you’re close to right about the method, except that you forgot one thing: 4 independent motors vs 2 pairs of 2 motors. 2 pairs of 2 motors, you can Y-cable. 4 independent, it’s a lot harder to Y-cable for some reason. Also use caution: Should you go to fallback (mecanum goes to 4WD rather easily), make sure you comment out the strafing–Alan Anderson of FRC45 found that out the hard way.

You could also do a complete directional program. That might be a bit harder.

My team really wants to do mecanum wheels… Anyone got any sample code for two joysticks+mecanum wheels?

This is my 2nd year programming and last year we had a basic 4 wheel drive. For this year the team has chosen to go with mecanum. I’m using labview. It would be awesome if someone could teach me the programming behind mecanum drive.

Im using c++ anyone got any good libraries?

Which develpment environment are you planning to use?

If its LabView, the VIs are all supplied. You’ll have to do some problem solving to convert the joystick’s output (or any other kind of steering device) to the inputs that the mechanum VI requires.

I can vouch for the LabView VI. We used it last year, it works great. And we’ve done mechanum wheels 3 of the last 5 years. Like anything else, there are tradeoffs to consider.

Keith Hall
Mentor FRC 2171, FLL 1528

The only library allowed is the WPILib.

Last year we used mecanum to great success, using two joysticks. One joystick controlled movement direction, and the other controlled rotation – exactly like a 1st person shooter played on Xbox.

While it wasn’t an Xbox controller, our driver could think of it as one, and he had an intuitive knack for it very quickly.

So it’s not hard to do it in c++?

No not at all, the mechanum drive would only take 5 lines MAX. (excluding the header file and PWM regulation)

Wow thanks I can wait to try it out

Actually I lied, more like 8-10 but you get the point. Good luck, if you need any help ask.

The algorithms for the speeds to drive each wheel are in white papers here, i’m sure. For omnidirectional drives, I like to use the setup with one joystick doing direction, plus one more axis doing turning. My team has found that twisting a stick makes it harder to drive. This setup is ideal for a game controller, which is quite trivial to program if you know how to do a normal joystick (see getRawAxis). If you are up to it, making the drive field-centric using a gyroscope makes it much more intuitive to drive.

Show me the rule, because I can’t find that one in the Game Manual Section 4.

In 2008, I know I found a link to some “canned” mecanum code lying around CD. However, the programming language that year was C, so it wouldn’t work this year without modification. I might be able to find it again… but it would take a while.

http://runnymede-robotics.googlecode.com/svn/trunk/2010_Team_1310_V2/

http://www.youtube.com/user/1310Robotics#p/u/0/7mBxVPvyYwQ