A sparse MPC solver for walking motion generation (old version).
|
00001 00007 #include "WMG.h" 00008 00009 00010 smpc_parameters::smpc_parameters( 00011 const unsigned int N, 00012 const double hCoM_, 00013 const double gravity_) 00014 { 00015 hCoM = hCoM_; 00016 gravity = gravity_; 00017 00018 X = new double[SMPC_NUM_VAR*N]; 00019 00020 T = new double[N]; 00021 h = new double[N]; 00022 00023 h0 = hCoM/gravity; 00024 for (unsigned int i = 0; i < N; i++) 00025 { 00026 h[i] = h0; 00027 } 00028 00029 angle = new double[N]; 00030 zref_x = new double[N]; 00031 zref_y = new double[N]; 00032 fp_x = new double[N]; 00033 fp_y = new double[N]; 00034 lb = new double[2*N]; 00035 ub = new double[2*N]; 00036 } 00037 00038 00039 00040 smpc_parameters::~smpc_parameters() 00041 { 00042 if (X != NULL) 00043 { 00044 delete [] X; 00045 X = NULL; 00046 } 00047 00048 if (T != NULL) 00049 { 00050 delete T; 00051 } 00052 if (h != NULL) 00053 { 00054 delete h; 00055 } 00056 00057 if (angle != NULL) 00058 { 00059 delete angle; 00060 } 00061 if (zref_x != NULL) 00062 { 00063 delete zref_x; 00064 } 00065 if (zref_y != NULL) 00066 { 00067 delete zref_y; 00068 } 00069 if (fp_x != NULL) 00070 { 00071 delete fp_x; 00072 } 00073 if (fp_y != NULL) 00074 { 00075 delete fp_y; 00076 } 00077 if (lb != NULL) 00078 { 00079 delete lb; 00080 } 00081 if (ub != NULL) 00082 { 00083 delete ub; 00084 } 00085 }