A plant defined using state-space notation.
More...
#include <frc/system/LinearSystem.h>
|
| constexpr | LinearSystem (const Matrixd< States, States > &A, const Matrixd< States, Inputs > &B, const Matrixd< Outputs, States > &C, const Matrixd< Outputs, Inputs > &D) |
| | Constructs a discrete plant with the given continuous system coefficients.
|
| |
| constexpr | LinearSystem (const LinearSystem &)=default |
| |
| constexpr LinearSystem & | operator= (const LinearSystem &)=default |
| |
| constexpr | LinearSystem (LinearSystem &&)=default |
| |
| constexpr LinearSystem & | operator= (LinearSystem &&)=default |
| |
| constexpr const Matrixd< States, States > & | A () const |
| | Returns the system matrix A.
|
| |
| constexpr double | A (int i, int j) const |
| | Returns an element of the system matrix A.
|
| |
| constexpr const Matrixd< States, Inputs > & | B () const |
| | Returns the input matrix B.
|
| |
| constexpr double | B (int i, int j) const |
| | Returns an element of the input matrix B.
|
| |
| constexpr const Matrixd< Outputs, States > & | C () const |
| | Returns the output matrix C.
|
| |
| constexpr double | C (int i, int j) const |
| | Returns an element of the output matrix C.
|
| |
| constexpr const Matrixd< Outputs, Inputs > & | D () const |
| | Returns the feedthrough matrix D.
|
| |
| constexpr double | D (int i, int j) const |
| | Returns an element of the feedthrough matrix D.
|
| |
| StateVector | CalculateX (const StateVector &x, const InputVector &clampedU, units::second_t dt) const |
| | Computes the new x given the old x and the control input.
|
| |
| OutputVector | CalculateY (const StateVector &x, const InputVector &clampedU) const |
| | Computes the new y given the control input.
|
| |
| template<std::same_as< int >... OutputIndices> |
| LinearSystem< States, Inputs, sizeof...(OutputIndices)> | Slice (OutputIndices... outputIndices) |
| | Returns the LinearSystem with the outputs listed in outputIndices.
|
| |
template<int States, int Inputs, int Outputs>
class frc::LinearSystem< States, Inputs, Outputs >
A plant defined using state-space notation.
A plant is a mathematical model of a system's dynamics.
For more on the underlying math, read https://file.tavsys.net/control/controls-engineering-in-frc.pdf.
- Template Parameters
-
| States | Number of states. |
| Inputs | Number of inputs. |
| Outputs | Number of outputs. |
◆ InputVector
template<int States, int Inputs, int Outputs>
◆ OutputVector
template<int States, int Inputs, int Outputs>
◆ StateVector
template<int States, int Inputs, int Outputs>
◆ LinearSystem() [1/3]
template<int States, int Inputs, int Outputs>
Constructs a discrete plant with the given continuous system coefficients.
- Parameters
-
| A | System matrix. |
| B | Input matrix. |
| C | Output matrix. |
| D | Feedthrough matrix. |
- Throws:
- std::domain_error if any matrix element isn't finite.
◆ LinearSystem() [2/3]
template<int States, int Inputs, int Outputs>
◆ LinearSystem() [3/3]
template<int States, int Inputs, int Outputs>
◆ A() [1/2]
template<int States, int Inputs, int Outputs>
Returns the system matrix A.
◆ A() [2/2]
template<int States, int Inputs, int Outputs>
Returns an element of the system matrix A.
- Parameters
-
◆ B() [1/2]
template<int States, int Inputs, int Outputs>
Returns the input matrix B.
◆ B() [2/2]
template<int States, int Inputs, int Outputs>
Returns an element of the input matrix B.
- Parameters
-
◆ C() [1/2]
template<int States, int Inputs, int Outputs>
Returns the output matrix C.
◆ C() [2/2]
template<int States, int Inputs, int Outputs>
Returns an element of the output matrix C.
- Parameters
-
◆ CalculateX()
template<int States, int Inputs, int Outputs>
Computes the new x given the old x and the control input.
This is used by state observers directly to run updates based on state estimate.
- Parameters
-
| x | The current state. |
| clampedU | The control input. |
| dt | Timestep for model update. |
◆ CalculateY()
template<int States, int Inputs, int Outputs>
Computes the new y given the control input.
This is used by state observers directly to run updates based on state estimate.
- Parameters
-
| x | The current state. |
| clampedU | The control input. |
◆ D() [1/2]
template<int States, int Inputs, int Outputs>
Returns the feedthrough matrix D.
◆ D() [2/2]
template<int States, int Inputs, int Outputs>
Returns an element of the feedthrough matrix D.
- Parameters
-
◆ operator=() [1/2]
template<int States, int Inputs, int Outputs>
◆ operator=() [2/2]
template<int States, int Inputs, int Outputs>
◆ Slice()
template<int States, int Inputs, int Outputs>
template<std::same_as< int >... OutputIndices>
Returns the LinearSystem with the outputs listed in outputIndices.
This is used by state observers such as the Kalman Filter.
- Parameters
-
| outputIndices | the list of output indices to include in the sliced system. |
- Returns
- the sliced LinearSystem with outputs set to row vectors of LinearSystem.
- Throws:
- std::domain_error if any outputIndices are outside the range of system outputs.
- Throws:
- std::domain_error if number of outputIndices exceeds the system outputs.
- Throws:
- std::domain_error if duplication exists in outputIndices.
The documentation for this class was generated from the following file: