PIDSubsystem
- class commands2.PIDSubsystem(*arg, **kwargs)[source]
Bases:
Subsystem
A subsystem that uses a
wpimath.controller.PIDController
to control an output. The controller is run synchronously from the subsystem’s periodic() method.Creates a new PIDSubsystem.
- Parameters:
controller – The PIDController to use.
initial_position – The initial setpoint of the subsystem.
- getController() PIDController [source]
Returns the PIDController used by the subsystem.
- Returns:
The PIDController.
- getMeasurement() float [source]
Returns the measurement of the process variable used by the PIDController.
- Returns:
The measurement of the process variable.
- getSetpoint() float [source]
Returns the current setpoint of the subsystem.
- Returns:
The current setpoint.
- isEnabled() bool [source]
Returns whether the controller is enabled.
- Returns:
Whether the controller is enabled.
- periodic()[source]
Executes the PID control logic during each periodic update.
This method is called synchronously from the subsystem’s periodic() method.