- 3.0.2 optimal control module.
OptconDiscreteSystemInterface.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 namespace ct {
9 namespace optcon {
10 
12 
20 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
22  CONTROL_DIM,
23  DiscreteOptConProblem<STATE_DIM, CONTROL_DIM, SCALAR>,
24  SCALAR>
25 {
26 public:
27  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
28 
31 
32  typedef typename Base::control_vector_t control_vector_t;
33  typedef typename Base::state_vector_t state_vector_t;
34  typedef typename Base::state_matrix_t state_matrix_t;
35  typedef typename Base::state_control_matrix_t state_control_matrix_t;
36 
37  typedef typename Base::StateVectorArrayPtr StateVectorArrayPtr;
38  typedef typename Base::StateSubsteps StateSubsteps;
39  typedef typename Base::ControlVectorArrayPtr ControlVectorArrayPtr;
40  typedef typename Base::ControlSubsteps ControlSubsteps;
41 
42  typedef typename Base::optConProblem_t optConProblem_t;
43  typedef typename Base::settings_t settings_t;
44 
46  OptconDiscreteSystemInterface(const optConProblem_t& problem, const settings_t& settings);
47 
49  virtual ~OptconDiscreteSystemInterface() = default;
51  virtual void initialize() override;
52  virtual void configure(const settings_t& settings) override;
53 
55 
65  virtual void getAandB(const state_vector_t& x,
66  const control_vector_t& u,
67  const state_vector_t& x_next,
68  const int n,
69  size_t subSteps,
70  state_matrix_t& A,
71  state_control_matrix_t& B,
72  const size_t threadId) override;
73 
75 
82  virtual void propagateControlledDynamics(const state_vector_t& state,
83  const time_t n,
84  const control_vector_t& control,
85  state_vector_t& stateNext,
86  const size_t threadId) override;
87 
88  virtual void changeNonlinearSystem(const typename optConProblem_t::DynamicsPtr_t& dyn) override;
89  virtual void changeLinearSystem(const typename optConProblem_t::LinearPtr_t& lin) override;
90 };
91 
92 } // namespace optcon
93 } // namespace ct
interface class for optimal control algorithms
Definition: OptconDiscreteSystemInterface.h:21
Base::ControlSubsteps ControlSubsteps
Definition: OptconDiscreteSystemInterface.h:40
ct::core::ControlVector< control_dim > u
Definition: LoadFromFileTest.cpp:21
virtual void changeLinearSystem(const typename optConProblem_t::LinearPtr_t &lin) override
Definition: OptconDiscreteSystemInterface-impl.h:59
virtual void changeNonlinearSystem(const typename optConProblem_t::DynamicsPtr_t &dyn) override
Definition: OptconDiscreteSystemInterface-impl.h:45
virtual void propagateControlledDynamics(const state_vector_t &state, const time_t n, const control_vector_t &control, state_vector_t &stateNext, const size_t threadId) override
propagate discrete-time dynamics
Definition: OptconDiscreteSystemInterface-impl.h:33
Base::settings_t settings_t
Definition: OptconDiscreteSystemInterface.h:43
Base::StateSubsteps StateSubsteps
Definition: OptconDiscreteSystemInterface.h:38
Base::StateVectorArrayPtr StateVectorArrayPtr
Definition: OptconDiscreteSystemInterface.h:37
Base::state_matrix_t state_matrix_t
Definition: OptconDiscreteSystemInterface.h:34
interface base class for optimal control algorithms
Definition: OptconSystemInterface.h:25
Base::control_vector_t control_vector_t
Definition: OptconDiscreteSystemInterface.h:32
CppAD::AD< CppAD::cg::CG< double > > SCALAR
Base::state_control_matrix_t state_control_matrix_t
Definition: OptconDiscreteSystemInterface.h:35
virtual void getAandB(const state_vector_t &x, const control_vector_t &u, const state_vector_t &x_next, const int n, size_t subSteps, state_matrix_t &A, state_control_matrix_t &B, const size_t threadId) override
retrieve discrete-time linear system matrices A and B.
Definition: OptconDiscreteSystemInterface-impl.h:20
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef OptconSystemInterface< STATE_DIM, CONTROL_DIM, DiscreteOptConProblem< STATE_DIM, CONTROL_DIM, SCALAR >, SCALAR > Base
Definition: OptconDiscreteSystemInterface.h:30
OptconDiscreteSystemInterface(const optConProblem_t &problem, const settings_t &settings)
constructor
Definition: OptconDiscreteSystemInterface-impl.h:12
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
Base::state_vector_t state_vector_t
Definition: OptconDiscreteSystemInterface.h:33
Base::ControlVectorArrayPtr ControlVectorArrayPtr
Definition: OptconDiscreteSystemInterface.h:39
virtual void initialize() override
perform necessary setup work
Definition: OptconDiscreteSystemInterface-impl.h:72
virtual ~OptconDiscreteSystemInterface()=default
destructor
virtual void configure(const settings_t &settings) override
Definition: OptconDiscreteSystemInterface-impl.h:90
Base::optConProblem_t optConProblem_t
Definition: OptconDiscreteSystemInterface.h:42