- 3.0.1 core module.
ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME > Class Template Reference

Computes the linearization of a system dynamics function through autodiff. More...

#include <DynamicsLinearizerAD.h>

Inheritance diagram for ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >:
ct::core::internal::DynamicsLinearizerADBase< STATE_DIM, CONTROL_DIM, SCALAR, TIME >

Public Types

typedef Base::OUT_SCALAR OUT_SCALAR
 scalar type of resulting linear system More...
 
typedef Base::state_vector_t state_vector_t
 state vector type More...
 
typedef Base::control_vector_t control_vector_t
 control vector type More...
 
typedef Base::state_matrix_t state_matrix_t
 state Jacobian type (A) More...
 
typedef Base::state_control_matrix_t state_control_matrix_t
 control Jacobian type (B) More...
 
typedef Base::dynamics_fct_t dynamics_fct_t
 dynamics function signature More...
 
- Public Types inherited from ct::core::internal::DynamicsLinearizerADBase< STATE_DIM, CONTROL_DIM, SCALAR, TIME >
typedef std::conditional<(std::is_same< SCALAR, CppAD::AD< double >>::value)||(std::is_same< SCALAR, CppAD::AD< CppAD::cg::CG< double >>>::value), double, float >::type OUT_SCALAR
 scalar type of resulting linear system More...
 
typedef StateVector< STATE_DIM, OUT_SCALARstate_vector_t
 
typedef ControlVector< CONTROL_DIM, OUT_SCALARcontrol_vector_t
 
typedef StateVector< STATE_DIM, SCALARstate_vector_ad_t
 
typedef ControlVector< CONTROL_DIM, SCALARcontrol_vector_ad_t
 
typedef StateMatrix< STATE_DIM, OUT_SCALARstate_matrix_t
 
typedef StateControlMatrix< STATE_DIM, CONTROL_DIM, OUT_SCALARstate_control_matrix_t
 
typedef std::function< void(const state_vector_ad_t &, const TIME &, const control_vector_ad_t &, state_vector_ad_t &)> dynamics_fct_t
 dynamics function signature More...
 

Public Member Functions

 DynamicsLinearizerAD (dynamics_fct_t dyn)
 default constructor More...
 
 DynamicsLinearizerAD (const DynamicsLinearizerAD &rhs)
 copy constructor More...
 
const state_matrix_tgetDerivativeState (const state_vector_t &x, const control_vector_t &u, const TIME t=TIME(0))
 
const state_control_matrix_tgetDerivativeControl (const state_vector_t &x, const control_vector_t &u, const TIME t=TIME(0))
 
- Public Member Functions inherited from ct::core::internal::DynamicsLinearizerADBase< STATE_DIM, CONTROL_DIM, SCALAR, TIME >
 DynamicsLinearizerADBase (dynamics_fct_t dyn)
 default constructor More...
 
 DynamicsLinearizerADBase (const DynamicsLinearizerADBase &arg)
 copy constructor More...
 
template<typename T = std::string>
std::enable_if< std::is_same< OUT_SCALAR, double >::value, T >::type getOutScalarType () const
 
template<typename T = std::string>
std::enable_if< std::is_same< OUT_SCALAR, float >::value, T >::type getOutScalarType () const
 
virtual ~DynamicsLinearizerADBase ()
 destructor More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef internal::DynamicsLinearizerADBase< STATE_DIM, CONTROL_DIM, SCALAR, TIME > Base
 
- Public Attributes inherited from ct::core::internal::DynamicsLinearizerADBase< STATE_DIM, CONTROL_DIM, SCALAR, TIME >
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Protected Member Functions

void computeA (const state_vector_t &x, const control_vector_t &u)
 compute the state Jacobian More...
 
void computeB (const state_vector_t &x, const control_vector_t &u)
 compute the input Jacobian More...
 
- Protected Member Functions inherited from ct::core::internal::DynamicsLinearizerADBase< STATE_DIM, CONTROL_DIM, SCALAR, TIME >
void initialize ()
 initialize all utilities More...
 
