Package edu.wpi.first.wpilibj
Class PWMSpeedController
- java.lang.Object
-
- edu.wpi.first.wpilibj.MotorSafety
-
- edu.wpi.first.wpilibj.PWM
-
- edu.wpi.first.wpilibj.PWMSpeedController
-
- All Implemented Interfaces:
PIDOutput,Sendable,SpeedController,AutoCloseable
- Direct Known Subclasses:
DMC60,Jaguar,PWMSparkMax,PWMTalonFX,PWMTalonSRX,PWMVenom,PWMVictorSPX,SD540,Spark,Talon,Victor,VictorSP
public abstract class PWMSpeedController extends PWM 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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPWMSpeedController(int channel)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisable()Disable the speed controller.doubleget()Get the recently set value of the PWM.StringgetDescription()booleangetInverted()Common interface for returning if a speed controller is in the inverted state or not.voidinitSendable(SendableBuilder builder)Initializes thisSendableobject.voidpidWrite(double output)Write out the PID value as seen in the PIDOutput base object.voidset(double speed)Set the PWM value.voidsetInverted(boolean isInverted)Common interface for inverting direction of a speed controller.-
Methods inherited from class edu.wpi.first.wpilibj.PWM
close, enableDeadbandElimination, getChannel, getPosition, getRaw, getRawBounds, getSpeed, setBounds, setDisabled, setPeriodMultiplier, setPosition, setRaw, setSpeed, setZeroLatch, stopMotor
-
Methods inherited from class edu.wpi.first.wpilibj.MotorSafety
check, checkMotors, feed, getExpiration, isAlive, isSafetyEnabled, setExpiration, setSafetyEnabled
-
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.Sendable
addChild, getName, getSubsystem, setName, setName, setName, setName, setSubsystem
-
Methods inherited from interface edu.wpi.first.wpilibj.SpeedController
setVoltage, stopMotor
-
-
-
-
Method Detail
-
getDescription
public String getDescription()
- Overrides:
getDescriptionin classPWM
-
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:
setin interfaceSpeedController- 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:
getin interfaceSpeedController- 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:SpeedControllerCommon interface for inverting direction of a speed controller.- Specified by:
setInvertedin interfaceSpeedController- Parameters:
isInverted- The state of inversion true is inverted.
-
getInverted
public boolean getInverted()
Description copied from interface:SpeedControllerCommon interface for returning if a speed controller is in the inverted state or not.- Specified by:
getInvertedin interfaceSpeedController- Returns:
- isInverted The state of the inversion true is inverted.
-
disable
public void disable()
Description copied from interface:SpeedControllerDisable the speed controller.- Specified by:
disablein interfaceSpeedController
-
pidWrite
public void pidWrite(double output)
Write out the PID value as seen in the PIDOutput base object.
-
initSendable
public void initSendable(SendableBuilder builder)
Description copied from interface:SendableInitializes thisSendableobject.- Specified by:
initSendablein interfaceSendable- Overrides:
initSendablein classPWM- Parameters:
builder- sendable builder
-
-