Controlling a Mecanum drive with two joysticks?

Hi everyone,
I’m mentoring a team this year and the kids want to try out mecanum wheels for this season, and who am I to tell them no? (the fact that it’s been a dream for me in all of my FIRST years helped… a bit… :))

It seems to me there are two problems regarding the control of mecanum wheels with the normal joysticks:

  1. the calculations regarding the control of the vehicle are somewhat complex I believe. I am looking into this whitepaper:

but I am skeptic it provides the exact equations we need to use… can it be that easy? (i’m so stuck at thinking it’s complex that if the solution is this simple I can’t believe it’s a solution :slight_smile: )

  1. a normal joystick just doesn’t have enough degrees of rotation to control a holonomic robot. so we had a couple of ideas:
  • use a two joystick design where each joystick controls the a corresponding side of the robot. this would allow full control but the exact function would need to be figured out.

  • use an analog joystick with a “sidewinder” functionality to control the spin of the robot.

I would love to have some input about our ideas from more experienced teams.

thanks alot and have a fun and educational season!


This might actually be easier. Tank drive, with some code such that moving both joysticks to one side or the other causes the robot to slide. I think the main problem with a “sidewinder” joystick (other than converting it to analog) would be making sure that you don’t twist it at the wrong time.
Or, a single stick using the thumb wheel to rotate (left side next to the stick) or even the button and trigger.

I think it really isn’t too difficult to make it work, you can use one 2-axis joystick to move the robot in the 4 directions or diagonally, and another single axis joystick to rotate the robot. The one’s we’ve played with here were done that way, this thread

has some information about it and a link to the code for a vex controller. Both of the mecanum robots used the vex controllers, not FRC, although the big one did use the big drive motors and Victor speed controllers. Our big one is shown here

We did this last year only using 3 axes. On the left joystick, it was overall translation, with x and y. It also controlled strafing sideways, forward, and diagonal. The right joystick just had the x axis, and it was for rotation. It was relatively easy to drive.

Programming it was another story. We used another person’s code that wasn’t a part of FIRST and worked off of that. You can find code for how to do it on the vex platform, and base it off that.

To prototype though, do it on VEX with a holonomic drive using omni wheels in the offseason. Same code and it’s definitely cheaper.

Good luck

I’ve heard/seen this is a good way to do it.

If i remember right, a team even used a turntable type input and were rather pleased with that.

Team 1540 did this for the 2007 season. We too, spent a LOT of time trying to figure out how to get it to work best. Once we figured it out, we were astounded at how simple it can be.

Our robot had two joysticks. One controlled planar motion (pushing the joystick forward, moved the robot forward. Moving it sideways meant that the robot moved straight sideways). The other joystick controlled rotation (we only used the x-axis). Our team members picked this up pretty quickly, and it’s a blast to drive.

Control wise, you can break the problem into two parts. We figured out how to control planar motion using one joystick, and wrote a function for it. Then we figured out how to do rotation, and wrote another function for that. Both of these easier problems can be easily figured out with a pen and paper to diagram out what inputs you have, and what outputs you’d want in that situation.

Then all we had to do was combine them! We started out simply averaging the values (weighted averages, actually). There are better ways to do this, but this gets you going quickly and easily. Once you’ve gotten that up and working, you can try to figure out optimizations which can dramatically increase the maximum speed/performance.

Mecanum drive is a lot of fun, I’m glad to see another team taking it on.

As a side note, you can setup the wheels on your base in two ways. In one arrangement, the rollers on the wheels will form an ‘x’ on the bottom of the robot. In the other arrangement, they’ll form an ‘o’. You can program both to work, but it’s worth taking the time to think through what the advantages/disadvantages to each are, as the two aren’t interchangeable.

I hope that’s helpful. I’ll admit I haven’t looked at the whitepaper. Good luck! :slight_smile:

Be careful with implementation if you decide to go with tank. If you move the sticks opposite ways, the robot will be trying to tear itself apart/compress itself (yes I know it might be hard to do by accident but closed loop is better than open loop :))

I believe 1675’s Mecanum control was 1 stick left/right did pivot, the other stick did all directions of translation (including forward and backward)

A simple way to use two joysticks is to tie them together mechanicaly so they will not go away from each other or together and use the mixing program for one joystick that comes with the control system. You can use the left joystick to control the left drives and the right joystick to control the right drives. You can go forward , back angle, and as you move the joysticks in oposit directions it will rotate. This is a simple fix and is easy to control. We did this and it solved all the problems. We did try to use one joystick to do everything but it was hard to have fine control. Also when you twist the controler to rotate you could get lots where your robot is actually going.

we are also thinking to use a omni wheel design this year as well (also a dream of mine lol :D) and we have decided on a two joystick operation. (as people of said, one joystick controls forward backward and strafing, whilst the other comtrols rotation)

The main reason we went with two joysticks is because some of us one the team play First Person Shooters a lot. So this style of controlling works well with us. causes thats how we would play a FPS.

I don’t know if that helps at all but that was why we chose to make ours two joystick.

If you invest in doing omni directional drive, make sure you have drivers that can handle the multi layered tactics required to drvie it. We enjoyed having a robot with it but we did not have drivers that were good enough to use its full potential. Some problems with using it is traction, but if you add addtional layers of wheels you get a little more traction. Our robot was very fast , and you can get out of traps quicker. We were able to go up ramps with out any trouble, and could coral balls very easy. We do have some information on what we did on our web site.