- 3.0.2 core module.
ConstantController-impl.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 core {
10 
11 
12 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
14 {
15  u_.setZero();
16 }
17 
18 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
20 {
21 }
22 
23 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
26  : Controller<STATE_DIM, CONTROL_DIM, SCALAR>(other), u_(other.u_)
27 {
28 }
29 
30 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
32 {
33 }
34 
35 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
37 {
39 }
40 
41 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
43  const SCALAR& t,
45 {
46  controlAction = u_;
47 }
48 
49 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
51  const int n,
53 {
54  computeControl(state, SCALAR(n), controlAction);
55 }
56 
57 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
59 {
60  u_ = u;
61 }
62 
63 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
65 {
66  return u_;
67 }
68 
69 template <size_t STATE_DIM, size_t CONTROL_DIM, typename SCALAR>
71  const StateVector<STATE_DIM, SCALAR>& state,
72  const SCALAR time)
73 {
75 }
76 } // namespace core
77 } // namespace ct
A constant controller.
Definition: ConstantController.h:20
ConstantController< STATE_DIM, CONTROL_DIM, SCALAR > * clone() const override
Clone operator.
Definition: ConstantController-impl.h:36
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ConstantController()
Default constructor.
Definition: ConstantController-impl.h:13
Definition: ControlVector.h:12
CppAD::AD< CppAD::cg::CG< double > > SCALAR
constexpr size_t n
Definition: MatrixInversionTest.cpp:14
Definition: StateVector.h:12
void setControl(const ControlVector< CONTROL_DIM, SCALAR > &u)
Sets the control signal.
Definition: ConstantController-impl.h:58
virtual ControlMatrix< CONTROL_DIM, SCALAR > getDerivativeU0(const StateVector< STATE_DIM, SCALAR > &state, const SCALAR time) override
Returns the the derivative of the control with respect to the initial control input u0...
Definition: ConstantController-impl.h:70
const ControlVector< CONTROL_DIM, SCALAR > & getControl() const
Get the fixed control signal.
Definition: ConstantController-impl.h:64
void computeControl(const StateVector< STATE_DIM, SCALAR > &state, const SCALAR &t, ControlVector< CONTROL_DIM, SCALAR > &controlAction) override
Computes current control.
Definition: ConstantController-impl.h:42
virtual ~ConstantController()
Destructor.
Definition: ConstantController-impl.h:31
Definition: ControlMatrix.h:12
Interface class for all controllers.
Definition: Controller.h:26