30template <
int States,
int Inputs,
int Outputs>
51 throw std::domain_error(
52 "Elements of A aren't finite. This is usually due to model "
53 "implementation errors.");
56 throw std::domain_error(
57 "Elements of B aren't finite. This is usually due to model "
58 "implementation errors.");
61 throw std::domain_error(
62 "Elements of C aren't finite. This is usually due to model "
63 "implementation errors.");
66 throw std::domain_error(
67 "Elements of D aren't finite. This is usually due to model "
68 "implementation errors.");
93 double A(
int i,
int j)
const {
return m_A(i, j); }
106 double B(
int i,
int j)
const {
return m_B(i, j); }
119 double C(
int i,
int j)
const {
return m_C(i, j); }
132 double D(
int i,
int j)
const {
return m_D(i, j); }
145 units::second_t dt)
const {
148 DiscretizeAB<States, Inputs>(m_A, m_B, dt, &discA, &discB);
150 return discA * x + discB * clampedU;
164 return m_C * x + m_D * clampedU;
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:180
A plant defined using state-space notation.
Definition: LinearSystem.h:31
const Matrixd< States, Inputs > & B() const
Returns the input matrix B.
Definition: LinearSystem.h:98
LinearSystem & operator=(const LinearSystem &)=default
double D(int i, int j) const
Returns an element of the feedthrough matrix D.
Definition: LinearSystem.h:132
double B(int i, int j) const
Returns an element of the input matrix B.
Definition: LinearSystem.h:106
double A(int i, int j) const
Returns an element of the system matrix A.
Definition: LinearSystem.h:93
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.
Definition: LinearSystem.h:144
const Matrixd< States, States > & A() const
Returns the system matrix A.
Definition: LinearSystem.h:85
Vectord< Outputs > OutputVector
Definition: LinearSystem.h:35
LinearSystem(LinearSystem &&)=default
LinearSystem & operator=(LinearSystem &&)=default
const Matrixd< Outputs, Inputs > & D() const
Returns the feedthrough matrix D.
Definition: LinearSystem.h:124
OutputVector CalculateY(const StateVector &x, const InputVector &clampedU) const
Computes the new y given the control input.
Definition: LinearSystem.h:162
Vectord< States > StateVector
Definition: LinearSystem.h:33
const Matrixd< Outputs, States > & C() const
Returns the output matrix C.
Definition: LinearSystem.h:111
double C(int i, int j) const
Returns an element of the output matrix C.
Definition: LinearSystem.h:119
LinearSystem(const LinearSystem &)=default
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.
Definition: LinearSystem.h:46
Vectord< Inputs > InputVector
Definition: LinearSystem.h:34
Definition: AprilTagPoseEstimator.h:15
Eigen::Vector< double, Size > Vectord
Definition: EigenCore.h:12