void recordTerms ()
 record the model More...
 
void setupSparsityA ()
 setup the sparsity of the state Jacobian More...
 
void setupSparsityB ()
 setup the sparsity of the input Jacobian More...
 

Protected Attributes

dynamics_fct_t dynamics_fct_
 function handle to system dynamics More...
 
state_matrix_t dFdx_
 Jacobian wrt state. More...
 
state_control_matrix_t dFdu_
 Jacobian wrt input. More...
 
- Protected Attributes inherited from ct::core::internal::DynamicsLinearizerADBase< STATE_DIM, CONTROL_DIM, SCALAR, TIME >
const size_t A_entries = STATE_DIM * STATE_DIM
 number of entries in the state Jacobian More...
 
const size_t B_entries = STATE_DIM * CONTROL_DIM
 number of entries in the input Jacobian More...
 
const size_t FullJac_entries
 number of entries in the stacked Jacobian More...
 
dynamics_fct_t dynamics_fct_
 function handle to system dynamics More...
 
CppAD::ADFun< typename SCALAR::value_type > f_
 Auto-Diff function. More...
 
SparsityPattern sparsityA_
 sparsity pattern of the state Jacobian More...
 
SparsityPattern sparsityB_
 sparsity pattern of the input Jacobian More...
 

Detailed Description

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
class ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >

Computes the linearization of a system dynamics function through autodiff.

This class takes a function handle representing system dynamics of the form $ f(x(t),t,u(t),\dot{x(t)}) $ or $ f(x[n],n,u[n],x[n+1]) $ where the last argument is the result of the evaluation in each case. It then computes the linearization around a given point $ x = x_s $, $ u = u_s $.

Template Parameters
STATE_DIMdimension of state vector
CONTROL_DIMdimension of control vector
SCALARscalar type
TIMEtype of time variable of dynamics

Member Typedef Documentation

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef Base::OUT_SCALAR ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::OUT_SCALAR

scalar type of resulting linear system

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef Base::state_vector_t ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::state_vector_t

state vector type

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef Base::control_vector_t ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::control_vector_t

control vector type

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef Base::state_matrix_t ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::state_matrix_t

state Jacobian type (A)

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef Base::state_control_matrix_t ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::state_control_matrix_t

control Jacobian type (B)

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef Base::dynamics_fct_t ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::dynamics_fct_t

dynamics function signature

Constructor & Destructor Documentation

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::DynamicsLinearizerAD ( dynamics_fct_t  dyn)
inline

default constructor

Parameters
dynfunction handle to system dynamics
template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::DynamicsLinearizerAD ( const DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME > &  rhs)
inline

copy constructor

Member Function Documentation

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
const state_matrix_t& ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::getDerivativeState ( const state_vector_t x,
const control_vector_t u,
const TIME  t = TIME(0) 
)
inline
template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
const state_control_matrix_t& ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::getDerivativeControl ( const state_vector_t x,
const control_vector_t u,
const TIME  t = TIME(0) 
)
inline
template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
void ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::computeA ( const state_vector_t x,
const control_vector_t u 
)
inlineprotected

compute the state Jacobian

Parameters
xstate to linearize around
uinput to linearize around

Referenced by ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, ADScalar, int >::getDerivativeState().

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
void ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::computeB ( const state_vector_t x,
const control_vector_t u 
)
inlineprotected

compute the input Jacobian

Parameters
xstate to linearize around
uinput to linearize around

Referenced by ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, ADScalar, int >::getDerivativeControl().

Member Data Documentation

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef internal::DynamicsLinearizerADBase<STATE_DIM, CONTROL_DIM, SCALAR, TIME> ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::Base
template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
dynamics_fct_t ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::dynamics_fct_
protected

function handle to system dynamics

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
state_matrix_t ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::dFdx_
protected
template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
state_control_matrix_t ct::core::DynamicsLinearizerAD< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::dFdu_
protected

The documentation for this class was generated from the following file: