Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00033 #ifndef ROCKET_WITH_TEMPLATES_HPP
00034 #define ROCKET_WITH_TEMPLATES_HPP
00035
00036
00037 const int nxd = 3;
00038 const int nu = 1;
00039
00040
00041 #define S xd[0]
00042 #define V xd[1]
00043 #define M xd[2]
00044
00045 #define U u[0]
00046
00047
00048 const char* xd_names[nxd] = {"DifferentialState s","DifferentialState v","DifferentialState m"};
00049 const char* u_names[nu] = {"Control u"};
00050
00051
00052 const double t_start = 0.0;
00053 const double t_end = 10.0;
00054
00055 const bool xd_0_fixed[nxd] = { true , true , true };
00056 const bool xd_f_fixed[nxd] = { true , true , false};
00057
00058 const double xd_0[nxd] = { 0.0 , 0.0 , 1.0 };
00059 const double xd_f[nxd] = { 10.0 , 0.0 , 0.0 };
00060
00061 const bool xd_has_lb[nxd] = { false, true , false};
00062 const bool xd_has_ub[nxd] = { false, true, false};
00063
00064 const double xd_lb[nxd] = { 0.0 , -0.01, 0.0 };
00065 const double xd_ub[nxd] = { 0.0 , 1.3, 0.0 };
00066
00067
00068
00069 template <class DifferentialStateType, class ControlType, class ReturnType>
00070 void eval_F(const DifferentialStateType *xd,
00071 const ControlType *u,
00072 ReturnType &lfun){
00073
00074 lfun = U*U;
00075
00076 }
00077
00078
00079 template <class DifferentialStateType, class ControlType, class ReturnType>
00080 void eval_G(const DifferentialStateType *xd,
00081 const ControlType *u,
00082 ReturnType *rhs){
00083
00084 rhs[0] = V;
00085 rhs[1] = (U-0.02*V*V)/M;
00086 rhs[2] = -0.01*U*U;
00087
00088 }
00089
00090
00091 #undef U
00092 #undef V
00093 #undef S
00094 #undef M
00095
00096
00097 #endif // ROCKET_WITH_TEMPLATES_HPP
00098