WPILibC++ 2023.4.3-108-ge5452e3
frc2::ProfiledPIDCommand< Distance > Class Template Reference

A command that controls an output with a ProfiledPIDController. More...

#include <frc2/command/ProfiledPIDCommand.h>

Inheritance diagram for frc2::ProfiledPIDCommand< Distance >:
frc2::CommandHelper< CommandBase, ProfiledPIDCommand< Distance > >

Public Member Functions

 ProfiledPIDCommand (frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< State()> goalSource, std::function< void(double, State)> useOutput, std::initializer_list< Subsystem * > requirements)
 Creates a new PIDCommand, which controls the given output with a ProfiledPIDController. More...
 
 ProfiledPIDCommand (frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< State()> goalSource, std::function< void(double, State)> useOutput, std::span< Subsystem *const > requirements={})
 Creates a new PIDCommand, which controls the given output with a ProfiledPIDController. More...
 
 ProfiledPIDCommand (frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< Distance_t()> goalSource, std::function< void(double, State)> useOutput, std::initializer_list< Subsystem * > requirements)
 Creates a new PIDCommand, which controls the given output with a ProfiledPIDController. More...
 
 ProfiledPIDCommand (frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, std::function< Distance_t()> goalSource, std::function< void(double, State)> useOutput, std::span< Subsystem *const > requirements={})
 Creates a new PIDCommand, which controls the given output with a ProfiledPIDController. More...
 
 ProfiledPIDCommand (frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, State goal, std::function< void(double, State)> useOutput, std::initializer_list< Subsystem * > requirements)
 Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constant goal. More...
 
 ProfiledPIDCommand (frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, State goal, std::function< void(double, State)> useOutput, std::span< Subsystem *const > requirements={})
 Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constant goal. More...
 
 ProfiledPIDCommand (frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, Distance_t goal, std::function< void(double, State)> useOutput, std::initializer_list< Subsystem * > requirements)
 Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constant goal. More...
 
 ProfiledPIDCommand (frc::ProfiledPIDController< Distance > controller, std::function< Distance_t()> measurementSource, Distance_t goal, std::function< void(double, State)> useOutput, std::span< Subsystem *const > requirements={})
 Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constant goal. More...
 
 ProfiledPIDCommand (ProfiledPIDCommand &&other)=default
 
 ProfiledPIDCommand (const ProfiledPIDCommand &other)=default
 
void Initialize () override
 
void Execute () override
 
void End (bool interrupted) override
 
frc::ProfiledPIDController< Distance > & GetController ()
 Returns the ProfiledPIDController used by the command. More...
 
- Public Member Functions inherited from frc2::CommandHelper< CommandBase, ProfiledPIDCommand< Distance > >
 CommandHelper ()=default
 
CommandPtr ToPtr () &&override
 

Protected Attributes

frc::ProfiledPIDController< Distance > m_controller
 
std::function< Distance_t()> m_measurement
 
std::function< State()> m_goal
 
std::function< void(double, State)> m_useOutput
 

Additional Inherited Members

- Protected Member Functions inherited from frc2::CommandHelper< CommandBase, ProfiledPIDCommand< Distance > >
std::unique_ptr< CommandTransferOwnership () &&override
 

Detailed Description

template<class Distance>
class frc2::ProfiledPIDCommand< Distance >

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.

This class is provided by the NewCommands VendorDep

See also
ProfiledPIDController<Distance>

Constructor & Destructor Documentation

