dynamicmodel.hh
Go to the documentation of this file.
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 
62 
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; }
90  stateMat_t& getfx() { return fx; }
91  stateTens_t& getfxx() { return fxx; }
92  stateR_commandC_t& getfu() { return fu; }
96 };
97 
98 #endif // DYNAMICMODEL_H
DynamicModel::getfxu
stateR_stateC_commandD_t & getfxu()
Definition: dynamicmodel.hh:94
DynamicModel::stateTens_t
Eigen::Matrix< precision, stateSize, stateSize > stateTens_t[stateSize]
Definition: dynamicmodel.hh:15
DynamicModel::getStateNb
unsigned int getStateNb()
Definition: dynamicmodel.hh:86
DynamicModel
Definition: dynamicmodel.hh:7
DynamicModel::getfuu
stateR_commandC_commandD_t & getfuu()
Definition: dynamicmodel.hh:93
DynamicModel::stateR_commandC_t
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_t
Definition: dynamicmodel.hh:29
DynamicModel::commandR_commandC_stateD_t
Eigen::Matrix< precision, commandSize, commandSize > commandR_commandC_stateD_t[stateSize]
Definition: dynamicmodel.hh:48
DynamicModel::commandVecTrans_t
Eigen::Matrix< precision, 1, commandSize > commandVecTrans_t
Definition: dynamicmodel.hh:21
DynamicModel::stateR_stateC_commandD_t
Eigen::Matrix< precision, stateSize, stateSize > stateR_stateC_commandD_t[commandSize]
Definition: dynamicmodel.hh:45
DynamicModel::fxu
stateR_stateC_commandD_t fxu
Definition: dynamicmodel.hh:67
DynamicModel::stateMat_t
Eigen::Matrix< precision, stateSize, stateSize > stateMat_t
Definition: dynamicmodel.hh:13
DynamicModel::commandTens_t
Eigen::Matrix< precision, commandSize, commandSize > commandTens_t[commandSize]
Definition: dynamicmodel.hh:25
DynamicModel::getfu
stateR_commandC_t & getfu()
Definition: dynamicmodel.hh:92
DynamicModel::stateVec_t
Eigen::Matrix< precision, stateSize, 1 > stateVec_t
Definition: dynamicmodel.hh:9
DynamicModel::getfx
stateMat_t & getfx()
Definition: dynamicmodel.hh:90
DynamicModel::fuu
stateR_commandC_commandD_t fuu
Definition: dynamicmodel.hh:66
DynamicModel::commandR_stateC_t
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_t
Definition: dynamicmodel.hh:37
DynamicModel::dt
double dt
Definition: dynamicmodel.hh:58
DynamicModel::computeTensorContuu
virtual commandMat_t computeTensorContuu(const stateVec_t &nextVx)=0
DynamicModel::commandR_stateC_stateD_t
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_stateD_t[stateSize]
Definition: dynamicmodel.hh:39
DynamicModel::computeTensorContux
virtual commandR_stateC_t computeTensorContux(const stateVec_t &nextVx)=0
DynamicModel::getLowerCommandBounds
commandVec_t & getLowerCommandBounds()
Definition: dynamicmodel.hh:88
DynamicModel::fu
stateR_commandC_t fu
Definition: dynamicmodel.hh:65
DynamicModel::fux
stateR_commandC_stateD_t fux
Definition: dynamicmodel.hh:68
DynamicModel::commandR_stateC_commandD_t
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_commandD_t[commandSize]
Definition: dynamicmodel.hh:42
DynamicModel::getfux
stateR_commandC_stateD_t & getfux()
Definition: dynamicmodel.hh:95
DynamicModel::stateVecTrans_t
Eigen::Matrix< precision, 1, stateSize > stateVecTrans_t
Definition: dynamicmodel.hh:11
DynamicModel::lowerCommandBounds
commandVec_t lowerCommandBounds
Definition: dynamicmodel.hh:60
DynamicModel::commandNb
unsigned int commandNb
Definition: dynamicmodel.hh:57
DynamicModel::computeNextState
virtual stateVec_t computeNextState(double &dt, const stateVec_t &X, const commandVec_t &U)=0
DynamicModel::computeModelDeriv
virtual void computeModelDeriv(double &dt, const stateVec_t &X, const commandVec_t &U)=0
DynamicModel::getCommandNb
unsigned int getCommandNb()
Definition: dynamicmodel.hh:87
DynamicModel::fx
stateMat_t fx
Definition: dynamicmodel.hh:63
DynamicModel::getfxx
stateTens_t & getfxx()
Definition: dynamicmodel.hh:91
DynamicModel::computeTensorContxx
virtual stateMat_t computeTensorContxx(const stateVec_t &nextVx)=0
DynamicModel::stateNb
unsigned int stateNb
Definition: dynamicmodel.hh:56
DynamicModel::getUpperCommandBounds
commandVec_t & getUpperCommandBounds()
Definition: dynamicmodel.hh:89
DynamicModel::stateR_commandC_stateD_t
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_stateD_t[stateSize]
Definition: dynamicmodel.hh:31
DynamicModel::commandVec_t
Eigen::Matrix< precision, commandSize, 1 > commandVec_t
Definition: dynamicmodel.hh:19
DynamicModel::commandMat_t
Eigen::Matrix< precision, commandSize, commandSize > commandMat_t
Definition: dynamicmodel.hh:23
DynamicModel::stateR_commandC_commandD_t
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_commandD_t[commandSize]
Definition: dynamicmodel.hh:34
DynamicModel::upperCommandBounds
commandVec_t upperCommandBounds
Definition: dynamicmodel.hh:61
DynamicModel::fxx
stateTens_t fxx
Definition: dynamicmodel.hh:64