- 3.0.2 core module.
TestDiscreteNonlinearSystemLinearizedDouble.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 <ct/core/core.h>
9 
10 namespace ct {
11 namespace core {
12 namespace generated {
13 
15 {
16 public:
17  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
18 
20 
23  typedef typename Base::state_matrix_t state_matrix_t;
24  typedef typename Base::state_control_matrix_t state_control_matrix_t;
25 
27  {
28  initialize();
29  }
30 
33 
35  void getAandB(const state_vector_t& x,
36  const control_vector_t& u,
37  const state_vector_t& x_next,
38  const int n,
39  size_t numSteps,
40  state_matrix_t& A,
41  state_control_matrix_t& B) override
42  {
43  getDerivativeState(x, u, n);
44  getDerivativeControl(x, u, n);
45 
46  A = dFdx_;
47  B = dFdu_;
48  }
49 
50  virtual const state_matrix_t& getDerivativeState(const state_vector_t& x,
51  const control_vector_t& u,
52  const int t = 0);
53 
54  virtual const state_control_matrix_t& getDerivativeControl(const state_vector_t& x,
55  const control_vector_t& u,
56  const int t = 0);
57 
58 private:
59  void initialize()
60  {
61  dFdx_.setZero();
62  dFdu_.setZero();
63  vX_.fill(0.0);
64  vU_.fill(0.0);
65  }
66 
67  state_matrix_t dFdx_;
68  state_control_matrix_t dFdu_;
69  std::array<double, 0> vX_;
70  std::array<double, 0> vU_;
71 };
72 
73 } // namespace generated
74 } // namespace core
75 } // namespace ct
ControlVector< CONTROL_DIM, double > control_vector_t
Definition: DiscreteSystem.h:17
virtual const state_matrix_t & getDerivativeState(const state_vector_t &x, const control_vector_t &u, const int t=0)
Definition: TestDiscreteNonlinearSystemLinearizedDouble_A.cpp:14
Base::state_matrix_t state_matrix_t
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:23
ct::core::ControlVector< control_dim > u
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:14
interface class for a general discrete linear system or linearized discrete system ...
Definition: DiscreteLinearSystem.h:23
StateVector< STATE_DIM, double > state_vector_t
Definition: DiscreteSystem.h:16
clear all close all load ct GNMSLog0 mat reformat t
virtual TestDiscreteNonlinearSystemLinearizedDouble * clone() const override
deep cloning
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:34
Base::state_control_matrix_t state_control_matrix_t
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:24
Base::control_vector_t control_vector_t
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:22
TestDiscreteNonlinearSystemLinearizedDouble(const TestDiscreteNonlinearSystemLinearizedDouble &other)
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:31
constexpr size_t n
Definition: MatrixInversionTest.cpp:14
ct::core::StateVector< state_dim > x
SYSTEM_TYPE
type of system
Definition: System.h:15
any non-specific system
Definition: System.h:17
TestDiscreteNonlinearSystemLinearizedDouble(const ct::core::SYSTEM_TYPE &type=ct::core::SYSTEM_TYPE::GENERAL)
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:26
Base::state_vector_t state_vector_t
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:21
virtual const state_control_matrix_t & getDerivativeControl(const state_vector_t &x, const control_vector_t &u, const int t=0)
Definition: TestDiscreteNonlinearSystemLinearizedDouble_B.cpp:14
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ct::core::DiscreteLinearSystem< 2, 1, double > Base
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:19
void getAandB(const state_vector_t &x, const control_vector_t &u, const state_vector_t &x_next, const int n, size_t numSteps, state_matrix_t &A, state_control_matrix_t &B) override
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:35
virtual ~TestDiscreteNonlinearSystemLinearizedDouble()
Definition: TestDiscreteNonlinearSystemLinearizedDouble.h:32