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> stateVecTrans_t; // 1 x stateSize
11  typedef Eigen::Matrix<precision, stateSize, stateSize> stateMat_t; // stateSize x stateSize
12  typedef Eigen::Matrix<precision, stateSize, stateSize> stateTens_t[stateSize]; // stateSize x stateSize x stateSize
13 
14  // typedef for commandSize types
15  typedef Eigen::Matrix<precision, commandSize, 1> commandVec_t; // commandSize x 1
16  typedef Eigen::Matrix<precision, 1, commandSize> commandVecTrans_t; // 1 x commandSize
17  typedef Eigen::Matrix<precision, commandSize, commandSize> commandMat_t; // commandSize x commandSize
18  typedef Eigen::Matrix<precision, commandSize, commandSize>
19  commandTens_t[commandSize]; // stateSize x commandSize x commandSize
20 
21  // typedef for mixed stateSize and commandSize types
22  typedef Eigen::Matrix<precision, stateSize, commandSize> stateR_commandC_t; // stateSize x commandSize
23  typedef Eigen::Matrix<precision, stateSize, commandSize>
24  stateR_commandC_stateD_t[stateSize]; // stateSize x commandSize x stateSize
25  typedef Eigen::Matrix<precision, stateSize, commandSize>
26  stateR_commandC_commandD_t[commandSize]; // stateSize x commandSize x commandSize
27  typedef Eigen::Matrix<precision, commandSize, stateSize> commandR_stateC_t; // commandSize x stateSize
28  typedef Eigen::Matrix<precision, commandSize, stateSize>
29  commandR_stateC_stateD_t[stateSize]; // commandSize x stateSize x stateSize
30  typedef Eigen::Matrix<precision, commandSize, stateSize>
31  commandR_stateC_commandD_t[commandSize]; // commandSize x stateSize x commandSize
32  typedef Eigen::Matrix<precision, stateSize, stateSize>
33  stateR_stateC_commandD_t[commandSize]; // stateSize x stateSize x commandSize
34  typedef Eigen::Matrix<precision, commandSize, commandSize>
35  commandR_commandC_stateD_t[stateSize]; // commandSize x commandSize x stateSize
36 
37  // constructors //
38  public:
39  // attributes //
40  public:
41  protected:
42  unsigned int stateNb;
43  unsigned int commandNb;
44  double dt;
45 
48 
55 
56  public:
57  protected:
58  // methods //
59  public:
60  virtual stateVec_t computeNextState(double& dt, const stateVec_t& X, const commandVec_t& U) = 0;
61  virtual void computeModelDeriv(double& dt, const stateVec_t& X, const commandVec_t& U) = 0;
62  virtual stateMat_t computeTensorContxx(const stateVec_t& nextVx) = 0;
63  virtual commandMat_t computeTensorContuu(const stateVec_t& nextVx) = 0;
64  virtual commandR_stateC_t computeTensorContux(const stateVec_t& nextVx) = 0;
65 
66  private:
67  protected:
68  // accessors //
69  public:
70  unsigned int getStateNb() { return stateNb; }
71  unsigned int getCommandNb() { return commandNb; }
74  stateMat_t& getfx() { return fx; }
75  stateTens_t& getfxx() { return fxx; }
76  stateR_commandC_t& getfu() { return fu; }
80 };
81 
82 #endif // DYNAMICMODEL_H
DynamicModel::getfxu
stateR_stateC_commandD_t & getfxu()
Definition: dynamicmodel.hh:78
DynamicModel::stateTens_t
Eigen::Matrix< precision, stateSize, stateSize > stateTens_t[stateSize]
Definition: dynamicmodel.hh:12
DynamicModel::getStateNb
unsigned int getStateNb()
Definition: dynamicmodel.hh:70
DynamicModel
Definition: dynamicmodel.hh:7
DynamicModel::getfuu
stateR_commandC_commandD_t & getfuu()
Definition: dynamicmodel.hh:77
DynamicModel::stateR_commandC_t
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_t
Definition: dynamicmodel.hh:22
DynamicModel::commandR_commandC_stateD_t
Eigen::Matrix< precision, commandSize, commandSize > commandR_commandC_stateD_t[stateSize]
Definition: dynamicmodel.hh:35
DynamicModel::commandVecTrans_t
Eigen::Matrix< precision, 1, commandSize > commandVecTrans_t
Definition: dynamicmodel.hh:16
DynamicModel::stateR_stateC_commandD_t
Eigen::Matrix< precision, stateSize, stateSize > stateR_stateC_commandD_t[commandSize]
Definition: dynamicmodel.hh:33
DynamicModel::fxu
stateR_stateC_commandD_t fxu
Definition: dynamicmodel.hh:53
DynamicModel::stateMat_t
Eigen::Matrix< precision, stateSize, stateSize > stateMat_t
Definition: dynamicmodel.hh:11
DynamicModel::commandTens_t
Eigen::Matrix< precision, commandSize, commandSize > commandTens_t[commandSize]
Definition: dynamicmodel.hh:19
DynamicModel::getfu
stateR_commandC_t & getfu()
Definition: dynamicmodel.hh:76
DynamicModel::stateVec_t
Eigen::Matrix< precision, stateSize, 1 > stateVec_t
Definition: dynamicmodel.hh:9
DynamicModel::getfx
stateMat_t & getfx()
Definition: dynamicmodel.hh:74
DynamicModel::fuu
stateR_commandC_commandD_t fuu
Definition: dynamicmodel.hh:52
DynamicModel::commandR_stateC_t
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_t
Definition: dynamicmodel.hh:27
DynamicModel::dt
double dt
Definition: dynamicmodel.hh:44
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:29
DynamicModel::computeTensorContux
virtual commandR_stateC_t computeTensorContux(const stateVec_t &nextVx)=0
DynamicModel::getLowerCommandBounds
commandVec_t & getLowerCommandBounds()
Definition: dynamicmodel.hh:72
DynamicModel::fu
stateR_commandC_t fu
Definition: dynamicmodel.hh:51
DynamicModel::fux
stateR_commandC_stateD_t fux
Definition: dynamicmodel.hh:54
DynamicModel::commandR_stateC_commandD_t
Eigen::Matrix< precision, commandSize, stateSize > commandR_stateC_commandD_t[commandSize]
Definition: dynamicmodel.hh:31
DynamicModel::getfux
stateR_commandC_stateD_t & getfux()
Definition: dynamicmodel.hh:79
DynamicModel::stateVecTrans_t
Eigen::Matrix< precision, 1, stateSize > stateVecTrans_t
Definition: dynamicmodel.hh:10
DynamicModel::lowerCommandBounds
commandVec_t lowerCommandBounds
Definition: dynamicmodel.hh:46
DynamicModel::commandNb
unsigned int commandNb
Definition: dynamicmodel.hh:43
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:71
DynamicModel::fx
stateMat_t fx
Definition: dynamicmodel.hh:49
DynamicModel::getfxx
stateTens_t & getfxx()
Definition: dynamicmodel.hh:75
DynamicModel::computeTensorContxx
virtual stateMat_t computeTensorContxx(const stateVec_t &nextVx)=0
DynamicModel::stateNb
unsigned int stateNb
Definition: dynamicmodel.hh:42
DynamicModel::getUpperCommandBounds
commandVec_t & getUpperCommandBounds()
Definition: dynamicmodel.hh:73
DynamicModel::stateR_commandC_stateD_t
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_stateD_t[stateSize]
Definition: dynamicmodel.hh:24
DynamicModel::commandVec_t
Eigen::Matrix< precision, commandSize, 1 > commandVec_t
Definition: dynamicmodel.hh:15
DynamicModel::commandMat_t
Eigen::Matrix< precision, commandSize, commandSize > commandMat_t
Definition: dynamicmodel.hh:17
DynamicModel::stateR_commandC_commandD_t
Eigen::Matrix< precision, stateSize, commandSize > stateR_commandC_commandD_t[commandSize]
Definition: dynamicmodel.hh:26
DynamicModel::upperCommandBounds
commandVec_t upperCommandBounds
Definition: dynamicmodel.hh:47
DynamicModel::fxx
stateTens_t fxx
Definition: dynamicmodel.hh:50