WPILibC++ 2024.3.2
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< Command, 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, Requirements 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, Requirements 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, Requirements 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, Requirements 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< Command, ProfiledPIDCommand< Distance > >
 CommandHelper ()=default
 
CommandPtr ToPtr () &&override
 

Protected Attributes

frc::ProfiledPIDController< Distance > m_controller
 Profiled PID controller. More...
 
std::function< Distance_t()> m_measurement
 Measurement getter. More...
 
std::function< State()> m_goal
 Goal getter. More...
 
std::function< void(double, State)> m_useOutput
 Profiled PID controller output consumer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from frc2::CommandHelper< Command, 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/6]

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,
Requirements  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/6]

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,
Requirements  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/6]

template<class Distance >
frc2::ProfiledPIDCommand< Distance >::ProfiledPIDCommand ( frc::ProfiledPIDController< Distance >  controller,
std::function< Distance_t()>  measurementSource,
State  goal,
std::function< void(double, State)>  useOutput,
Requirements  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() [4/6]

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,
Requirements  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() [5/6]

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

◆ ProfiledPIDCommand() [6/6]

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

Profiled PID controller.

◆ m_goal

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

Goal getter.

◆ m_measurement

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

Measurement getter.

◆ m_useOutput

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

Profiled PID controller output consumer.


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