- 3.0.2 optimal control module.
DiehlSystem.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 namespace ct {
7 namespace optcon {
8 namespace example {
9 
10 using namespace ct::core;
11 using namespace ct::optcon;
12 
13 using std::shared_ptr;
14 
15 const size_t state_dim = 1;
16 const size_t control_dim = 1;
17 
18 
20 class Dynamics : public ControlledSystem<state_dim, control_dim>
21 {
22 public:
23  Dynamics() : ControlledSystem<state_dim, control_dim>(SYSTEM_TYPE::SECOND_ORDER) {}
25  const Time& t,
26  const ControlVector<control_dim>& control,
27  StateVector<state_dim>& derivative) override
28  {
29  derivative(0) = (1.0 + state(0)) * state(0) + control(0);
30  }
31 
32  Dynamics* clone() const override { return new Dynamics(); };
33 };
34 
35 
37 class LinearizedSystem : public LinearSystem<state_dim, control_dim>
38 {
39 public:
42 
43 
46  const double t = 0.0) override
47  {
48  A_ << 1 + 2 * x(0);
49  return A_;
50  }
51 
54  const double t = 0.0) override
55  {
56  B_ << 1;
57  return B_;
58  }
59 
60  LinearizedSystem* clone() const override { return new LinearizedSystem(); }
61 };
62 }
63 }
64 }
Dynamics class for the GNMS unit test, slightly nonlinear dynamics.
Definition: DiehlSystem.h:20
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
const size_t state_dim
Definition: ConstraintComparison.h:20
clear all close all load ct GNMSLog0 mat reformat t
Definition: gnmsPlot.m:6
Dynamics * clone() const override
Definition: DiehlSystem.h:32
SECOND_ORDER
state_matrix_t A_
Definition: DiehlSystem.h:40
LinearizedSystem * clone() const override
Definition: DiehlSystem.h:60
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
Dynamics()
Definition: DiehlSystem.h:23
state_control_matrix_t B_
Definition: DiehlSystem.h:41
void computeControlledDynamics(const StateVector< state_dim > &state, const Time &t, const ControlVector< control_dim > &control, StateVector< state_dim > &derivative) override
Definition: DiehlSystem.h:24
Linear system class for the GNMS unit test.
Definition: DiehlSystem.h:37
const state_matrix_t & getDerivativeState(const StateVector< state_dim > &x, const ControlVector< control_dim > &u, const double t=0.0) override
Definition: DiehlSystem.h:44
const state_control_matrix_t & getDerivativeControl(const StateVector< state_dim > &x, const ControlVector< control_dim > &u, const double t=0.0) override
Definition: DiehlSystem.h:52
const size_t control_dim
Definition: ConstraintComparison.h:21
Definition: exampleDir.h:9
double Time