50 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR =
double>
54 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
58 typedef typename Base::time_t
time_t;
75 SystemLinearizer(std::shared_ptr<system_t> nonlinearSystem,
bool doubleSidedDerivative =
true)
76 : Base(nonlinearSystem->
getType()),
80 std::placeholders::_1,
81 std::placeholders::_2,
82 std::placeholders::_3,
83 std::placeholders::_4),
84 doubleSidedDerivative)
86 if (nonlinearSystem ==
nullptr)
87 throw std::runtime_error(
"SystemLinearizer: Nonlinear system is nullptr!");
104 std::placeholders::_1,
105 std::placeholders::_2,
106 std::placeholders::_3,
107 std::placeholders::_4),
138 const control_vector_t& u,
139 const time_t t = 0.0)
override 145 dFdx_.template topLeftCorner<STATE_DIM / 2, STATE_DIM / 2>().setZero();
146 dFdx_.template topRightCorner<STATE_DIM / 2, STATE_DIM / 2>().setIdentity();
168 const control_vector_t& u,
169 const time_t t = 0.0)
override 175 dFdu_.template topRows<STATE_DIM / 2>().setZero();
SystemLinearizer(std::shared_ptr< system_t > nonlinearSystem, bool doubleSidedDerivative=true)
default constructor
Definition: SystemLinearizer.h:75
interface class for a general linear system or linearized system
Definition: LinearSystem.h:23
SystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR > * clone() const override
deep cloning
Definition: SystemLinearizer.h:118
SystemLinearizer(const SystemLinearizer &arg)
copy constructor
Definition: SystemLinearizer.h:99
Base::time_t time_t
Time type as defined in System.
Definition: SystemLinearizer.h:58
ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > system_t
type of system to be linearized
Definition: SystemLinearizer.h:65
bool isSecondOrderSystem_
flag if system is a second order system
Definition: SystemLinearizer.h:191
virtual const state_control_matrix_t & getDerivativeControl(const state_vector_t &x, const control_vector_t &u, const time_t t=0.0) override
get the Jacobian with respect to the input
Definition: SystemLinearizer.h:167
clear all close all load ct GNMSLog0 mat reformat t
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR > Base
Base class type.
Definition: SystemLinearizer.h:56
virtual const state_matrix_t & getDerivativeState(const state_vector_t &x, const control_vector_t &u, const time_t t=0.0) override
get the Jacobian with respect to the state
Definition: SystemLinearizer.h:137
a pure second-order system
Definition: System.h:18
SYSTEM_TYPE getType() const
get the type of system
Definition: System.h:75
state_matrix_t dFdx_
Jacobian wrt state.
Definition: SystemLinearizer.h:188
virtual void computeControlledDynamics(const state_vector_t &state, const time_t &t, const control_vector_t &control, state_vector_t &derivative) override
compute the system dynamics
Definition: LinearSystem.h:63
const state_control_matrix_t & getDerivativeControl(const state_vector_t &x, const control_vector_t &u, const TIME t=TIME(0))
get the Jacobian with respect to the input
Definition: DynamicsLinearizerNumDiff.h:137
Base::control_vector_t control_vector_t
input vector type
Definition: SystemLinearizer.h:61
DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, SCALAR > linearizer_
instance of numerical-linearizer
Definition: SystemLinearizer.h:186
const state_matrix_t & getDerivativeState(const state_vector_t &x, const control_vector_t &u, const TIME t=TIME(0))
get the Jacobian with respect to the state
Definition: DynamicsLinearizerNumDiff.h:82
Base::state_vector_t state_vector_t
state vector type
Definition: SystemLinearizer.h:60
virtual ~SystemLinearizer()
destructor
Definition: SystemLinearizer.h:116
std::shared_ptr< system_t > nonlinearSystem_
instance of non-linear system
Definition: SystemLinearizer.h:183
Base::state_control_matrix_t state_control_matrix_t
input Jacobian type
Definition: SystemLinearizer.h:63
state_control_matrix_t dFdu_
Jacobian wrt input.
Definition: SystemLinearizer.h:189
Computes the linearization of a general non-linear ControlledSystem using numerical differentiation...
Definition: SystemLinearizer.h:51
Base::state_matrix_t state_matrix_t
state Jacobian type
Definition: SystemLinearizer.h:62
A general, non-linear dynamic system with a control input.
Definition: ControlledSystem.h:46