ProfiledPIDCommand

class commands2.ProfiledPIDCommand(*args, **kwargs)[source]

Bases: Command, Generic[TProfiledPIDController]

A command that controls an output with a ProfiledPIDController. Runs forever by default - to add exit conditions and/or other behavior, subclass this class. The controller calculation and output are performed synchronously in the command’s execute() method.

Creates a new ProfiledPIDCommand, which controls the given output with a ProfiledPIDController. Goal velocity is specified.

Parameters:
  • controller – the controller that controls the output.

  • measurementSource – the measurement of the process variable

  • goalSource – the controller’s goal

  • useOutput – the controller’s output

  • requirements – the subsystems required by this command

end(interrupted: bool)[source]

The action to take when the command ends. Called when either the command finishes normally, or when it interrupted/canceled.

Do not schedule commands here that share requirements with this command. Use andThen() instead.

Parameters:

interrupted – whether the command was interrupted/canceled

execute()[source]

The main body of a command. Called repeatedly while the command is scheduled.

getController()[source]

Gets the controller used by the command

initialize()[source]

The initial subroutine of a command. Called once when the command is initially scheduled.