edu.wpi.first.wpilibj

## Class PWMSpeedController

- java.lang.Object
- - edu.wpi.first.wpilibj.SensorBase
  - - edu.wpi.first.wpilibj.PWM
    - - edu.wpi.first.wpilibj.SafePWM
      - - edu.wpi.first.wpilibj.PWMSpeedController

- All Implemented Interfaces:
    LiveWindowSendable, MotorSafety, PIDOutput, Sendable, SpeedController
  Direct Known Subclasses:
    Jaguar, PWMTalonSRX, SD540, Spark, Talon, Victor, VictorSP

      public abstract class PWMSpeedController
      extends SafePWM
      implements SpeedController

  Common base class for all PWM Speed Controllers.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class edu.wpi.first.wpilibj.PWM

      `PWM.PeriodMultiplier`

  - ### Field Summary

    - ### Fields inherited from class edu.wpi.first.wpilibj.SensorBase

      `kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond`

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

      `DEFAULT_SAFETY_EXPIRATION`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `PWMSpeedController(int channel)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `get()` Get the recently set value of the PWM.
    `boolean` | `getInverted()` Common interface for returning if a speed controller is in the inverted state or not.
    `void` | `pidWrite(double output)` Write out the PID value as seen in the PIDOutput base object.
    `void` | `set(double speed)` Set the PWM value.
    `void` | `setInverted(boolean isInverted)` Common interface for inverting direction of a speed controller.

    - ### Methods inherited from class edu.wpi.first.wpilibj.SafePWM

      `disable, feed, Feed, getDescription, getExpiration, isAlive, isSafetyEnabled, setExpiration, setSafetyEnabled, stopMotor`

    - ### Methods inherited from class edu.wpi.first.wpilibj.PWM

      `enableDeadbandElimination, free, getChannel, getPosition, getRaw, getRawBounds, getSmartDashboardType, getSpeed, initTable, setBounds, setDisabled, setPeriodMultiplier, setPosition, setRaw, setSpeed, setZeroLatch, startLiveWindowMode, stopLiveWindowMode, updateTable`

    - ### Methods inherited from class edu.wpi.first.wpilibj.SensorBase

      `checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule`

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

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

    - ### Methods inherited from interface edu.wpi.first.wpilibj.SpeedController

      `disable, stopMotor`

- - ### Constructor Detail

    - #### PWMSpeedController

          protected PWMSpeedController(int channel)

      Constructor.
      Parameters:
        `channel` - The PWM channel that the controller is attached to. 0-9 are on-board, 10-19 are on the MXP port

  - ### Method Detail

    - #### set

          public void set(double speed)

      Set the PWM value.

      The PWM value is set using a range of -1.0 to 1.0, appropriately scaling the value for the FPGA.

      Specified by:
        `set` in interface `SpeedController`
      Parameters:
        `speed` - The speed value between -1.0 and 1.0 to set.

    - #### get

          public double get()

      Get the recently set value of the PWM.
      Specified by:
        `get` in interface `SpeedController`
      Returns:
        The most recently set value for the PWM between -1.0 and 1.0.

    - #### setInverted

          public void setInverted(boolean isInverted)

      Description copied from interface: `SpeedController`
      Common interface for inverting direction of a speed controller.
      Specified by:
        `setInverted` in interface `SpeedController`
      Parameters:
        `isInverted` - The state of inversion true is inverted.

    - #### getInverted

          public boolean getInverted()

      Description copied from interface: `SpeedController`
      Common interface for returning if a speed controller is in the inverted state or not.
      Specified by:
        `getInverted` in interface `SpeedController`
      Returns:
        isInverted The state of the inversion true is inverted.

    - #### pidWrite

          public void pidWrite(double output)

      Write out the PID value as seen in the PIDOutput base object.
      Specified by:
        `pidWrite` in interface `PIDOutput`
      Parameters:
        `output` - Write out the PWM value as was found in the PIDController