ProfiledPIDSubsystem

class commands2.ProfiledPIDSubsystem(*arg, **kwargs)[source]

Bases: Subsystem, Generic[TProfiledPIDController, TTrapezoidProfileState]

A subsystem that uses a wpimath.controller.ProfiledPIDController or wpimath.controller.ProfiledPIDControllerRadians to control an output. The controller is run synchronously from the subsystem’s periodic() method.

Creates a new Profiled PID Subsystem using the provided PID Controller

Parameters:
  • controller – the controller that controls the output

  • initial_position – the initial value of the process variable

disable()[source]

Disables the PID control. Sets output to zero.

enable()[source]

Enables the PID control. Resets the controller.

getController() TProfiledPIDController[source]

Returns the controller

getMeasurement() float[source]

Returns the measurement of the process variable used by the controller object.

isEnabled() bool[source]

Returns whether the controller is enabled.

periodic()[source]

Updates the output of the controller.

setGoal(goal)[source]

Sets the goal state for the subsystem.

useOutput(output: float, setpoint: TTrapezoidProfileState)[source]

Uses the output from the controller object.