# 4 motor Mecanum wheel code request

does any one have a working example for a four motor, mecanum wheeled (not sure if I spelled that right, just google “Mecanum wheel”, the top wikipedia page has a picture), with 2 joy sticks, for LabView.

My team members are currently watching tutorial videos on how to do basic LabView programming, and most of my experience is in lower level languages.

Any and all help is greatly appreciated!!! (we lost our code from last year, so we’re kind of at square one here)

I have one, but I won’t be able to post a picture of it until late tonight.

How do you want the joysticks to control the robot?

• Tank drive plus strafe
• Arcade drive on one joystick, strafe on the other
• Cartesian control on one joystick, rotation on the other
• something else

There is a Holonomic.vi in the WPIlib LabView files (should be under RobotDrive?). This VI takes 4 required inputs:

1. RobotDrive data cluster
2. Magnitude - Requires a value from -1 to 1. If you’re using one joystick for strafing, this will be Pythgorean theorem (sqrt(Xaxis^2 + Yaxis^2)).
3. Direction - Requires a value from -180 to 180 (degrees). If you’re using one joystick for strafing, this will be the Arctan2 between the two joysticks (found under Mathematics>Elementary>Trigonometric, it should be the last VI). Plug in the Y axis to Y and the X axis to X. This returns a value in radians, so you have to convert to degrees by dividing by Pi (Numeric>Constants>Pi) and multiplying by 180.
4. Rotation - Requires a value from -1 to 1. You can use the X axis of a second joystick, the rotation axis from a 3-axis joystick, or anything else that’s convenient.

You can actually split the duties up between joysticks so you have forward/backward on one joystick and strafing on another joystick, and it will still work perfectly, just run the wires correctly. Our Girl Scouts team last year used this VI and to rotate, used the left and right buttons on top of one of the joysticks (full rotate left or full rotate right). We’re using a 3-axis joystick this year that controls all of the driving. To rotate, you have to push the trigger, and to rotate with more control, you can push the button under the thumb, and it squares the value being sent to Rotate (all of the strafing still works, we just didn’t want to accidentally rotate because the Z axis is so sensitive).

Hope this helps. If you were planning on using a different setup (like what Alan said with the tank steering with strafing) let us know and someone will be able to help you with that. This is just one way.

First thanks for the quick replies!

I have to say I’m not too sure what strafing is (googled it a little) I’m guessing thats when you use the rollers on the wheels to make the robot go sideways. I don’t know too much about driving systems or their different advantages, (mostly math and lower level languages) but thats a different topic.

I would first ask for just the basic tank drive, just because we lost ours from last year, only with 2 motors per side. (I know LabView has a basic vi of the tank drive, but like I said most of my experience is with things like C++, too me Labview is just confusing.)

With the tank drive (y axis on 2 joysticks) leaves the x axis unused, I’m assuming that is where you would want to use the strafing [moving perpendicular to the wheels (correct me if I’m wrong on my vocabulary here]) but that leaves open 2 possible movements you can make with the joy sticks (that I can think of) one where both joy sticks go outward from each other, and the other where they point inward/toward each other. I’m not too sure what that would do or how those “gestures” could be utilized.

What I’d like is some thing that can utilize as much as possible, but still be simple to use. and thats where I have trouble with LabView is that seems like a lot of if statements, and I never quit get how those work.

So could we get a few basic examples, one with basic tank drive for 4 wheels, and one with the strafing. Plus maybe the strafing on one and tank on the other, but really this isn’t my area of expertise. I’m only able to really talk with my team during the week, and am not sure exactly where they were going with this.

I’d just like to see a couple of different ones that I know work so I can kind of figure out how they work and how to edit them, because at the moment I’m not too sure what would work better.

Again thanks for any and all help, and all help already given! I don’t want to ask for too much but I don’t know too much about the drive system aspect, and if we were doing this in C++ a few of our teachers and I would probably be the main programmers, so we’re kinda in the dark!

LabVIEW examples for WPILib are most easily reached from the Getting Started window. You can click on the Examples list and it is near the bottom. It demonstrates how to use the Y axis on two joysticks to control a skid steer driving platform. At least on the update I have, there wasn’t a holonomic example.

If you actually want to learn LV, I’d suggest watching a few tutorials, perhaps with the students. NI has quite a few, and there are also good ones on LVMastery.com.

sorry, apparently my reply didn’t get posted, been too busy to retype it.

LabVIEW examples for WPILib are most easily reached from the Getting Started window. You can click on the Examples list and it is near the bottom. It demonstrates how to use the Y axis on two joysticks to control a skid steer driving platform. At least on the update I have, there wasn’t a holonomic example.

