- 3.0.2 core module.
ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR > Class Template Referenceabstract

interface class for a general linear system or linearized system More...

#include <LinearSystem.h>

Inheritance diagram for ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >:
ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > ct::core::System< STATE_DIM, SCALAR > ct::core::SwitchedLinearSystem< STATE_DIM, CONTROL_DIM, SCALAR > ct::core::SystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR > ct::models::HyA::HyALinearizedForward ct::models::HyA::HyALinearizedReverse ct::models::HyQ::HyQBareModelLinearizedForward ct::models::HyQ::HyQBareModelLinearizedReverse ct::models::HyQ::HyQWithContactModelLinearizedForward ct::models::HyQ::HyQWithContactModelLinearizedReverse ct::models::InvertedPendulum::InvertedPendulumActDynLinearizedForward ct::models::QuadrotorLinear ct::optcon::example::DiehlSystemLinear ct::optcon::example::LinearizedSystem ct::optcon::example::LinearizedSystem ct::optcon::example::MIMOIntegratorLinear< state_dim, control_dim > ct::optcon::example::tpl::LinearOscillatorLinear< class > LinkedMasses

Public Types

typedef Base::time_t time_t
 
typedef StateVector< STATE_DIM, SCALARstate_vector_t
 state vector type More...
 
typedef ControlVector< CONTROL_DIM, SCALARcontrol_vector_t
 input vector type More...
 
typedef StateMatrix< STATE_DIM, SCALARstate_matrix_t
 state Jacobian type More...
 
typedef StateControlMatrix< STATE_DIM, CONTROL_DIM, SCALARstate_control_matrix_t
 input Jacobian type More...
 
- Public Types inherited from ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >
typedef std::shared_ptr< ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > > Ptr
 
typedef Base::time_t time_t
 
- Public Types inherited from ct::core::System< STATE_DIM, SCALAR >
typedef SCALAR time_t
 the type of the time variable More...
 

Public Member Functions

 LinearSystem (const ct::core::SYSTEM_TYPE &type=ct::core::SYSTEM_TYPE::GENERAL)
 default constructor More...
 
virtual ~LinearSystem ()
 destructor More...
 
virtual LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR > * clone () const override=0
 deep cloning 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_tgetDerivativeState (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_tgetDerivativeControl (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...
 
- Public Member Functions inherited from ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >
 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, SCALARgetLastControlAction ()
 
- Public Member Functions inherited from ct::core::System< STATE_DIM, SCALAR >
 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...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ControlledSystem< STATE_DIM, CONTROL_DIM, SCALARBase
 
- Public Attributes inherited from ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef System< STATE_DIM, SCALARBase
 
- Public Attributes inherited from ct::core::System< STATE_DIM, SCALAR >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef SCALAR S
 the scalar type More...
 

Additional Inherited Members

- Protected Attributes inherited from ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >
std::shared_ptr< Controller< STATE_DIM, CONTROL_DIM, SCALAR > > controller_
 the controller instance More...
 
ControlVector< CONTROL_DIM, SCALARcontrolAction_
 
- Protected Attributes inherited from ct::core::System< STATE_DIM, SCALAR >
SYSTEM_TYPE type_
 type of system More...
 

Detailed Description

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
class ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >

interface class for a general linear system or linearized system

Defines the interface for a linear system

Template Parameters
STATE_DIMsize of state vector
CONTROL_DIMsize of input vector

Member Typedef Documentation

◆ time_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef Base::time_t ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::time_t

◆ state_vector_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef StateVector<STATE_DIM, SCALAR> ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::state_vector_t

state vector type

◆ control_vector_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef ControlVector<CONTROL_DIM, SCALAR> ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::control_vector_t

input vector type

◆ state_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef StateMatrix<STATE_DIM, SCALAR> ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::state_matrix_t

state Jacobian type

◆ state_control_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
typedef StateControlMatrix<STATE_DIM, CONTROL_DIM, SCALAR> ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::state_control_matrix_t

input Jacobian type

Constructor & Destructor Documentation

◆ LinearSystem()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::LinearSystem ( const ct::core::SYSTEM_TYPE type = ct::core::SYSTEM_TYPE::GENERAL)
inline

default constructor

Parameters
typesystem type

◆ ~LinearSystem()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
virtual ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::~LinearSystem ( )
inlinevirtual

destructor

Member Function Documentation

◆ clone()

◆ computeControlledDynamics()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
virtual void ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::computeControlledDynamics ( const state_vector_t state,
const time_t t,
const control_vector_t control,
state_vector_t derivative 
)
inlineoverridevirtual

compute the system dynamics

This computes the system dynamics

\[ \dot{x} = Ax + Bu \]

Parameters
statecurrent state
tcurrent time
controlcontrol input
derivativestate derivative

◆ getDerivativeState()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
virtual const state_matrix_t& ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::getDerivativeState ( const state_vector_t x,
const control_vector_t u,
const time_t  t = time_t(0.0) 
)
pure virtual

get the A matrix of a linear system

Parameters
xstate vector (required for linearizing non-linear systems, ignored for pure linear system)
uinput vector (required for linearizing non-linear systems, ignored for pure linear system)
tcurrent time
Returns
A matrix

Implemented in ct::core::SystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::core::SwitchedLinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >.

Referenced by ct::core::LinearSystem< 2, 1 >::computeControlledDynamics(), and ct::core::LinearSystem< 2, 1 >::getDerivatives().

◆ getDerivativeControl()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
virtual const state_control_matrix_t& ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::getDerivativeControl ( const state_vector_t x,
const control_vector_t u,
const time_t  t = time_t(0.0) 
)
pure virtual

get the B matrix of a linear system

Parameters
xstate vector (required for linearizing non-linear systems, ignored for pure linear system)
uinput vector (required for linearizing non-linear systems, ignored for pure linear system)
tcurrent time
Returns
B matrix

Implemented in ct::core::SystemLinearizer< STATE_DIM, CONTROL_DIM, SCALAR >, and ct::core::SwitchedLinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >.

Referenced by ct::core::LinearSystem< 2, 1 >::computeControlledDynamics(), and ct::core::LinearSystem< 2, 1 >::getDerivatives().

◆ getDerivatives()

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
virtual void ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::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) 
)
inlinevirtual

Get both linear system matrices A and B in one call.

Motvation: For certain derived instances, it may be more efficient to compute A and B simulatenously. In that case, this method can be overloaded for maximum efficiency. As default case, it simply calls above methods independently.

Parameters
Amatrix A of linear system
Bmatrix B of linear system
xthe current state
uthe current input
tthe current time

Member Data Documentation

◆ Base

template<size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ControlledSystem<STATE_DIM, CONTROL_DIM, SCALAR> ct::core::LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >::Base

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