Log in

View Full Version : how to program mecanum wheel drive?


sonicwingmode
16-02-2011, 18:42
our team searched the forums and found how to start program a mecanum wheel drive, but we are stuck.

http://www.chiefdelphi.com/forums/showthread.php?p=1020714

We can't find the Mecanum Drive block. Do we have to download the Mecanum Drive block or do we have to make the program from scratch?

bmxer51
16-02-2011, 21:54
We also use mecanum wheels and last year our program was terrible. We have a pretty decent program this year after i sat down and learned labview. What controls are you using? We are using an xbox controller but it would be very simple to change it to the two joysticks provided in the kit. If you could give me that info I could help you come up with your equations to write for each wheel.

Teamcodeorange
16-02-2011, 21:59
When you say "block" I am going to assume that you are programing in labview. If you are available tomorrow (or today), I can help you program it using remote desktop software if that's ok with you. Send an email to therobotmaker@gmail.com if you are interested. :D :D :D

Alan Anderson
16-02-2011, 22:35
We can't find the Mecanum Drive block.

There's a Search button at the top of the Functions Palette. It'll show you where to find anything you can name. In this case, the name of the function you're looking for is actually Holonomic Drive.

Chexposito
17-02-2011, 08:30
i looked through the robot drive function and there is a mechanum drive...

Ether
17-02-2011, 09:59
See attached screenshots.

sonicwingmode
17-02-2011, 15:32
oh! there it is, I'm going to try to program it

sonicwingmode
18-02-2011, 19:34
what do we put in the rotation?

Owen Meaker
18-02-2011, 23:43
what do we put in the rotation?

rotation is the, well, rotation of the robot. If you have a joystick that can be twisted, you can use that (for our joystick its axis 4, but it could be different for other joysticks). If your joystick does not support twisting, you will need to have buttons that are wired in (for example, put in a case structure that determines which button is being pressed, that then outputs a 1 or -1 depending on which way you want to rotate it).

kornjones
19-02-2011, 00:00
My team has been using mecanums for a few years and at the beginning of the year an alumni asked me to make a program that could take full advantage of the mecanum wheels instead of our usual tank drive with trigger strafe boringness. after much thought and many matrices i realized that if you subtract the y axis form the x axis for the front right and back left and add y and x axes for the front right and back left we could make what i like to call omnidrive. it basically made it so that the robot would move in any direction the stick was pointing. after some more finagling i put the controls on two sticks and fixed a few value issues and now we have 2 stick mecanum omnidrive. its pretty difficult to explain but its fantastic to drive. if anyone needs any help i am also available for assistance

Ether
19-02-2011, 09:11
My team has been using mecanums for a few years and at the beginning of the year an alumni asked me to make a program that could take full advantage of the mecanum wheels instead of our usual tank drive with trigger strafe boringness. after much thought and many matrices i realized that if you subtract the y axis form the x axis for the front right and back left and add y and x axes for the front right and back left we could make what i like to call omnidrive. it basically made it so that the robot would move in any direction the stick was pointing. after some more finagling i put the controls on two sticks and fixed a few value issues and now we have 2 stick mecanum omnidrive. its pretty difficult to explain but its fantastic to drive. if anyone needs any help i am also available for assistance

What you have described has no rotation. Perhaps you left something out of your description?

Also, I assume there's a typo in there, because you said "front right and back left" twice.

sjspry
19-02-2011, 16:23
http://www.fingertechrobotics.com/prodimages/wheels/wheels_move_bot_left.jpg

That picture should make it fairly obvious. If not, look below. mainJoy is the one used for forward/back and strafing, rotJoy is used for rotation (pretty much like a FPS game, we even wired our camera's tilt up to rotJoy's Y axis so it is exactly like the usual FPS controls :)) For best results, use an Xbox/PS3 controller. Remember forward is -1.

Assuming you get -1..1:

front_Left = -mainJoy.getY() - rotJoy.getX() + mainJoy.getX()
front_Right = -mainJoy.getY() + rotJoy.getX() - mainJoy.getX()