yeah, I know LabView has a lot of examples, including the tank drive, but with my current understanding of LabView I don’t understand what I am looking at. I tried editing basic things on them last year with little or no luck, plus with the basic tank drive we have 4 motors, and the example only has 2. That’s why I was hoping to get an example on here, so I can ask questions about it, and it would have a better description of what it is, a lot of the examples in LabView are named things that I don’t know what are. Plus we need something a little more advanced than basic tank drive.

I haven’t looked through every thing yet though, we just recently got LabView on some other computers so we can really learn it (before it was just on the NetBook).

If you actually want to learn LV, I’d suggest watching a few tutorials, perhaps with the students. NI has quite a few, and there are also good ones on LVMastery.com.

I really need to learn LabView, but I loathe having to do so, I’d rather just use C++, but my team wants LabView because they have a little more experience with it. I’m going to be watching more of the tutorials tomorrow though, one on LVMastery.com looks interesting to me, LabView for C programmers. Thanks for the site!

Most of our programmers can only program during the school day though, as they don’t have LabView on their computers, (my self included) so we decided to ask so if we don’t manage to learn LabView and program it in time we’ll at least have some thing.

Again thanks for any and all help and all help already given!

here u go if you need deadzones for direction tell me because we already figured out a way to do it http://www.chiefdelphi.com/forums/attachment.php?attachmentid=8627&d=1265942765

I was pointing out the Getting Started Examples link because as you mention, LV ships with thousands of VIs that cover many devices and used in many industries. If you look at the FRC specific ones, they should all be more applicable.

One thing you may find helpful, open the Help>>Show Context Help. This will give information as you idle over a particular node or wire.

I am actually interested in finding out how to program our team’s mecanum wheels so that we can have a tank drive style steering with strafing. This is our second year of FRC

and so I know some of the lingo of LabView, but pictures help a lot. Thanks

The following post might be of interest to you:

~

Ether’s Post was a lifesaver for holonomic drive(partly because it is so easy to make sense of.) I whipped this up after reading it. All you need to do is plug in your joystick dev ref to the one side, and then plug the 4 values that output on the right into your 4 drive VI’s.

Note, I did not test this yet, since we didn’t get our mechanum wheels yet

hope this helps, and of course, all credit goes to Ether

When you get your wheels, make sure you mount them properly:

~

Sorry I’ve been pretty busy I have 4 college classes to keep up with too.

I talked with our machine tool instructor and he explained a little better what we need, and to answer Alan Anderson’s question way back, we need Tank drive plus strafe, 2 joysticks both controlling one side of the robot on the y for tank drive and one or both as strafe on the x. He is going to have some more students look for code through emailing people on youtube.

Again sorry I haven’t been keeping up on this thread vary well, our tech center has 8th grade visits right now, so I wasn’t even any where near the robot to try any of this code all week, nor am I now, and I won’t be until Tuesday (Feb 23)

Again thanks for all the help the! The pdf that Ether posted http://lib.store.yahoo.net/lib/yhst-...lSpecSheet.pdf has has defiantly cleared a few things up for me, and the code http://files.me.com/eovnu87435ds/k0i3pn looks interesting, will try it when If I ever get my hands on the robot before the deadline lol.

That’s very easy to do using the “Mecanum - Cartesian” vi. Use the average of the joysticks’ X values as the X input, the average of the joysticks’ Y values as the Y input, and the difference between the Y values (divided by 2) as the rotation input.

Originally Posted by Alan Anderson
That’s very easy to do using the “Mecanum - Cartesian” vi. Use the average of the joysticks’ X values as the X input, the average of the joysticks’ Y values as the Y input, and the difference between the Y values (divided by 2) as the rotation input.

“Mecanum - Cartesian” vi, is that in the example files? I don’t know because I still don’t have direct access to them, just a basic evaluation copy of LabView on my laptop.

Is there any where I can download those example files onto my computer so I don’t have to be at the school?

Thanks to all the help again!

You can use the disks from the Kit of Parts to load LabVIEW for FRC on your own computer. Then download and install the LabVIEW update (see http://www.usfirst.org/frccontrolsystem for the link).

The HolonomicDrive vi is in the RobotDrive palette of the WPI Robotics Library functions. Once placed on the block diagram, it can be changed from Polar to Cartesian input.

Alan- is this sort of what you were talking about?

I guess I should note that Axis 3 and Axis 4 are a second set of X+Y axis from our Logitech Dual-Action Gamepad

That looks exactly like what I was talking about.