Discretize a general, continuous-time non-linear dynamic system using forward integration.
More...
|
| typedef DiscreteControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > | Base |
| |
| typedef Base::time_t | time_t |
| |
| using | IntegratorPtr = std::shared_ptr< Integrator< STATE_DIM, SCALAR > > |
| |
| using | IntegratorSymplecticEulerPtr = std::shared_ptr< ct::core::IntegratorSymplecticEuler< P_DIM, V_DIM, CONTROL_DIM, SCALAR > > |
| |
| using | IntegratorSymplecticRkPtr = std::shared_ptr< ct::core::IntegratorSymplecticRk< P_DIM, V_DIM, CONTROL_DIM, SCALAR > > |
| |
| using | ContinuousSystemPtr = std::shared_ptr< ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > > |
| |
| using | ContinuousConstantControllerPtr = std::shared_ptr< ConstantController< STATE_DIM, CONTROL_DIM, SCALAR > > |
| |
| using | SubstepRecorderPtr = std::shared_ptr< ct::core::SubstepRecorder< STATE_DIM, CONTROL_DIM, SCALAR > > |
| |
| using | StateVectorArray = ct::core::StateVectorArray< STATE_DIM, SCALAR > |
| |
| using | StateVectorArrayPtr = std::shared_ptr< StateVectorArray > |
| |
| using | ControlVectorArray = ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > |
| |
| using | ControlVectorArrayPtr = std::shared_ptr< ControlVectorArray > |
| |
| typedef DiscreteSystem< STATE_DIM, CONTROL_DIM, SCALAR > | Base |
| |
| typedef Base::state_vector_t | state_vector_t |
| |
| typedef Base::control_vector_t | control_vector_t |
| |
| typedef Base::time_t | time_t |
| |
| typedef int | time_t |
| | the type of the time variable More...
|
| |
| typedef StateVector< STATE_DIM, SCALAR > | state_vector_t |
| |
| typedef ControlVector< CONTROL_DIM, SCALAR > | control_vector_t |
| |
|
| | SystemDiscretizer () |
| | default constructor More...
|
| |
| | SystemDiscretizer (const SCALAR &dt, const ct::core::IntegrationType &integratorType=ct::core::IntegrationType::RK4, const int &K_sim=1) |
| | constructor with parameters More...
|
| |
| | SystemDiscretizer (ContinuousSystemPtr system, const SCALAR &dt, const ct::core::IntegrationType &integratorType=ct::core::IntegrationType::RK4, const int &K_sim=1) |
| | constructor with parameters and nonlinear continuous-time system More...
|
| |
| | SystemDiscretizer (const SystemDiscretizer &arg) |
| | copy constructor More...
|
| |
| virtual | ~SystemDiscretizer () |
| | destructor More...
|
| |
| virtual SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR > * | clone () const override |
| | deep cloning More...
|
| |
| void | initialize () |
| | initialize class More...
|
| |
| void | setIntegrationType (const ct::core::IntegrationType &integratorType) |
| | update integration type More...
|
| |
| void | setParameters (const SCALAR &dt, const int &K_sim=1) |
| | update parameters More...
|
| |
| void | changeContinuousTimeSystem (ContinuousSystemPtr newSystem) |
| | update the SystemDiscretizer with a new nonlinear, continuous-time system More...
|
| |
| virtual void | propagateControlledDynamics (const StateVector< STATE_DIM, SCALAR > &state, const time_t n, const ControlVector< CONTROL_DIM, SCALAR > &control, StateVector< STATE_DIM, SCALAR > &stateNext) override |
| | propagate discrete-time dynamics by performing a numerical forward integration of the continuous-time system More...
|
| |
| const StateVectorArrayPtr & | getSubstates () const |
| | return a pointer to the substates recorded during integration More...
|
| |
| const ControlVectorArrayPtr & | getSubcontrols () const |
| | reuturn a pointer to the subcontrols recorded during integration More...
|
| |
| | DiscreteControlledSystem (const SYSTEM_TYPE &type=SYSTEM_TYPE::GENERAL) |
| | default constructor More...
|
| |
| | DiscreteControlledSystem (std::shared_ptr< DiscreteController< STATE_DIM, CONTROL_DIM, SCALAR >> controller, const SYSTEM_TYPE &type=SYSTEM_TYPE::GENERAL) |
| | constructor More...
|
| |
| | DiscreteControlledSystem (const ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > &arg) |
| | copy constructor More...
|
| |
| virtual | ~DiscreteControlledSystem ()=default |
| | destructor More...
|
| |
| void | setController (const std::shared_ptr< DiscreteController< STATE_DIM, CONTROL_DIM, SCALAR >> &controller) |
| | set a new controller More...
|
| |
| void | getController (std::shared_ptr< DiscreteController< STATE_DIM, CONTROL_DIM, SCALAR >> &controller) const |
| | get the controller instance More...
|
| |
| std::shared_ptr< DiscreteController< STATE_DIM, CONTROL_DIM, SCALAR > > | getController () |
| | get the controller instace More...
|
| |
| virtual void | propagateDynamics (const state_vector_t &state, const time_t n, state_vector_t &stateNext) override |
| | propagates the system dynamics forward by one step More...
|
| |
| virtual void | propagateControlledDynamics (const state_vector_t &state, const time_t n, const control_vector_t &control, state_vector_t &stateNext)=0 |
| | propagates the controlled system dynamics forward by one step More...
|
| |
| | DiscreteSystem (const SYSTEM_TYPE &type=GENERAL) |
| | constructor More...
|
| |
| virtual | ~DiscreteSystem () |
| | desctructor More...
|
| |
| virtual void | propagateDynamics (const StateVector< STATE_DIM, SCALAR > &state, const time_t n, StateVector< STATE_DIM, SCALAR > &stateNext)=0 |
| | propagates the system dynamics forward by one step More...
|
| |
| SYSTEM_TYPE | getType () const |
| | get the type of system More...
|
| |
|
| SYMPLECTIC_ENABLED | initializeSymplecticIntegrator () |
| | initialize the symplectic integrator, if the system is symplectic More...
|
| |
| SYMPLECTIC_DISABLED | initializeSymplecticIntegrator () |
| | a dummy method, instantiated if the system is not symplectic More...
|
| |
| SYMPLECTIC_ENABLED | integrateSymplectic (ct::core::StateVector< STATE_DIM, SCALAR > &x0, const double &t, const size_t &steps, const double &dt_sim) const |
| | integrateSymplectic, gets instantiated if the system is symplectic More...
|
| |
| SYMPLECTIC_DISABLED | integrateSymplectic (ct::core::StateVector< STATE_DIM, SCALAR > &x0, const double &t, const size_t &steps, const double &dt_sim) const |
| | a dummy method, instantiated if the system is not symplectic More...
|
| |
| SCALAR | getSimulationTimestep () |
| | compute the simulation timestep More...
|
| |
template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
class ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >
Discretize a general, continuous-time non-linear dynamic system using forward integration.
The SystemDiscretizer transforms a continuous-time system into a discrete-time system by forward integration. Please not that it does not perform a global transformation to discrete-time (it cannot compute transition matrices or similar), but rather 'mimicks' a discrete system, based on the underlying continuous-time system. In every call to propagateControlledDynamics(), the continuous-time system is forward integrated by a time interval dt_. Furthermore, the substeps during integration are recorded during each propagate-call, and can be retrieved using getSubstates() and getSubcontrols().
- Warning
- no substeps can be recorded for higher order RK symplectic integrators.
template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM, size_t V_DIM, typename SCALAR >
template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM, size_t V_DIM, typename SCALAR >
constructor with parameters and nonlinear continuous-time system
- Parameters
-
| system | The continuous-time system to be discretized |
| dt | the discretization time interval |
| integratorType | the integratorType for numerical forward integration |
| K_sim | the number of sub-integration intervals |
References ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::changeContinuousTimeSystem(), ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::dt_sim_, and ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::getSimulationTimestep().
template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM, size_t V_DIM, typename SCALAR >
| void ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::propagateControlledDynamics |
( |
const StateVector< STATE_DIM, SCALAR > & |
state, |
|
|
const time_t |
n, |
|
|
const ControlVector< CONTROL_DIM, SCALAR > & |
control, |
|
|
StateVector< STATE_DIM, SCALAR > & |
stateNext |
|
) |
| |
|
overridevirtual |
propagate discrete-time dynamics by performing a numerical forward integration of the continuous-time system
- Parameters
-
| state | start state to propagate from |
| control | the control input to apply. This is a constant control input applied to the continuous-time dynamics |
| n | time index to propagate the dynamics at, to be translated into a continuous time value t |
| stateNext | the resulting propagated state |
- Warning
- calling this method resets the substep-recorder. The substeps are only available for a single call to propagateControlledDynamics()
References ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::cont_constant_controller_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::cont_time_system_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::dt_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::dt_sim_, ct::core::EULER_SYM, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::integrator_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::integratorType_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::K_sim_, ct::core::RK_SYM, and ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::substepRecorder_.
Referenced by TEST().
template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM, size_t V_DIM, typename SCALAR >
initialize the symplectic integrator, if the system is symplectic
it only makes sense to compile the following code, if V_DIM > 0 and P_DIM > 0 initialize symplectic Euler integrator
initialize RK symplectic integrator
References ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::cont_time_system_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::integratorEulerSymplectic_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::integratorRkSymplectic_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::substepRecorder_, and SYMPLECTIC_DISABLED.
template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM, size_t V_DIM, typename SCALAR >
integrateSymplectic, gets instantiated if the system is symplectic
References ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::cont_time_system_, ct::core::EULER_SYM, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::integratorEulerSymplectic_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::integratorRkSymplectic_, ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::integratorType_, ct::core::RK_SYM, SYMPLECTIC_DISABLED, t, and x0.
template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
the forward simulation can be discretized finer than dt_. K_sim_ is an integer number representing the number of simulation sub-steps.
Referenced by ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::getSimulationTimestep(), ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::propagateControlledDynamics(), and ct::core::SystemDiscretizer< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::setParameters().