public abstract class RobotDriveBase extends SendableBase implements MotorSafety
Modifier and Type | Class and Description |
---|---|
static class |
RobotDriveBase.MotorType
The location of a motor on the robot for the purpose of driving.
|
Modifier and Type | Field and Description |
---|---|
static double |
kDefaultDeadband |
static double |
kDefaultMaxOutput |
protected double |
m_deadband |
protected double |
m_maxOutput |
protected MotorSafetyHelper |
m_safetyHelper |
DEFAULT_SAFETY_EXPIRATION
Constructor and Description |
---|
RobotDriveBase() |
Modifier and Type | Method and Description |
---|---|
protected double |
applyDeadband(double value,
double deadband)
Returns 0.0 if the given value is within the specified range around zero.
|
abstract java.lang.String |
getDescription() |
double |
getExpiration() |
boolean |
isAlive() |
boolean |
isSafetyEnabled() |
protected double |
limit(double value)
Limit motor values to the -1.0 to +1.0 range.
|
protected void |
normalize(double[] wheelSpeeds)
Normalize all wheel speeds if the magnitude of any wheel is greater than 1.0.
|
void |
setDeadband(double deadband)
Change the default value for deadband scaling.
|
void |
setExpiration(double timeout) |
void |
setMaxOutput(double maxOutput)
Configure the scaling factor for using drive methods with motor controllers in a mode other
than PercentVbus or to limit the maximum output.
|
void |
setSafetyEnabled(boolean enabled) |
abstract void |
stopMotor() |
addChild, free, getName, getSubsystem, setName, setName, setName, setSubsystem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initSendable, setName
public static final double kDefaultDeadband
public static final double kDefaultMaxOutput
protected double m_deadband
protected double m_maxOutput
protected MotorSafetyHelper m_safetyHelper
public RobotDriveBase()
public void setDeadband(double deadband)
applyDeadband(double, double)
.deadband
- The deadband to set.public void setMaxOutput(double maxOutput)
The default value is 1.0.
maxOutput
- Multiplied with the output percentage computed by the drive functions.public void setExpiration(double timeout)
setExpiration
in interface MotorSafety
public double getExpiration()
getExpiration
in interface MotorSafety
public boolean isAlive()
isAlive
in interface MotorSafety
public abstract void stopMotor()
stopMotor
in interface MotorSafety
public boolean isSafetyEnabled()
isSafetyEnabled
in interface MotorSafety
public void setSafetyEnabled(boolean enabled)
setSafetyEnabled
in interface MotorSafety
public abstract java.lang.String getDescription()
getDescription
in interface MotorSafety
protected double limit(double value)
protected double applyDeadband(double value, double deadband)
value
- value to clipdeadband
- range around zeroprotected void normalize(double[] wheelSpeeds)