|
typedef CppAD::AD< SCALAR > | ADScalar |
|
typedef ControlledSystem< STATE_DIM, CONTROL_DIM, ADScalar > | system_t |
| type of system to be linearized More...
|
|
typedef DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, ADScalar, ADScalar > | linearizer_t |
| type of linearizer to be used More...
|
|
typedef Base::state_vector_t | state_vector_t |
| state vector type More...
|
|
typedef Base::control_vector_t | control_vector_t |
| input vector type More...
|
|
typedef Base::state_matrix_t | state_matrix_t |
| state Jacobian type More...
|
|
typedef Base::state_control_matrix_t | state_control_matrix_t |
| input Jacobian type More...
|
|
typedef Base::time_t | time_t |
|
typedef StateVector< STATE_DIM, SCALAR > | state_vector_t |
| state vector type More...
|
|
typedef ControlVector< CONTROL_DIM, SCALAR > | control_vector_t |
| input vector type More...
|
|
typedef StateMatrix< STATE_DIM, SCALAR > | state_matrix_t |
| state Jacobian type More...
|
|
typedef StateControlMatrix< STATE_DIM, CONTROL_DIM, SCALAR > | state_control_matrix_t |
| input Jacobian type More...
|
|
typedef std::shared_ptr< ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > > | Ptr |
|
typedef Base::time_t | time_t |
|
typedef SCALAR | time_t |
| the type of the time variable More...
|
|
|
| AutoDiffLinearizer (std::shared_ptr< system_t > nonlinearSystem) |
| default constructor More...
|
|
| AutoDiffLinearizer (const AutoDiffLinearizer &arg) |
| copy constructor More...
|
|
virtual | ~AutoDiffLinearizer () |
| destructor More...
|
|
AutoDiffLinearizer< STATE_DIM, CONTROL_DIM, SCALAR > * | clone () const override |
| deep cloning More...
|
|
virtual const state_matrix_t & | getDerivativeState (const state_vector_t &x, const control_vector_t &u, const SCALAR t=SCALAR(0.0)) override |
| get the Jacobian with respect to the state More...
|
|
virtual const state_control_matrix_t & | getDerivativeControl (const state_vector_t &x, const control_vector_t &u, const SCALAR t=SCALAR(0.0)) override |
| get the Jacobian with respect to the input More...
|
|
| LinearSystem (const ct::core::SYSTEM_TYPE &type=ct::core::SYSTEM_TYPE::GENERAL) |
| default constructor More...
|
|
virtual | ~LinearSystem () |
| destructor More...
|
|
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 More...
|
|
virtual const state_matrix_t & | getDerivativeState (const state_vector_t &x, const control_vector_t &u, const time_t t=time_t(0.0))=0 |
| get the A matrix of a linear system More...
|
|
virtual const state_control_matrix_t & | getDerivativeControl (const state_vector_t &x, const control_vector_t &u, const time_t t=time_t(0.0))=0 |
| get the B matrix of a linear system More...
|
|
virtual void | getDerivatives (state_matrix_t &A, state_control_matrix_t &B, const state_vector_t &x, const control_vector_t &u, const time_t t=time_t(0.0)) |
| Get both linear system matrices A and B in one call. More...
|
|
| ControlledSystem (const SYSTEM_TYPE &type=SYSTEM_TYPE::GENERAL) |
| default constructor More...
|
|
| ControlledSystem (std::shared_ptr< ct::core::Controller< STATE_DIM, CONTROL_DIM, SCALAR >> controller, const SYSTEM_TYPE &type=SYSTEM_TYPE::GENERAL) |
| constructor More...
|
|
| ControlledSystem (const ControlledSystem &arg) |
| copy constructor More...
|
|
virtual | ~ControlledSystem () |
| destructor More...
|
|
void | setController (const std::shared_ptr< Controller< STATE_DIM, CONTROL_DIM, SCALAR >> &controller) |
| set a new controller More...
|
|
void | getController (std::shared_ptr< Controller< STATE_DIM, CONTROL_DIM, SCALAR >> &controller) const |
| get the controller instance More...
|
|
std::shared_ptr< Controller< STATE_DIM, CONTROL_DIM, SCALAR > > | getController () |
| get the controller instace More...
|
|
virtual void | computeDynamics (const StateVector< STATE_DIM, SCALAR > &state, const time_t &t, StateVector< STATE_DIM, SCALAR > &derivative) override |
| compute the dynamics of the system More...
|
|
virtual void | computeControlledDynamics (const StateVector< STATE_DIM, SCALAR > &state, const time_t &t, const ControlVector< CONTROL_DIM, SCALAR > &control, StateVector< STATE_DIM, SCALAR > &derivative)=0 |
|
ControlVector< CONTROL_DIM, SCALAR > | getLastControlAction () |
|
| System (const SYSTEM_TYPE &type=SYSTEM_TYPE::GENERAL) |
| default constructor More...
|
|
| System (const System &other) |
| copy constructor More...
|
|
virtual | ~System () |
| destructor More...
|
|
virtual void | computeDynamics (const StateVector< STATE_DIM, SCALAR > &state, const time_t &t, StateVector< STATE_DIM, SCALAR > &derivative)=0 |
| computes the system dynamics More...
|
|
SYSTEM_TYPE | getType () const |
| get the type of system More...
|
|
virtual bool | isSymplectic () const |
| Determines if the system is in symplectic form. More...
|
|
template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
class ct::core::AutoDiffLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >
Computes the linearization of a general non-linear ControlledSystem using Automatic Differentiation (without code generation)
This class takes a non-linear ControlledSystem and computes the linearization around a certain point , .
where
- Note
- This is generally the most accurate way to generate the linearization of system dynamics together with ADCodegenLinearizer. However, the latter is much faster. Consider using the latter for production code.
Unit test AutoDiffLinearizerTest.cpp illustrates the use of the AutoDiffLinearizer.
- Warning
- You should ensure that your ControlledSystem is templated on the scalar type and does not contain branching (if/else statements, switch cases etc.)
-
This function still has some issues with pure time dependency
- Todo:
- Make time an Auto-Diff parameter
- Template Parameters
-
dimension | of state vector |
dimension | of control vector |
SCALAR | primitive type of resultant linear system |
- Examples:
- AutoDiffLinearizerTest.cpp.
template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
get the Jacobian with respect to the state
This computes the linearization of the system with respect to the state at a given point , , i.e. it computes
- Parameters
-
x | state to linearize at |
u | control to linearize at |
t | time |
- Returns
- Jacobian wrt state
References ct::core::AutoDiffLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::dFdx_, ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::getDerivativeState(), ct::core::AutoDiffLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::linearizer_, and t.
Referenced by TEST().
template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
get the Jacobian with respect to the input
This computes the linearization of the system with respect to the input at a given point , , i.e. it computes
- Parameters
-
x | state to linearize at |
u | control to linearize at |
t | time |
- Returns
- Jacobian wrt input
References ct::core::AutoDiffLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::dFdu_, ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::getDerivativeControl(), ct::core::AutoDiffLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::linearizer_, and t.
Referenced by TEST().