00001 #ifndef _UTILS_H_ 00002 #define _UTILS_H_ 00003 #include <string> 00004 00005 enum FOOT { 00006 LEFT_FOOT, 00007 RIGHT_FOOT 00008 }; 00009 00013 enum ZmpTestType { 00014 ZMP_CONSTANT_REFERENCE=0, /*Constant zmp reference (step setpoint). Can be specified through config file with value 0.*/ 00015 ZMP_VARYING_REFERENCE, /*Sinusoidal zmp reference. The parameters can be specified through config file with value 1.*/ 00016 COM_LIN_VEL_CONSTANT_REFERENCE, /*Constant COM linear velocity. The zmp controller does nothing. Used to tuned the com task level gains.*/ 00017 SINGLE_STEP, /* Performs one single step with the right foot using also the zmp preview controller */ 00018 STEPPING_TEST /* Performs one single step with the right foot using also the zmp preview controller */ 00019 }; 00020 00021 struct singleStepTestParams { 00022 double totalDuration; 00023 double offset; 00024 double SSduration; 00025 double riseTime; 00026 double stepLength; 00027 double stepHeight; 00028 }; 00029 00030 struct steppingTestParams { 00031 int nSteps; 00032 double stepDuration; 00033 double stepLength; 00034 double stepHeight; 00035 }; 00036 00037 struct MIQPParameters { 00038 /* Size of preview window */ 00039 unsigned int N; 00040 /* CoM velocity reference in x dir */ 00041 double dCoMxRef; 00042 /* CoM velocity reference in y dir */ 00043 double dCoMyRef; 00044 /* Constant com height */ 00045 double cz; 00046 /* Gavity acceleration */ 00047 double g; 00048 /* Thread period */ 00049 unsigned int dtThread; 00050 /* MIQP discretization period */ 00051 unsigned int dt; 00052 /* Home directory where logged data will be saved */ 00053 std::string home; 00054 /* Walking Performance Cost Weight */ 00055 double ww; 00056 /* Balance Performance Cost Weight */ 00057 double wb; 00058 /* Jerk regularization Cost Weight */ 00059 double wu; 00060 /* Regularization weight to avoid resting on one foot */ 00061 double wss; 00062 /* Regularization weight to minimize stepping */ 00063 double wstep; 00064 /* Regularization weight on delta*/ 00065 double wdelta; 00066 /* X Boundary in Constancy constraints */ 00067 double sx_constancy; 00068 /* Y Boundary in Constancy constraints */ 00069 double sy_constancy; 00070 /* X Boundary in Single Support Constraints */ 00071 double sx_ss; 00072 /* Y Boundary in Single Support Constraints */ 00073 double sy_ss; 00074 /* CoM State Reference Selection Vector. If your CoM State Reference consists only of forward velocity 00075 * then this vector is: [0 0 1 1 0 0] */ 00076 double hx_ref; 00077 double hy_ref; 00078 double dhx_ref; 00079 double dhy_ref; 00080 double ddhx_ref; 00081 double ddhy_ref; 00082 /* Add Shape Constraints? */ 00083 bool shapeConstraints; 00084 /* Add Admissibility Constraints? */ 00085 bool admissibilityConstraints; 00086 /* Add CoP Constraints? */ 00087 bool copConstraints; 00088 /* Add walking constraints? */ 00089 bool walkingConstraints; 00090 /* Add regularization terms?*/ 00091 bool addRegularization; 00092 /* robot name */ 00093 std::string robot; 00094 /* Distance from actual CoP boundaries */ 00095 double marginCoPBounds; 00096 }; 00097 00098 #define STATE_VECTOR_SIZE 16 00099 #define INPUT_VECTOR_SIZE 12 00100 00101 #endif