View Single Post
  #10   Spotlight this post!  
Unread 11-01-2011, 02:28
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Mechanum wheel programming in C++

Quote:
Originally Posted by mikets View Post
The WPI library provides the RobotDrive object that includes a method:
Code:
void RobotDrive::MecanumDrive_Polar(float magnitude, float direction, float rotation)
You can call this method to drive the mechanum wheels. It is using polar coordinate system where you specify the magnitude and direction you want to go. Rotation will specify the heading you want the robot to face.

To calculate the magnitude and direction from joystick reading, you can do:
Code:
MecanumDrive_Polar(joystick->GetMagnitude(), joystick->GetDirectionDegrees(), 0.0);
Note that the MecanumDrive_Cartesian is much more suited to driving with a joystick. It was designed to directly pass 3 joystick axes in.

Quote:
void MecanumDrive_Cartesian(float x, float y, float rotation, float gyroAngle = 0.0);
This also allows you to simply pass in the current reading from a gyro to accomplish field-oriented-control.

-Joe
Reply With Quote