- 3.0.2 optimal control module.
CTSystemModel.h
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
8 #include "SystemModelBase.h"
9 
10 namespace ct {
11 namespace optcon {
12 
25 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
26 class CTSystemModel final : public SystemModelBase<STATE_DIM, CONTROL_DIM, SCALAR>
27 {
28 public:
29  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
30 
32  using typename Base::control_vector_t;
33  using typename Base::state_matrix_t;
34  using typename Base::state_vector_t;
35  using typename Base::Time_t;
36 
37  using SensitivityApprox_t =
38  ct::core::SensitivityApproximation<STATE_DIM, CONTROL_DIM, STATE_DIM / 2, STATE_DIM / 2, SCALAR>;
39 
42  std::shared_ptr<SensitivityApprox_t> sensApprox,
43  const state_matrix_t& dFdv,
44  const ct::core::IntegrationType& intType = ct::core::IntegrationType::EULERCT);
45 
48  const control_vector_t& u,
49  const Time_t dt,
50  Time_t t) override;
51 
54  const control_vector_t& u,
55  const Time_t dt,
56  Time_t t) override;
57 
60  const control_vector_t& control,
61  const Time_t dt,
62  Time_t t) override;
63 
64 protected:
66  std::shared_ptr<ct::core::ControlledSystem<STATE_DIM, CONTROL_DIM, SCALAR>> system_;
67 
69  std::shared_ptr<ct::core::ConstantController<STATE_DIM, CONTROL_DIM, SCALAR>> constantController_;
70 
72  std::shared_ptr<SensitivityApprox_t> sensApprox_;
73 
76 
79 };
80 
81 } // namespace optcon
82 } // namespace ct
ct::core::ControlVector< CONTROL_DIM, SCALAR > control_vector_t
Definition: SystemModelBase.h:26
std::shared_ptr< SensitivityApprox_t > sensApprox_
The sensitivity approximator.
Definition: CTSystemModel.h:72
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
std::shared_ptr< ct::core::ConstantController< STATE_DIM, CONTROL_DIM, SCALAR > > constantController_
each system gets re-assigned a constant controller for dynamics evaluation with known control inputs ...
Definition: CTSystemModel.h:69
CTSystemModel(std::shared_ptr< ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >> system, std::shared_ptr< SensitivityApprox_t > sensApprox, const state_matrix_t &dFdv, const ct::core::IntegrationType &intType=ct::core::IntegrationType::EULERCT)
Constructor. Takes in the system with defined controller, and sens approximator for computing the der...
Definition: CTSystemModel-impl.h:12
std::shared_ptr< ct::core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > > system_
The underlying CT system.
Definition: CTSystemModel.h:66
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
state_vector_t computeDynamics(const state_vector_t &state, const control_vector_t &u, const Time_t dt, Time_t t) override
Propagates the system giving the next state as output. Control input is generated by the system contr...
Definition: CTSystemModel-impl.h:31
state_matrix_t dFdv_
Derivative w.r.t. noise.
Definition: CTSystemModel.h:75
const double dt
Definition: LQOCSolverTiming.cpp:18
System model adapted to CT. System model encapsulates the integrator, so it is able to propagate the ...
Definition: CTSystemModel.h:26
ct::core::StateMatrix< STATE_DIM, SCALAR > state_matrix_t
Definition: SystemModelBase.h:25
CppAD::AD< CppAD::cg::CG< double > > SCALAR
state_matrix_t computeDerivativeNoise(const state_vector_t &state, const control_vector_t &control, const Time_t dt, Time_t t) override
Computes the derivative w.r.t noise. Control input is generated by the system controller.
Definition: CTSystemModel-impl.h:59
ct::core::Integrator< STATE_DIM, SCALAR > integrator_
Integrator.
Definition: CTSystemModel.h:78
System model is an interface that encapsulates the integrator to be able to propagate the system...
Definition: SystemModelBase.h:21
state_matrix_t computeDerivativeState(const state_vector_t &state, const control_vector_t &u, const Time_t dt, Time_t t) override
Computes the derivative w.r.t state. Control input is generated by the system controller.
Definition: CTSystemModel-impl.h:43
ct::core::StateVector< STATE_DIM, SCALAR > state_vector_t
Definition: SystemModelBase.h:24
SCALAR Time_t
Definition: SystemModelBase.h:27