WPILibC++ 2024.3.2
frc::ImplicitModelFollower< States, Inputs > Class Template Reference

Contains the controller coefficients and logic for an implicit model follower. More...

#include <frc/controller/ImplicitModelFollower.h>

Public Types

using StateVector = Vectord< States >
 
using InputVector = Vectord< Inputs >
 

Public Member Functions

template<int Outputs>
 ImplicitModelFollower (const LinearSystem< States, Inputs, Outputs > &plant, const LinearSystem< States, Inputs, Outputs > &plantRef)
 Constructs a controller with the given coefficients and plant. More...
 
 ImplicitModelFollower (const Matrixd< States, States > &A, const Matrixd< States, Inputs > &B, const Matrixd< States, States > &Aref, const Matrixd< States, Inputs > &Bref)
 Constructs a controller with the given coefficients and plant. More...
 
const InputVectorU () const
 Returns the control input vector u. More...
 
double U (int i) const
 Returns an element of the control input vector u. More...
 
void Reset ()
 Resets the controller. More...
 
InputVector Calculate (const StateVector &x, const InputVector &u)
 Returns the next output of the controller. More...
 

Detailed Description

template<int States, int Inputs>
class frc::ImplicitModelFollower< States, Inputs >

Contains the controller coefficients and logic for an implicit model follower.

Implicit model following lets us design a feedback controller that erases the dynamics of our system and makes it behave like some other system. This can be used to make a drivetrain more controllable during teleop driving by making it behave like a slower or more benign drivetrain.

For more on the underlying math, read appendix B.3 in https://file.tavsys.net/control/controls-engineering-in-frc.pdf.

Template Parameters
StatesNumber of states.
InputsNumber of inputs.

Member Typedef Documentation

◆ InputVector

template<int States, int Inputs>
using frc::ImplicitModelFollower< States, Inputs >::InputVector = Vectord<Inputs>

◆ StateVector

template<int States, int Inputs>
using frc::ImplicitModelFollower< States, Inputs >::StateVector = Vectord<States>

Constructor & Destructor Documentation

◆ ImplicitModelFollower() [1/2]

template<int States, int Inputs>
template<int Outputs>
frc::ImplicitModelFollower< States, Inputs >::ImplicitModelFollower ( const LinearSystem< States, Inputs, Outputs > &  plant,
const LinearSystem< States, Inputs, Outputs > &  plantRef 
)
inline

Constructs a controller with the given coefficients and plant.

Parameters
plantThe plant being controlled.
plantRefThe plant whose dynamics should be followed.

◆ ImplicitModelFollower() [2/2]

template<int States, int Inputs>
frc::ImplicitModelFollower< States, Inputs >::ImplicitModelFollower ( const Matrixd< States, States > &  A,
const Matrixd< States, Inputs > &  B,
const Matrixd< States, States > &  Aref,
const Matrixd< States, Inputs > &  Bref 
)
inline

Constructs a controller with the given coefficients and plant.

Parameters
AContinuous system matrix of the plant being controlled.
BContinuous input matrix of the plant being controlled.
ArefContinuous system matrix whose dynamics should be followed.
BrefContinuous input matrix whose dynamics should be followed.

Member Function Documentation

◆ Calculate()

template<int States, int Inputs>
InputVector frc::ImplicitModelFollower< States, Inputs >::Calculate ( const StateVector x,
const InputVector u 
)
inline

Returns the next output of the controller.

Parameters
xThe current state x.
uThe current input for the original model.

◆ Reset()

template<int States, int Inputs>
void frc::ImplicitModelFollower< States, Inputs >::Reset ( )
inline

Resets the controller.

◆ U() [1/2]

template<int States, int Inputs>
const InputVector & frc::ImplicitModelFollower< States, Inputs >::U ( ) const
inline

Returns the control input vector u.

Returns
The control input.

◆ U() [2/2]

template<int States, int Inputs>
double frc::ImplicitModelFollower< States, Inputs >::U ( int  i) const
inline

Returns an element of the control input vector u.

Parameters
iRow of u.
Returns
The row of the control input vector.

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