View Single Post
  #4   Spotlight this post!  
Unread 01-02-2011, 00:13
Patrick Chiang Patrick Chiang is offline
Programming
FRC #3070 (Team Pronto)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Seattle
Posts: 162
Patrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to all
Re: Programming Mecanum?

You COULD do this:
Code:
/* Simulated tank drive controls for mecanum wheels */
magnitude = (leftStick.getMagnitude() + rightStick.getMagnitude()) / 2;
direction = (leftStick.getDirectionDegrees()+rightStick.getDirectionDegrees()) / 2;
rotation = (leftStick.getY() + rightStick.getY()) / 2;
driveRobot.mecanumDrive_Polar(magnitude, direction, rotation);
^ We did it like this because our driver specifically asked for these controls. He has driven tank drive for two years, and I guess old habits are hard to change.

You SHOULD do this:
Code:
magnitude = leftStick.getMagnitude();
direction = leftStick.getDirectionDegrees();
rotation = rightStick.getX();
driveRobot.mecanumDrive_Polar(magnitude, direction, rotation);
^ This is what we call the FPS drive system (aka. xbox controller style). Left joystick controls w,a,s,d (forward, back, left, right) and diagonal movements. Right joystick controls rotation.
Reply With Quote