Drake
linear_system.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
8 
9 namespace drake {
10 namespace systems {
11 
41 template <typename T>
42 class LinearSystem : public AffineSystem<T> {
43  public:
45 
46 
47  LinearSystem(const Eigen::Ref<const Eigen::MatrixXd>& A,
58  const Eigen::Ref<const Eigen::MatrixXd>& B,
59  const Eigen::Ref<const Eigen::MatrixXd>& C,
60  const Eigen::Ref<const Eigen::MatrixXd>& D,
61  double time_period = 0.0);
62 
64  template <typename U>
65  explicit LinearSystem(const LinearSystem<U>&);
66 
72  static std::unique_ptr<LinearSystem<T>> MakeLinearSystem(
73  const Eigen::Ref<const VectorX<symbolic::Expression>>& dynamics,
74  const Eigen::Ref<const VectorX<symbolic::Expression>>& output,
75  const Eigen::Ref<const VectorX<symbolic::Variable>>& state_vars,
76  const Eigen::Ref<const VectorX<symbolic::Variable>>& input_vars,
77  double time_period = 0.0);
78 
79  protected:
86  const Eigen::Ref<const Eigen::MatrixXd>& A,
87  const Eigen::Ref<const Eigen::MatrixXd>& B,
88  const Eigen::Ref<const Eigen::MatrixXd>& C,
89  const Eigen::Ref<const Eigen::MatrixXd>& D,
90  double time_period);
91 };
92 
119 std::unique_ptr<LinearSystem<double>> Linearize(
120  const System<double>& system, const Context<double>& context,
121  double equilibrium_check_tolerance = 1e-6);
122 
125 Eigen::MatrixXd ControllabilityMatrix(const LinearSystem<double>& sys);
126 
129 bool IsControllable(const LinearSystem<double>& sys,
130  double threshold = Eigen::Default);
131 
134 Eigen::MatrixXd ObservabilityMatrix(const LinearSystem<double>& sys);
135 
138 bool IsObservable(const LinearSystem<double>& sys,
139  double threshold = Eigen::Default);
140 
141 } // namespace systems
142 } // namespace drake
Definition: automotive_demo.cc:88
const Eigen::MatrixXd & C() const
Definition: affine_system.h:181
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorX
A column vector of any size, templated on scalar type.
Definition: eigen_types.h:46
double time_period() const
Definition: affine_system.h:56
bool IsControllable(const LinearSystem< double > &sys, double threshold)
Returns true iff the controllability matrix is full row rank.
Definition: linear_system.cc:258
static std::unique_ptr< LinearSystem< T > > MakeLinearSystem(const Eigen::Ref< const VectorX< symbolic::Expression >> &dynamics, const Eigen::Ref< const VectorX< symbolic::Expression >> &output, const Eigen::Ref< const VectorX< symbolic::Variable >> &state_vars, const Eigen::Ref< const VectorX< symbolic::Variable >> &input_vars, double time_period=0.0)
Creates a unique pointer to LinearSystem<T> by decomposing dynamics and outputs using state_vars and ...
Definition: linear_system.cc:54
A discrete OR continuous linear system.
Definition: linear_system.h:42
const Eigen::MatrixXd & D() const
Definition: affine_system.h:182
const Eigen::MatrixXd & B() const
Definition: affine_system.h:179
Eigen::MatrixXd ObservabilityMatrix(const LinearSystem< double > &sys)
Returns the observability matrix: O = [ C; CA; ...; CA^{n-1} ].
Definition: linear_system.cc:266
Eigen::MatrixXd ControllabilityMatrix(const LinearSystem< double > &sys)
Returns the controllability matrix: R = [B, AB, ..., A^{n-1}B].
Definition: linear_system.cc:243
bool IsObservable(const LinearSystem< double > &sys, double threshold)
Returns true iff the observability matrix is full column rank.
Definition: linear_system.cc:281
const Eigen::MatrixXd & A() const
Definition: affine_system.h:178
Provides public header files of Drake&#39;s symbolic library.
Helper class to convert a System<U> into a System<T>, intended for internal use by the System framewo...
Definition: system_scalar_converter.h:35
#define DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Classname)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN deletes the special member functions for copy-construction, copy-assignment, move-construction, and move-assignment.
Definition: drake_copyable.h:35
LinearSystem(const LinearSystem &)=delete
std::unique_ptr< LinearSystem< double > > Linearize(const System< double > &system, const Context< double > &context, double equilibrium_check_tolerance)
Takes the first-order Taylor expansion of a System around a nominal operating point (defined by the C...
Definition: linear_system.cc:166
A discrete OR continuous affine system (with constant coefficients).
Definition: affine_system.h:133
Provides careful macros to selectively enable or disable the special member functions for copy-constr...