edu.wpi.first.wpilibj.drive

## Class RobotDriveBase

- java.lang.Object
- - edu.wpi.first.wpilibj.drive.RobotDriveBase

- All Implemented Interfaces:
    MotorSafety
  Direct Known Subclasses:
    DifferentialDrive, KilloughDrive, MecanumDrive

      public abstract class RobotDriveBase
      extends java.lang.Object
      implements MotorSafety

  Common base class for drive platforms.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `RobotDriveBase.MotorType` The location of a motor on the robot for the purpose of driving.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected double` | `m_deadband`
    `protected double` | `m_maxOutput`
    `protected MotorSafetyHelper` | `m_safetyHelper`

    - ### Fields inherited from interface edu.wpi.first.wpilibj.MotorSafety

      `DEFAULT_SAFETY_EXPIRATION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RobotDriveBase()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    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)`
    `void` | `setExpiration(double timeout)`
    `void` | `setMaxOutput(double maxOutput)` Configure the scaling factor for using RobotDrive with motor controllers in a mode other than PercentVbus.
    `void` | `setSafetyEnabled(boolean enabled)`
    `abstract void` | `stopMotor()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### m_deadband

          protected double m_deadband

    - #### m_maxOutput

          protected double m_maxOutput

    - #### m_safetyHelper

          protected MotorSafetyHelper m_safetyHelper

  - ### Constructor Detail

    - #### RobotDriveBase

          public RobotDriveBase()

  - ### Method Detail

    - #### setDeadband

          public void setDeadband(double deadband)

    - #### setMaxOutput

          public void setMaxOutput(double maxOutput)

      Configure the scaling factor for using RobotDrive with motor controllers in a mode other than PercentVbus.
      Parameters:
        `maxOutput` - Multiplied with the output percentage computed by the drive functions.

    - #### setExpiration

          public void setExpiration(double timeout)

      Specified by:
        `setExpiration` in interface `MotorSafety`

    - #### getExpiration

          public double getExpiration()

      Specified by:
        `getExpiration` in interface `MotorSafety`

    - #### isAlive

          public boolean isAlive()

      Specified by:
        `isAlive` in interface `MotorSafety`

    - #### stopMotor

          public abstract void stopMotor()

      Specified by:
        `stopMotor` in interface `MotorSafety`

    - #### isSafetyEnabled

          public boolean isSafetyEnabled()

      Specified by:
        `isSafetyEnabled` in interface `MotorSafety`

    - #### setSafetyEnabled

          public void setSafetyEnabled(boolean enabled)

      Specified by:
        `setSafetyEnabled` in interface `MotorSafety`

    - #### getDescription

          public abstract java.lang.String getDescription()

      Specified by:
        `getDescription` in interface `MotorSafety`

    - #### limit

          protected double limit(double value)

      Limit motor values to the -1.0 to +1.0 range.

    - #### applyDeadband

          protected double applyDeadband(double value,
                                         double deadband)

      Returns 0.0 if the given value is within the specified range around zero. The remaining range between the deadband and 1.0 is scaled from 0.0 to 1.0.
      Parameters:
        `value` - value to clip
        `deadband` - range around zero

    - #### normalize

          protected void normalize(double[] wheelSpeeds)

      Normalize all wheel speeds if the magnitude of any wheel is greater than 1.0.