- 3.0.2 core module.
Controller.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 <memory>
9 
10 #include <ct/core/types/Time.h>
14 
15 
16 namespace ct {
17 namespace core {
18 
20 
25 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR = double>
27 {
28 public:
29  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
32 
34  Controller(const Controller& other){};
35 
37  virtual ~Controller(){};
38 
40 
43  virtual Controller* clone() const = 0;
44 
46 
56  virtual void computeControl(const StateVector<STATE_DIM, SCALAR>& state,
57  const SCALAR& t,
58  ControlVector<CONTROL_DIM, SCALAR>& controlAction) = 0;
59 
70  const SCALAR time)
71  {
72  throw std::runtime_error("getDerivativeU0() not implemented for the current controller");
73  }
74 
85  const SCALAR time)
86  {
87  throw std::runtime_error("getDerivativeUf() not implemented for the current controller");
88  }
89 };
90 
91 } // namespace core
92 } // namespace ct
clear all close all load ct GNMSLog0 mat reformat t
Controller(const Controller &other)
Copy constructor.
Definition: Controller.h:34
virtual void computeControl(const StateVector< STATE_DIM, SCALAR > &state, const SCALAR &t, ControlVector< CONTROL_DIM, SCALAR > &controlAction)=0
Compute control signal.
virtual Controller * clone() const =0
Deep cloning.
Definition: ControlVector.h:12
CppAD::AD< CppAD::cg::CG< double > > SCALAR
Definition: StateVector.h:12
virtual ControlMatrix< CONTROL_DIM, SCALAR > getDerivativeU0(const StateVector< STATE_DIM, SCALAR > &state, const SCALAR time)
Returns the the derivative of the control with respect to the initial control input u0...
Definition: Controller.h:69
Definition: ControlMatrix.h:12
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Controller()
Default constructor.
Definition: Controller.h:31
virtual ControlMatrix< CONTROL_DIM, SCALAR > getDerivativeUf(const StateVector< STATE_DIM, SCALAR > &state, const SCALAR time)
Returns the the derivative of the control with respect to the final control input uF...
Definition: Controller.h:84
Interface class for all controllers.
Definition: Controller.h:26
virtual ~Controller()
Destructor.
Definition: Controller.h:37