Class RobotDriveBase

Direct Known Subclasses:
DifferentialDrive, MecanumDrive

public abstract class RobotDriveBase extends MotorSafety
Common base class for drive platforms.

MotorSafety is enabled by default.

  • Field Details

    • DEFAULT_DEADBAND

      public static final double DEFAULT_DEADBAND
      Default input deadband.
      See Also:
    • DEFAULT_MAX_OUTPUT

      public static final double DEFAULT_MAX_OUTPUT
      Default maximum output.
      See Also:
    • m_deadband

      protected double m_deadband
      Input deadband.
    • m_maxOutput

      protected double m_maxOutput
      Maximum output.
  • Constructor Details

    • RobotDriveBase

      public RobotDriveBase()
      RobotDriveBase constructor.
  • Method Details

    • setDeadband

      public void setDeadband(double deadband)
      Sets the deadband applied to the drive inputs (e.g., joystick values).

      The default value is 0.02. Inputs smaller than the deadband are set to 0.0 while inputs larger than the deadband are scaled from 0.0 to 1.0. See MathUtil.applyDeadband(double, double, double).

      Parameters:
      deadband - The deadband to set.
    • setMaxOutput

      public 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.

      The default value is 1.0.

      Parameters:
      maxOutput - Multiplied with the output percentage computed by the drive functions.
    • feedWatchdog

      public void feedWatchdog()
      Feed the motor safety object. Resets the timer that will stop the motors if it completes.
      See Also:
    • stopMotor

      public abstract void stopMotor()
      Description copied from class: MotorSafety
      Called to stop the motor when the timeout expires.
      Specified by:
      stopMotor in class MotorSafety
    • getDescription

      public abstract String getDescription()
      Description copied from class: MotorSafety
      Returns a description to print when an error occurs.
      Specified by:
      getDescription in class MotorSafety
      Returns:
      Description to print when an error occurs.
    • normalize

      protected static void normalize(double[] wheelVelocities)
      Normalize all wheel velocities if the magnitude of any wheel is greater than 1.0.
      Parameters:
      wheelVelocities - List of wheel velocities to normalize.