back_Left = -mainJoy.getY() - rotJoy.getX() - mainJoy.getX()
back_Right = -mainJoy.getY() + rotJoy.getX() + mainJoy.getX()

Ether
19-02-2011, 16:38
mainJoy is the one used for forward/back and strafing, rotJoy is used for rotation... Remember forward is -1.

front_Left = -mainJoy.getY() - rotJoy.getX() + mainJoy.getX()
front_Right = -mainJoy.getY() + rotJoy.getX() - mainJoy.getX()

back_Left = -mainJoy.getY() - rotJoy.getX() - mainJoy.getX()
back_Right = -mainJoy.getY() + rotJoy.getX() + mainJoy.getX()

Two suggestions:

1) I would think it would be more intuitive if pushing rotJoy to the right would cause clockwise rotation*.

2) You need to normalize the 4 wheel commands (http://www.chiefdelphi.com/media/papers/download/2906), in a way that preserves their holonomic relationship, before sending them to the motors.


* I am assuming that the motors are set up so that issuing a + command causes the wheels to rotate in the "forward" direction

sjspry
19-02-2011, 17:23
Two suggestions:

1) I would think it would be more intuitive if pushing rotJoy to the right would cause clockwise rotation*.

2) You need to normalize the 4 wheel commands (http://www.chiefdelphi.com/media/papers/download/2906), in a way that preserves their holonomic relationship, before sending them to the motors.


* I am assuming that the motors are set up so that issuing a + command causes the wheels to rotate in the "forward" direction



As for #1, yeah, as far as I know everything should be backwards because of the Joystick output. They might need to modify it....

Didn't know about the handy PDF, though. Thanks :)

Ether
19-02-2011, 23:23
As for #1, yeah, as far as I know everything should be backwards because of the Joystick output. They might need to modify it....

The joystick X-axis is + to the right. So your code should be

front_Left = -mainJoy.getY() + rotJoy.getX() + mainJoy.getX()
front_Right = -mainJoy.getY() - rotJoy.getX() - mainJoy.getX()

back_Left = -mainJoy.getY() + rotJoy.getX() - mainJoy.getX()
back_Right = -mainJoy.getY() - rotJoy.getX() + mainJoy.getX()

sonicwingmode
20-02-2011, 14:47
http://www.3dcontentcentral.com/ShowModels/CONTENTCENTRAL/Window%20Motor%20-%20Left/Window%20Motor%20-%20Left.JPG

so, how do I program this?

Ether
20-02-2011, 14:56
http://www.3dcontentcentral.com/ShowModels/CONTENTCENTRAL/Window%20Motor%20-%20Left/Window%20Motor%20-%20Left.JPG

so, how do I program this?

Just like any other motor: it depends on what you want to do with it.

sonicwingmode
20-02-2011, 15:22
ok, thanks

sonicwingmode
20-02-2011, 17:02
our team is trying to use the relay to control the window motor, how do we program this?

Ether
20-02-2011, 17:09
our team is trying to use the relay to control the window motor, how do we program this?

http://www.chiefdelphi.com/forums/showthread.php?p=1025209#post1025209

sonicwingmode
20-02-2011, 17:10
edit: where do we put the program in?

sonicwingmode
20-02-2011, 17:18
the help here is awesome!

sonicwingmode
20-02-2011, 17:25
where do we find "Button 1"

Ether
20-02-2011, 17:29
where do we find "Button 1"


On the Attack3 Joystick it would be the trigger.

sonicwingmode
20-02-2011, 17:34
ok, I've found it.
Now where do I put this new program under? (begin? teleop? robot main?)

sonicwingmode
20-02-2011, 17:42
http://www.chiefdelphi.com/forums/attachment.php?attachmentid=8478&d=1265156994

we use this program for the relay control and we put it under "robot main" and it doesn't seem to work

Alan Anderson
21-02-2011, 00:13
Everything you want to happen during teleoperated mode goes in the Teleop vi.

All of the "Open" functions should be done once as initialization, and they go in the Begin vi. The associated "Close" functions go in the Finish vi.