View Single Post
  #6   Spotlight this post!  
Unread 19-02-2011, 16:38
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: how to program mecanum wheel drive?

Quote:
Originally Posted by sjspry View Post
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, 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