GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/ddp-actuator-solver/dynamicmodel.hh Lines: 0 6 0.0 %
Date: 2023-06-02 15:50:43 Branches: 0 0 - %

Line Branch Exec Source
1
#ifndef DYNAMICMODEL_H
2
#define DYNAMICMODEL_H
3
4
#include <Eigen/Core>
5
6
template <typename precision, int stateSize, int commandSize>
7
class DynamicModel {
8
 public:
9
  typedef Eigen::Matrix<precision, stateSize, 1> stateVec_t;  // 1 x stateSize
10
  typedef Eigen::Matrix<precision, 1, stateSize>
11
      stateVecTrans_t;  // 1 x stateSize
12
  typedef Eigen::Matrix<precision, stateSize, stateSize>
13
      stateMat_t;  // stateSize x stateSize
14
  typedef Eigen::Matrix<precision, stateSize, stateSize>
15
      stateTens_t[stateSize];  // stateSize x stateSize x stateSize
16
17
  // typedef for commandSize types
18
  typedef Eigen::Matrix<precision, commandSize, 1>
19
      commandVec_t;  // commandSize x 1
20
  typedef Eigen::Matrix<precision, 1, commandSize>
21
      commandVecTrans_t;  // 1 x commandSize
22
  typedef Eigen::Matrix<precision, commandSize, commandSize>
23
      commandMat_t;  // commandSize x commandSize
24
  typedef Eigen::Matrix<precision, commandSize, commandSize>
25
      commandTens_t[commandSize];  // stateSize x commandSize x commandSize
26
27
  // typedef for mixed stateSize and commandSize types
28
  typedef Eigen::Matrix<precision, stateSize, commandSize>
29
      stateR_commandC_t;  // stateSize x commandSize
30
  typedef Eigen::Matrix<precision, stateSize, commandSize>
31
      stateR_commandC_stateD_t[stateSize];  // stateSize x commandSize x
32
                                            // stateSize
33
  typedef Eigen::Matrix<precision, stateSize, commandSize>
34
      stateR_commandC_commandD_t[commandSize];  // stateSize x commandSize x
35
                                                // commandSize
36
  typedef Eigen::Matrix<precision, commandSize, stateSize>
37
      commandR_stateC_t;  // commandSize x stateSize
38
  typedef Eigen::Matrix<precision, commandSize, stateSize>
39
      commandR_stateC_stateD_t[stateSize];  // commandSize x stateSize x
40
                                            // stateSize
41
  typedef Eigen::Matrix<precision, commandSize, stateSize>
42
      commandR_stateC_commandD_t[commandSize];  // commandSize x stateSize x
43
                                                // commandSize
44
  typedef Eigen::Matrix<precision, stateSize, stateSize>
45
      stateR_stateC_commandD_t[commandSize];  // stateSize x stateSize x
46
                                              // commandSize
47
  typedef Eigen::Matrix<precision, commandSize, commandSize>
48
      commandR_commandC_stateD_t[stateSize];  // commandSize x commandSize x
49
                                              // stateSize
50
51
  // constructors //
52
 public:
53
  // attributes //
54
 public:
55
 protected:
56
  unsigned int stateNb;
57
  unsigned int commandNb;
58
  double dt;
59
60
  commandVec_t lowerCommandBounds;
61
  commandVec_t upperCommandBounds;
62
63
  stateMat_t fx;
64
  stateTens_t fxx;
65
  stateR_commandC_t fu;
66
  stateR_commandC_commandD_t fuu;
67
  stateR_stateC_commandD_t fxu;
68
  stateR_commandC_stateD_t fux;
69
70
 public:
71
 protected:
72
  // methods //
73
 public:
74
  virtual stateVec_t computeNextState(double& dt, const stateVec_t& X,
75
                                      const commandVec_t& U) = 0;
76
  virtual void computeModelDeriv(double& dt, const stateVec_t& X,
77
                                 const commandVec_t& U) = 0;
78
  virtual stateMat_t computeTensorContxx(const stateVec_t& nextVx) = 0;
79
  virtual commandMat_t computeTensorContuu(const stateVec_t& nextVx) = 0;
80
  virtual commandR_stateC_t computeTensorContux(const stateVec_t& nextVx) = 0;
81
82
 private:
83
 protected:
84
  // accessors //
85
 public:
86
  unsigned int getStateNb() { return stateNb; }
87
  unsigned int getCommandNb() { return commandNb; }
88
  commandVec_t& getLowerCommandBounds() { return lowerCommandBounds; }
89
  commandVec_t& getUpperCommandBounds() { return upperCommandBounds; }
90
  stateMat_t& getfx() { return fx; }
91
  stateTens_t& getfxx() { return fxx; }
92
  stateR_commandC_t& getfu() { return fu; }
93
  stateR_commandC_commandD_t& getfuu() { return fuu; }
94
  stateR_stateC_commandD_t& getfxu() { return fxu; }
95
  stateR_commandC_stateD_t& getfux() { return fux; }
96
};
97
98
#endif  // DYNAMICMODEL_H