Lodestar
An integrated real-time control package in C++
ModelPredictiveControl.hpp
1 //
2 // Created by Hamza El-Kebir on 10/7/21.
3 //
4 
5 #ifndef LODESTAR_MODELPREDICTIVECONTROL_HPP
6 #define LODESTAR_MODELPREDICTIVECONTROL_HPP
7 
8 #include <type_traits>
9 #include "Lodestar/systems/StateSpace.hpp"
10 #include "Lodestar/aux/CompileTimeQualifiers.hpp"
11 
12 namespace ls {
13  namespace control {
14  template<const int THorizonLength = Eigen::Dynamic,
15  typename TScalar = double,
16  const int TStateDim = Eigen::Dynamic,
17  const int TInputDim = Eigen::Dynamic,
18  const int TOutputDim = Eigen::Dynamic>
20  public:
22  const int kHMatrixDim = LS_STATIC_UNLESS_DYNAMIC_VAL(THorizonLength, THorizonLength*(TStateDim + TInputDim));
23  const int kCMatrixRows = LS_STATIC_UNLESS_DYNAMIC_VAL(THorizonLength, TStateDim * THorizonLength);
24  const int kCMatrixCols = LS_STATIC_UNLESS_DYNAMIC_VAL(THorizonLength, THorizonLength*(TStateDim + TInputDim));
25 
26  typedef Eigen::Matrix<TScalar,
27  LS_STATIC_UNLESS_DYNAMIC_VAL(THorizonLength, THorizonLength*(TStateDim + TInputDim)),
28  LS_STATIC_UNLESS_DYNAMIC_VAL(THorizonLength, THorizonLength*(TStateDim + TInputDim))>
29  TDHMatrix;
30 
31  typedef Eigen::Matrix<TScalar,
32  LS_STATIC_UNLESS_DYNAMIC_VAL(THorizonLength, TStateDim * THorizonLength),
33  LS_STATIC_UNLESS_DYNAMIC_VAL(THorizonLength, THorizonLength*(TStateDim + TInputDim))>
34  TDCMatrix;
35 
36  ModelPredictiveControl() : ss_{}
37  {};
38 
39  ModelPredictiveControl(const StateSpace &ss) : ss_{ss}
40  {}
41 
42  // TODO: Implement
43  IF_DYNAMIC_RETURN(TStateDim, TInputDim, TOutputDim, Eigen::MatrixXd)
44  computeH() const
45  {
46  return Eigen::MatrixXd{};
47  }
48 
49  // TODO: Implement
50  IF_STATIC_RETURN(TStateDim, TInputDim, TOutputDim, TDHMatrix)
51  computH() const
52  {
53  return TDHMatrix{};
54  }
55 
56  protected:
57  StateSpace ss_;
58  };
59  }
60 }
61 
62 #endif //LODESTAR_MODELPREDICTIVECONTROL_HPP
ls
Main Lodestar code.
Definition: BilinearTransformation.hpp:12
ls::systems::StateSpace
Definition: StateSpace.hpp:15
ls::control::ModelPredictiveControl
Definition: ModelPredictiveControl.hpp:19