public class MecanumDrive extends RobotDriveBase
Mecanum drives are rectangular with one wheel on each corner. Each wheel has rollers toed in 45 degrees toward the front or back. When looking at the wheels from the top, the roller axles should form an X across the robot. Each drive() function provides different inverse kinematic relations for a Mecanum drive robot.
Drive base diagram:
\\_______/ \\ | | / | | /_|___|_\\ / \\
Each drive() function provides different inverse kinematic relations for a Mecanum drive robot. Motor outputs for the right side are negated, so motor direction inversion by the user is usually unnecessary.
RobotDriveBase.MotorType
m_deadband, m_maxOutput, m_safetyHelper
DEFAULT_SAFETY_EXPIRATION
Constructor and Description |
---|
MecanumDrive(SpeedController frontLeftMotor,
SpeedController rearLeftMotor,
SpeedController frontRightMotor,
SpeedController rearRightMotor)
Construct a MecanumDrive.
|
Modifier and Type | Method and Description |
---|---|
void |
driveCartesian(double x,
double y,
double rotation)
Drive method for Mecanum platform.
|
void |
driveCartesian(double x,
double y,
double rotation,
double gyroAngle)
Drive method for Mecanum platform.
|
void |
drivePolar(double magnitude,
double angle,
double rotation)
Drive method for Mecanum platform.
|
java.lang.String |
getDescription() |
void |
stopMotor() |
applyDeadband, getExpiration, isAlive, isSafetyEnabled, limit, normalize, setDeadband, setExpiration, setMaxOutput, setSafetyEnabled
public MecanumDrive(SpeedController frontLeftMotor, SpeedController rearLeftMotor, SpeedController frontRightMotor, SpeedController rearRightMotor)
If a motor needs to be inverted, do so before passing it in.
public void driveCartesian(double x, double y, double rotation)
x
- The speed that the robot should drive in the X direction. [-1.0..1.0]y
- The speed that the robot should drive in the Y direction. [-1.0..1.0]rotation
- The rate of rotation for the robot that is completely independent of the
translation. [-1.0..1.0]public void driveCartesian(double x, double y, double rotation, double gyroAngle)
x
- The speed that the robot should drive in the X direction. [-1.0..1.0]y
- The speed that the robot should drive in the Y direction. [-1.0..1.0]rotation
- The rate of rotation for the robot that is completely independent of the
translation. [-1.0..1.0]gyroAngle
- The current angle reading from the gyro. Use this to implement field-oriented
controls.public void drivePolar(double magnitude, double angle, double rotation)
magnitude
- The speed that the robot should drive in a given direction. [-1.0..1.0]angle
- The direction the robot should drive in degrees. 0.0 is straight ahead. The
direction and maginitude are independent of the rotation rate.rotation
- The rate of rotation for the robot that is completely independent of the
magnitude or direction. [-1.0..1.0]public void stopMotor()
stopMotor
in interface MotorSafety
stopMotor
in class RobotDriveBase
public java.lang.String getDescription()
getDescription
in interface MotorSafety
getDescription
in class RobotDriveBase