◆ ProfiledPIDCommand() [1/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( frc::ProfiledPIDController< Distance >  controller,
std::function< Distance_t()>  measurementSource,
std::function< State()>  goalSource,
std::function< void(double, State)>  useOutput,
std::initializer_list< Subsystem * >  requirements 
)
inline

Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.

Parameters
controllerthe controller that controls the output.
measurementSourcethe measurement of the process variable
goalSourcethe controller's goal
useOutputthe controller's output
requirementsthe subsystems required by this command

◆ ProfiledPIDCommand() [2/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( frc::ProfiledPIDController< Distance >  controller,
std::function< Distance_t()>  measurementSource,
std::function< State()>  goalSource,
std::function< void(double, State)>  useOutput,
std::span< Subsystem *const >  requirements = {} 
)
inline

Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.

Parameters
controllerthe controller that controls the output.
measurementSourcethe measurement of the process variable
goalSourcethe controller's goal
useOutputthe controller's output
requirementsthe subsystems required by this command

◆ ProfiledPIDCommand() [3/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( frc::ProfiledPIDController< Distance >  controller,
std::function< Distance_t()>  measurementSource,
std::function< Distance_t()>  goalSource,
std::function< void(double, State)>  useOutput,
std::initializer_list< Subsystem * >  requirements 
)
inline

Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.

Parameters
controllerthe controller that controls the output.
measurementSourcethe measurement of the process variable
goalSourcethe controller's goal
useOutputthe controller's output
requirementsthe subsystems required by this command

◆ ProfiledPIDCommand() [4/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( frc::ProfiledPIDController< Distance >  controller,
std::function< Distance_t()>  measurementSource,
std::function< Distance_t()>  goalSource,
std::function< void(double, State)>  useOutput,
std::span< Subsystem *const >  requirements = {} 
)
inline

Creates a new PIDCommand, which controls the given output with a ProfiledPIDController.

Parameters
controllerthe controller that controls the output.
measurementSourcethe measurement of the process variable
goalSourcethe controller's goal
useOutputthe controller's output
requirementsthe subsystems required by this command

◆ ProfiledPIDCommand() [5/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( frc::ProfiledPIDController< Distance >  controller,
std::function< Distance_t()>  measurementSource,
State  goal,
std::function< void(double, State)>  useOutput,
std::initializer_list< Subsystem * >  requirements 
)
inline

Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constant goal.

Parameters
controllerthe controller that controls the output.
measurementSourcethe measurement of the process variable
goalthe controller's goal
useOutputthe controller's output
requirementsthe subsystems required by this command

◆ ProfiledPIDCommand() [6/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( frc::ProfiledPIDController< Distance >  controller,
std::function< Distance_t()>  measurementSource,
State  goal,
std::function< void(double, State)>  useOutput,
std::span< Subsystem *const >  requirements = {} 
)
inline

Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constant goal.

Parameters
controllerthe controller that controls the output.
measurementSourcethe measurement of the process variable
goalthe controller's goal
useOutputthe controller's output
requirementsthe subsystems required by this command

◆ ProfiledPIDCommand() [7/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( frc::ProfiledPIDController< Distance >  controller,
std::function< Distance_t()>  measurementSource,
Distance_t  goal,
std::function< void(double, State)>  useOutput,
std::initializer_list< Subsystem * >  requirements 
)
inline

Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constant goal.

Parameters
controllerthe controller that controls the output.
measurementSourcethe measurement of the process variable
goalthe controller's goal
useOutputthe controller's output
requirementsthe subsystems required by this command

◆ ProfiledPIDCommand() [8/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( frc::ProfiledPIDController< Distance >  controller,
std::function< Distance_t()>  measurementSource,
Distance_t  goal,
std::function< void(double, State)>  useOutput,
std::span< Subsystem *const >  requirements = {} 
)
inline

Creates a new PIDCommand, which controls the given output with a ProfiledPIDController with a constant goal.

Parameters
controllerthe controller that controls the output.
measurementSourcethe measurement of the process variable
goalthe controller's goal
useOutputthe controller's output
requirementsthe subsystems required by this command

◆ ProfiledPIDCommand() [9/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( ProfiledPIDCommand< Distance > &&  other)
default

◆ ProfiledPIDCommand() [10/10]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( const ProfiledPIDCommand< Distance > &  other)
default

Member Function Documentation

◆ End()

template<class Distance >
void frc2::ProfiledPIDCommand< Distance >::End ( bool  interrupted)
inlineoverride

◆ Execute()

template<class Distance >
void frc2::ProfiledPIDCommand< Distance >::Execute ( )
inlineoverride

◆ GetController()

template<class Distance >
frc::ProfiledPIDController< Distance > & frc2::ProfiledPIDCommand< Distance >::GetController ( )
inline

Returns the ProfiledPIDController used by the command.

Returns
The ProfiledPIDController

◆ Initialize()

template<class Distance >
void frc2::ProfiledPIDCommand< Distance >::Initialize ( )
inlineoverride

Member Data Documentation

◆ m_controller

template<class Distance >
frc::ProfiledPIDController<Distance> frc2::ProfiledPIDCommand< Distance >::m_controller
protected

◆ m_goal

template<class Distance >
std::function<State()> frc2::ProfiledPIDCommand< Distance >::m_goal
protected

◆ m_measurement

template<class Distance >
std::function<Distance_t()> frc2::ProfiledPIDCommand< Distance >::m_measurement
protected

◆ m_useOutput

template<class Distance >
std::function<void(double, State)> frc2::ProfiledPIDCommand< Distance >::m_useOutput
protected

The documentation for this class was generated from the following file: