8 #pragma GCC diagnostic push 9 #pragma GCC diagnostic ignored "-Wunused-parameter" 10 #pragma GCC diagnostic ignored "-Wunused-value" 31 template <
size_t STATE_DIM,
size_t CONTROL_DIM>
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
45 LTISystem(
const Eigen::Matrix<double, STATE_DIM, STATE_DIM>&
A,
46 const Eigen::Matrix<double, STATE_DIM, CONTROL_DIM>&
B,
47 const Eigen::Matrix<double, STATE_DIM, STATE_DIM>&
C = Eigen::Matrix<double, STATE_DIM, STATE_DIM>::Identity(),
48 const Eigen::Matrix<double, STATE_DIM, CONTROL_DIM>
D = Eigen::Matrix<double, STATE_DIM, CONTROL_DIM>::Zero())
49 : A_(A), B_(B), C_(
C), D_(
D)
61 const double t = 0.0)
override 69 const double t = 0.0)
override 75 Eigen::Matrix<double, STATE_DIM, STATE_DIM>&
A() {
return A_; }
77 Eigen::Matrix<double, STATE_DIM, CONTROL_DIM>&
B() {
return B_; }
79 Eigen::Matrix<double, STATE_DIM, STATE_DIM>&
C() {
return C_; }
81 Eigen::Matrix<double, STATE_DIM, CONTROL_DIM>&
D() {
return D_; }
92 const Eigen::Matrix<double, CONTROL_DIM, 1>& control,
93 Eigen::Matrix<double, STATE_DIM, 1>& derivative)
95 derivative = A_ * state + B_ * control;
108 const Eigen::Matrix<double, CONTROL_DIM, 1>& control,
109 Eigen::Matrix<double, STATE_DIM, 1>& output)
111 output = C_ * state + D_ * control;
124 CO.block<STATE_DIM, CONTROL_DIM>(0, 0) = B_;
126 for (
size_t i = 1;
i < STATE_DIM;
i++)
128 CO.block<STATE_DIM, CONTROL_DIM>(0,
i * CONTROL_DIM) =
129 A_ * CO.block<STATE_DIM, CONTROL_DIM>(0, (
i - 1) * CONTROL_DIM);
141 Eigen::Matrix<double, STATE_DIM, STATE_DIM * CONTROL_DIM> CO;
144 Eigen::FullPivLU<Eigen::Matrix<double, STATE_DIM, STATE_DIM * CONTROL_DIM>> LUdecomposition(CO);
145 return LUdecomposition.rank() == STATE_DIM;
157 O.block<STATE_DIM, STATE_DIM>(0, 0) = C_;
159 for (
size_t i = 1;
i < STATE_DIM;
i++)
161 O.block<STATE_DIM, STATE_DIM>(
i * STATE_DIM, 0) =
162 O.block<STATE_DIM, STATE_DIM>(0, (
i - 1) * STATE_DIM) * A_;
174 Eigen::Matrix<double, STATE_DIM, STATE_DIM * STATE_DIM> O;
177 Eigen::FullPivLU<Eigen::Matrix<double, STATE_DIM, STATE_DIM * STATE_DIM>> LUdecomposition(O);
178 return LUdecomposition.rank() == STATE_DIM;
183 Eigen::Matrix<double, STATE_DIM, STATE_DIM> A_;
184 Eigen::Matrix<double, STATE_DIM, CONTROL_DIM> B_;
186 Eigen::Matrix<double, STATE_DIM, STATE_DIM> C_;
187 Eigen::Matrix<double, STATE_DIM, CONTROL_DIM> D_;
193 #pragma GCC diagnostic pop interface class for a general linear system or linearized system
Definition: LinearSystem.h:23
Linear time-invariant system.
Definition: LTISystem.h:32
bool isObservable()
checks if system is fully observable
Definition: LTISystem.h:172
void computeControllabilityMatrix(Eigen::Matrix< double, STATE_DIM, STATE_DIM *CONTROL_DIM > &CO)
computes the controllability matrix
Definition: LTISystem.h:122
LTISystem< STATE_DIM, CONTROL_DIM > * clone() const override
deep clone
Definition: LTISystem.h:56
LTISystem(const LTISystem &arg)
copy constructor
Definition: LTISystem.h:54
virtual const Eigen::Matrix< double, STATE_DIM, STATE_DIM > & getDerivativeState(const StateVector< STATE_DIM > &x, const ControlVector< CONTROL_DIM > &u, const double t=0.0) override
get A matrix
Definition: LTISystem.h:59
void computeControlledDynamics(const Eigen::Matrix< double, STATE_DIM, 1 > &state, const Time &t, const Eigen::Matrix< double, CONTROL_DIM, 1 > &control, Eigen::Matrix< double, STATE_DIM, 1 > &derivative)
computes the system dynamics
Definition: LTISystem.h:90
Eigen::Matrix< double, STATE_DIM, STATE_DIM > & A()
get A matrix
Definition: LTISystem.h:75
Eigen::Matrix< double, STATE_DIM, CONTROL_DIM > & D()
get D matrix
Definition: LTISystem.h:81
Definition: ControlVector.h:12
bool isControllable()
checks if system is fully controllable
Definition: LTISystem.h:139
virtual const Eigen::Matrix< double, STATE_DIM, CONTROL_DIM > & getDerivativeControl(const StateVector< STATE_DIM > &x, const ControlVector< CONTROL_DIM > &u, const double t=0.0) override
get B matrix
Definition: LTISystem.h:67
void computeObservabilityMatrix(Eigen::Matrix< double, STATE_DIM, STATE_DIM *STATE_DIM > &O)
computes the observability matrix
Definition: LTISystem.h:155
Eigen::Matrix< double, STATE_DIM, STATE_DIM > & C()
get C matrix
Definition: LTISystem.h:79
void computeOutput(const Eigen::Matrix< double, STATE_DIM, 1 > &state, const Time &t, const Eigen::Matrix< double, CONTROL_DIM, 1 > &control, Eigen::Matrix< double, STATE_DIM, 1 > &output)
computes the system output (measurement)
Definition: LTISystem.h:106
Eigen::Matrix< double, STATE_DIM, CONTROL_DIM > & B()
get B matrix
Definition: LTISystem.h:77
EIGEN_MAKE_ALIGNED_OPERATOR_NEW LTISystem(const Eigen::Matrix< double, STATE_DIM, STATE_DIM > &A, const Eigen::Matrix< double, STATE_DIM, CONTROL_DIM > &B, const Eigen::Matrix< double, STATE_DIM, STATE_DIM > &C=Eigen::Matrix< double, STATE_DIM, STATE_DIM >::Identity(), const Eigen::Matrix< double, STATE_DIM, CONTROL_DIM > D=Eigen::Matrix< double, STATE_DIM, CONTROL_DIM >::Zero())
Constructs a linear time invariant system.
Definition: LTISystem.h:45
virtual ~LTISystem()
Definition: LTISystem.h:57
double Time
Definition: Time.h:11