public class DriveBase
extends Subsystem
Constructor and Description |
---|
DriveBase() |
Modifier and Type | Method and Description |
---|---|
void |
arcadeDrive(double xSpeed,
double zRotation)
Drives the Robot using an arcade drive configuration (single joystick with
twist)
|
void |
arcadeDrive(double xSpeed,
double zRotation,
boolean squaredInputs)
Drives the Robot using an arcade drive configuration (single joystick with
twist)
|
static double |
convertDriveBaseRotationsToInches(double rotations)
Gets inches per rotations of a NEO motor on the drive base since SparkMAX
encoders work in rotations.
|
static double |
convertDriveBaseTicksToInches(double ticks)
Converts a tick value taken from a drive base DIO encoder to inches.
|
static double |
convertInchesPerSecondToDriveBaseRoundsPerMinute(double inchesPerSecond)
Converts a value of per second of the DriveBase Rounds Per Minute
|
static double |
convertInchesToDriveBaseRotations(double inches)
Gets rotations of a NEO motor on the drive base per a value in inches ince
SparkMAX encoders work in rotations.
|
static int |
convertInchesToDriveBaseTicks(double inches)
Converts an inch value into drive base DIO Encoder ticks.
|
static double |
convertSparkRevolutionsToInches(double revolutions) |
void |
curvatureDrive(double xSpeed,
double zRotation,
boolean isQuickTurn)
Drives the Robot using a curvature drive configuration (wheel)
|
double |
getDriveBaseInputVoltage() |
double |
getDriveBaseOutputVoltage() |
java.util.List<CANSparkMax> |
getLeftControllers() |
double |
getLeftDIODistanceInches() |
Encoder |
getLeftDIOEncoder()
Returns the left DIO Encoder
|
int |
getLeftDIOEncoderPosition()
Gets the encoder position of the front left motor in ticks.
|
double |
getLeftInputVoltage() |
MustangDriveBaseEncoder |
getLeftMustangDriveBaseEncoder()
Returns the MustangDriveBaseEncoder used for the left motors
|
double |
getLeftMustangEncoderPositionInInches()
Returns the position of the MustangDriveBaseEncoder used for the left motors
in inches
|
int |
getLeftMustangEncoderPositionInTicks()
Returns the position of the MustangDriveBaseEncoder used for the left motors
in ticks
|
double |
getLeftMustangEncoderVelocityInInchesPerSecond()
Returns the velocity of the MustangDriveBaseEncoder used for the left motors
in inches/second
|
double |
getLeftMustangEncoderVelocityInTicksPerSecond()
Returns the velocity of the MustangDriveBaseEncoder used for the left motors
in ticks/second
|
double |
getLeftOutputCurrent() |
double |
getLeftOutputVoltage() |
int |
getLeftSparkEncoderPosition()
Gets the encoder position of the front left motor in ticks.
|
double |
getLeftSparkEncoderVelocityTicks()
Returns the velocity of the right side of the drivebase in ticks/second from
the Spark Encoder
|
java.util.List<CANSparkMax> |
getRightControllers() |
double |
getRightDIODistanceInches() |
Encoder |
getRightDIOEncoder()
Returns the right DIO Encoder
|
int |
getRightDIOEncoderPosition()
Gets the tick count of the right encoder
|
double |
getRightInputVoltage() |
MustangDriveBaseEncoder |
getRightMustangDriveBaseEncoder()
Returns the MustangDriveBaseEncoder used for the right motors
|
double |
getRightMustangEncoderPositionInInches()
Returns the position of the MustangDriveBaseEncoder used for the right motors
in inches
|
int |
getRightMustangEncoderPositionInTicks()
Returns the position of the MustangDriveBaseEncoder used for the right motors
in ticks
|
double |
getRightMustangEncoderVelocityInInchesPerSecond()
Returns the velocity of the MustangDriveBaseEncoder used for the right motors
in inches/second
|
double |
getRightMustangEncoderVelocityInTicksPerSecond()
Returns the velocity of the MustangDriveBaseEncoder used for the right motors
in ticks/second
|
double |
getRightOutputCurrent() |
double |
getRightOutputVoltage() |
int |
getRightSparkEncoderPosition()
Gets the encoder position of the front right motor in ticks.
|
double |
getRightSparkEncoderVelocityTicks()
Returns the velocity of the right side of the drivebase in ticks/second from
the Spark Encoder
|
double |
getRobotInputVoltage() |
double |
getRobotOutputCurrent() |
double |
getRobotOutputVoltage() |
void |
initBrakeMode() |
void |
initCoastMode() |
void |
initDefaultCommand() |
void |
sendEncoderDataToDashboard() |
void |
setMotorsBrakeMode(java.util.List<CANSparkMax> motorGroup,
IdleMode mode)
Sets array of motor to brake mode
|
void |
setMotorsCoastMode(java.util.List<CANSparkMax> motorGroup,
IdleMode mode)
Sets array of motor to coast mode
|
void |
setMotorsNeutralMode(IdleMode mode)
Sets array of motors to be of a specified mode
|
void |
setRampRate(java.util.List<CANSparkMax> motors,
double rampRate) |
void |
setSparkEncodersControl(double deltaLeft,
double deltaRight)
Sets the PIDControllers setpoints for the left and right side motors to the
given positions in ticks forward.
|
void |
setSparkVelocityControl(double leftVel,
double rightVel)
Sets the velocities of the left and right motors of the robot.
|
void |
stop()
Stops the motors on the drive base (sets them to 0).
|
void |
tankDrive(double leftSpeed,
double rightSpeed)
Drives the Robot using a tank drive configuration (two joysticks, or auton).
|
void |
tankDrive(double leftSpeed,
double rightSpeed,
boolean squaredInputs)
Drives the Robot using a tank drive configuration (two joysticks, or auton)
|
public void tankDrive(double leftSpeed, double rightSpeed)
leftSpeed
- Speed for left side of drive base [-1, 1]. Automatically
squares this value to linearize it.rightSpeed
- Speed for right side of drive base [-1, 1]. Automatically
squares this value to linearize it.public void initBrakeMode()
public void tankDrive(double leftSpeed, double rightSpeed, boolean squaredInputs)
leftSpeed
- Speed for left side of drive base [-1, 1]rightSpeed
- Speed for right side of drive base [-1, 1]squaredInputs
- If true, decreases sensitivity at lower inputspublic void curvatureDrive(double xSpeed, double zRotation, boolean isQuickTurn)
xSpeed
- The forward throttle speed [-1, 1]zRotation
- The amount of rotation to turn [-1, 1] with positive being
rightisQuickTurn
- If true enables turning in place and running one side
backwards to turn fasterpublic void arcadeDrive(double xSpeed, double zRotation, boolean squaredInputs)
xSpeed
- The forward throttle speed [-1, 1]zRotation
- The amount of rotation to turn [-1, 1] with positive being
rightisQuickTurn
- If true, decreases sensitivity at lower inputspublic void arcadeDrive(double xSpeed, double zRotation)
xSpeed
- The forward throttle speed [-1, 1]zRotation
- The amount of rotation to turn [-1, 1] with positive being
rightpublic void stop()
public double getRobotInputVoltage()
public double getRobotOutputVoltage()
public Encoder getLeftDIOEncoder()
public Encoder getRightDIOEncoder()
public void setSparkEncodersControl(double deltaLeft, double deltaRight)
deltaLeft
- The desired change in left position in encoder ticksdeltaRight
- The desired change in right position in encoder tickspublic void setSparkVelocityControl(double leftVel, double rightVel)
leftVel
- Velocity for left motors in inches/secrightVel
- Velocity for right motors in inches/secpublic int getLeftSparkEncoderPosition()
public int getRightSparkEncoderPosition()
public int getLeftDIOEncoderPosition()
public int getRightDIOEncoderPosition()
public void setMotorsNeutralMode(IdleMode mode)
public void setMotorsCoastMode(java.util.List<CANSparkMax> motorGroup, IdleMode mode)
public void setMotorsBrakeMode(java.util.List<CANSparkMax> motorGroup, IdleMode mode)
public double getLeftInputVoltage()
public double getRightInputVoltage()
public double getLeftOutputVoltage()
public double getRightOutputVoltage()
public double getLeftOutputCurrent()
public double getRightOutputCurrent()
public double getDriveBaseInputVoltage()
public double getDriveBaseOutputVoltage()
public double getRobotOutputCurrent()
public void initDefaultCommand()
public double getLeftSparkEncoderVelocityTicks()
public double getRightSparkEncoderVelocityTicks()
public double getLeftDIODistanceInches()
public double getRightDIODistanceInches()
public java.util.List<CANSparkMax> getLeftControllers()
public java.util.List<CANSparkMax> getRightControllers()
public void setRampRate(java.util.List<CANSparkMax> motors, double rampRate)
rampRate
- The ramp rate in seconds from 0 to full throttlepublic static double convertDriveBaseTicksToInches(double ticks)
public static double convertSparkRevolutionsToInches(double revolutions)
public static int convertInchesToDriveBaseTicks(double inches)
public static double convertDriveBaseRotationsToInches(double rotations)
public static double convertInchesToDriveBaseRotations(double inches)
public static double convertInchesPerSecondToDriveBaseRoundsPerMinute(double inchesPerSecond)
public MustangDriveBaseEncoder getLeftMustangDriveBaseEncoder()
public MustangDriveBaseEncoder getRightMustangDriveBaseEncoder()
public int getLeftMustangEncoderPositionInTicks()
public int getRightMustangEncoderPositionInTicks()
public double getLeftMustangEncoderPositionInInches()
public double getRightMustangEncoderPositionInInches()
public double getLeftMustangEncoderVelocityInTicksPerSecond()
public void initCoastMode()
public double getRightMustangEncoderVelocityInTicksPerSecond()
public double getLeftMustangEncoderVelocityInInchesPerSecond()
public double getRightMustangEncoderVelocityInInchesPerSecond()
public void sendEncoderDataToDashboard()