public class MecanumDrive extends DriveSystem
MecanumDrive
is a DriveSystem
that represents a system using mecanum
wheels.Modifier and Type | Field and Description |
---|---|
static double |
DRIVE_POWER_WEIGHT
The relative weight of the forward vector over other vectors.
|
static double |
MOVE_POWER_SCALE
The multiplier for all motor powers.
|
static double |
ROTATE_POWER_WEIGHT
The relative weight of the clockwise vector over other vectors.
|
static double |
STRAFE_POWER_WEIGHT
The relative weight of the right vector over other vectors.
|
Constructor and Description |
---|
MecanumDrive(MotorSet wheels)
Constructs a new
MecanumDrive with the given DriveMotorSet as a
base. |
MecanumDrive(java.lang.String[] motornames)
Constructs a new
MecanumDrive that uses the motors with the given names. |
Modifier and Type | Method and Description |
---|---|
int |
getDriveTicks()
Gets the average value in raw ticks of the encoders for driving,
assuming the robot is traveling in a straight line.
|
int |
getRotateTicks()
Gets the average value in raw ticks of the encoders for driving,
assuming the robot is rotating.
|
int |
getSwingTicks(boolean clockwise)
Gets the average value in raw ticks of the encoders for driving,
assuming the robot is swinging.
|
boolean |
setMovement(double forward,
double clockwise)
Sets the power of the motors on the robot so that the robot moves as described by
the two vectors.
|
boolean |
setMovement(double forward,
double right,
double clockwise)
Sets the power of the motors on the robot so that the robot moves as described by
the three vectors.
|
boolean |
strafe(int power)
Strafes (moves sideways) with the given power.
|
boolean |
strafeSeconds(int power,
float seconds)
Strafes (moves sideways) with the given power and for the given amount of time, and
then stops.
|
boolean |
traverse(boolean right,
int power)
Drives and strafes (moves sideways) with the given (equal) power.
|
boolean |
traverseSeconds(boolean right,
int power,
float seconds)
Drives and strafes (moves sideways) with the given (equal) power and for the given
amount of time, and then stops.
|
drive, driveInches, driveSeconds, driveTicks, getDriveInches, getMotorSet, getRotationDegrees, getSwingDegrees, halt, resetEncoders, rotate, rotateDegrees, rotateSeconds, rotateTicks, setEncoderTicksPerDriveInch, setEncoderTicksPerRotationDegree, setEncoderTicksPerSwingDegree, swing, swingDegrees, swingSeconds, swingTicks, waitAndStop
public static final double MOVE_POWER_SCALE
public static final double DRIVE_POWER_WEIGHT
public static final double STRAFE_POWER_WEIGHT
public static final double ROTATE_POWER_WEIGHT
public MecanumDrive(MotorSet wheels)
MecanumDrive
with the given DriveMotorSet
as a
base.wheels
- the DriveMotorSet
of this drive system.DriveSystem.DriveSystem(MotorSet)
public MecanumDrive(java.lang.String[] motornames)
MecanumDrive
that uses the motors with the given names.motornames
- the names of the motors to use with this drive system.DriveSystem.DriveSystem(String[])
public boolean setMovement(double forward, double clockwise)
DriveSystem
setMovement
in class DriveSystem
forward
- the forward-driving vector; between -1 and 1.clockwise
- the clockwise-spinning vector; between -1 and 1.public boolean strafe(int power)
power
- the right-facing power; between -1 and 1.public boolean traverse(boolean right, int power)
right
- true
if the robot should strafe to the right, or false
if the robot should strafe to the left.power
- the forward power; between -1 and 1.public boolean strafeSeconds(int power, float seconds)
power
- the right-facing power; between -1 and 1.seconds
- the time to move for.public boolean traverseSeconds(boolean right, int power, float seconds)
right
- true
if the robot should strafe to the right, or false
if the robot should strafe to the left.power
- the forward power; between -1 and 1.seconds
- the time to move for.public boolean setMovement(double forward, double right, double clockwise)
forward
- the forward-driving vector; between -1 and 1.right
- the right-strafing vector; between -1 and 1.clockwise
- the clockwise-spinning vector; between -1 and 1.public int getDriveTicks()
DriveSystem
getDriveTicks
in class DriveSystem
public int getRotateTicks()
DriveSystem
getRotateTicks
in class DriveSystem
public int getSwingTicks(boolean clockwise)
DriveSystem
getSwingTicks
in class DriveSystem