WPILibC++ 2024.1.1-beta-4
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
 
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< 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

◆ 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: