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

Computes the linearization of a system dynamics function through numerical finite differencing. More...

#include <DynamicsLinearizerNumDiff.h>

Public Types

typedef ControlVector< CONTROL_DIM, SCALARcontrol_vector_t
 control vector type More...
 
typedef StateMatrix< STATE_DIM, SCALARstate_matrix_t
 state Jacobian type (A) More...
 
typedef StateControlMatrix< STATE_DIM, CONTROL_DIM, SCALARstate_control_matrix_t
 control Jacobian type (B) More...
 
typedef std::function< void(const state_vector_t &, const TIME &, const control_vector_t &, state_vector_t &)> dynamics_fct_t
 dynamics function signature More...
 

Public Member Functions

 DynamicsLinearizerNumDiff (dynamics_fct_t dyn, bool doubleSidedDerivative=true)
 default constructor More...
 
 DynamicsLinearizerNumDiff (const DynamicsLinearizerNumDiff &rhs)
 copy constructor More...
 
const state_matrix_tgetDerivativeState (const state_vector_t &x, const control_vector_t &u, const TIME t=TIME(0))
 get the Jacobian with respect to the state More...
 
const state_control_matrix_tgetDerivativeControl (const state_vector_t &x, const control_vector_t &u, const TIME t=TIME(0))
 get the Jacobian with respect to the input More...
 
bool getDoubleSidedDerivativeFlag () const
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef StateVector< STATE_DIM, SCALARstate_vector_t
 state vector type More...
 

Protected Attributes

dynamics_fct_t dynamics_fct_
 function handle to system dynamics More...
 
bool doubleSidedDerivative_
 flag if double sided numerical differentiation should be used More...
 
SCALAR eps_
 perturbation for numerical differentiation More...
 
state_matrix_t dFdx_
 Jacobian wrt state. More...
 
state_control_matrix_t dFdu_
 Jacobian wrt input. More...
 
state_vector_t res_ref_
 reference result for numerical differentiation More...
 

Detailed Description

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

Computes the linearization of a system dynamics function through numerical finite differencing.

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 $.

Finite differencing is used to calculate partial derivatives

\[ \begin{aligned} A &= \frac{df}{dx} |_{x=x_s, u=u_s} \\ B &= \frac{df}{du} |_{x=x_s, u=u_s} \end{aligned} \]

Member Typedef Documentation

◆ control_vector_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef ControlVector<CONTROL_DIM, SCALAR> ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::control_vector_t

control vector type

◆ state_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef StateMatrix<STATE_DIM, SCALAR> ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::state_matrix_t

state Jacobian type (A)

◆ state_control_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef StateControlMatrix<STATE_DIM, CONTROL_DIM, SCALAR> ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::state_control_matrix_t

control Jacobian type (B)

◆ dynamics_fct_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
typedef std::function<void(const state_vector_t&, const TIME&, const control_vector_t&, state_vector_t&)> ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::dynamics_fct_t

dynamics function signature

Constructor & Destructor Documentation

◆ DynamicsLinearizerNumDiff() [1/2]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::DynamicsLinearizerNumDiff ( dynamics_fct_t  dyn,
bool  doubleSidedDerivative = true 
)
inline

default constructor

Initializes the linearizer with a dynamics function object

Parameters
nonlinearSystemnon-linear system to linearize
doubleSidedDerivativeif true, double sided numerical differentiation is used

◆ DynamicsLinearizerNumDiff() [2/2]

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::DynamicsLinearizerNumDiff ( const DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME > &  rhs)
inline

copy constructor

Member Function Documentation

◆ getDerivativeState()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
const state_matrix_t& ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::getDerivativeState ( const state_vector_t x,
const control_vector_t u,
const TIME  t = TIME(0) 
)
inline

get the Jacobian with respect to the state

This computes the linearization of the dynamics with respect to the state at a given point $ x=x_s $, $ u=u_s $, i.e. it computes

\[ B = \frac{df}{dx} |_{x=x_s, u=u_s} \]

Parameters
xstate to linearize at
ucontrol to linearize at
ttime
Returns
Jacobian wrt state

Referenced by ct::core::DiscreteSystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::getAandB(), ct::core::DiscreteSystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::getDerivativeState(), and ct::core::SystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::getDerivativeState().

◆ getDerivativeControl()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
const state_control_matrix_t& ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::getDerivativeControl ( const state_vector_t x,
const control_vector_t u,
const TIME  t = TIME(0) 
)
inline

get the Jacobian with respect to the input

This computes the linearization of the dynamics with respect to the input at a given point $ x=x_s $, $ u=u_s $, i.e. it computes

\[ B = \frac{df}{du} |_{x=x_s, u=u_s} \]

Parameters
xstate to linearize at
ucontrol to linearize at
ttime
Returns
Jacobian wrt input

Referenced by ct::core::DiscreteSystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::getAandB(), ct::core::DiscreteSystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::getDerivativeControl(), and ct::core::SystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >::getDerivativeControl().

◆ getDoubleSidedDerivativeFlag()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
bool ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::getDoubleSidedDerivativeFlag ( ) const
inline

Member Data Documentation

◆ state_vector_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef StateVector<STATE_DIM, SCALAR> ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::state_vector_t

state vector type

◆ dynamics_fct_

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
dynamics_fct_t ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::dynamics_fct_
protected

◆ doubleSidedDerivative_

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
bool ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::doubleSidedDerivative_
protected

◆ eps_

◆ dFdx_

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

◆ dFdu_

◆ res_ref_

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR, typename TIME>
state_vector_t ct::core::DynamicsLinearizerNumDiff< STATE_DIM, CONTROL_DIM, SCALAR, TIME >::res_ref_
protected

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