View Single Post
  Spotlight this post!  
Unread 03-03-2013, 10:21
carrillo694's Avatar
carrillo694 carrillo694 is offline
Alex Carrillo
FRC #0694 (Stuypulse)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2009
Location: New York, NY
Posts: 66
carrillo694 is a jewel in the roughcarrillo694 is a jewel in the roughcarrillo694 is a jewel in the roughcarrillo694 is a jewel in the rough
Re: Mecanum steering

See the MecanumDrive_Cartesian() function in the RobotDrive class:

Code:
void RobotDrive::MecanumDrive_Cartesian(float x,
float 	y,
float 	rotation,
float 	gyroAngle = 0.0 
)
Pass in the X and Y coordinates of one stick, and pass the X coordinate of another stick to serve as the "rotation" rate, and then finally pass in an angle from the gyro to the `gyroAngle` field to rotate your cartesian x/y inputs relative to your robot's orientation. That way, pushing "forward" on your x/y joystick will always translate to the direction that your robot absolutely considers true 0 degrees based on your gyro feedback, no matter which direction the robot is actually facing.

You will only need to use the gyro if you want your controls to be "field-oriented," such that pushing forward on your joystick means the robot always heads directly away from you, no matter which way it is pointing. If you want it to be "robot-oriented," such that forward on the joystick always means the robot travels in the direction that its front face is pointing, just pass a 0 to the `gyroAngle` field of the function.

Last edited by carrillo694 : 03-03-2013 at 10:23. Reason: Clarified whether or not a gyro is needed.