00001
00002
00003
00004
00005
00006
00007
00008 #ifndef newPGstepStudy_H
00009 #define newPGstepStudy_H
00010
00011 #include <sys/time.h>
00012 #include <stdlib.h>
00013 #include <time.h>
00014 #include <cmath>
00015 #include <iostream>
00016 #include <iomanip>
00017 #include <sstream>
00018 #include <fstream>
00019 #include <vector>
00020 #include <set>
00021
00022 #define PI 3.14159265359
00023
00024 using namespace std;
00025
00026 struct StepFeatures
00027 {
00028 explicit StepFeatures()
00029 {}
00030
00031 ~StepFeatures()
00032 {}
00033
00034 StepFeatures& operator= (const StepFeatures& sf)
00035 {
00036 if (&sf == this)
00037 return *this;
00038
00039 comTrajX = sf.comTrajX;
00040 zmpTrajX = sf.zmpTrajX;
00041 comTrajY = sf.comTrajY;
00042 zmpTrajY = sf.zmpTrajY;
00043 leftfootXtraj = sf.leftfootXtraj;
00044 leftfootYtraj = sf.leftfootYtraj;
00045 leftfootHeight = sf.leftfootHeight;
00046 leftfootOrient = sf.leftfootOrient;
00047 rightfootXtraj = sf.rightfootXtraj;
00048 rightfootYtraj = sf.rightfootYtraj;
00049 rightfootHeight = sf.rightfootHeight;
00050 rightfootOrient = sf.rightfootOrient;
00051 waistOrient = sf.waistOrient;
00052 incrTime = sf.incrTime;
00053 zc = sf.zc;
00054 size = sf.size;
00055
00056 return *this;
00057 }
00058
00059 std::vector<double> comTrajX;
00060 std::vector<double> zmpTrajX;
00061 std::vector<double> comTrajY;
00062 std::vector<double> zmpTrajY;
00063 std::vector<double> leftfootXtraj;
00064 std::vector<double> leftfootYtraj;
00065 std::vector<double> leftfootHeight;
00066 std::vector<double> leftfootOrient;
00067 std::vector<double> rightfootXtraj;
00068 std::vector<double> rightfootYtraj;
00069 std::vector<double> rightfootHeight;
00070 std::vector<double> rightfootOrient;
00071 std::vector<double> waistOrient;
00072 double incrTime;
00073 double zc;
00074 unsigned int size;
00075 };
00076
00077 class CnewPGstepStudy
00078 {
00079
00080 public:
00081
00085 CnewPGstepStudy();
00086
00090 ~CnewPGstepStudy();
00091
00202 void drawSeqStepFeatures(ofstream & fb, double incrTime, double zc, double g, double t1, double t2, double t3, double t4, double t5, vector<double> vect_input, char leftOrRightFootStable, double coefFeet);
00203
00204 void drawSeqHalfStepFeatures(ofstream & fb, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vect_input, char leftOrRightFootStable, double coefFeet);
00205
00206 void drawSeqSlidedHalfStepFeatures(ofstream & fb, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vect_input, char leftOrRightFootStable, double coefFeet);
00207
00208 void plotOneDimensionCOMZMPSeqStep(ofstream & fb, char whichDimension, double incrTime, double zc, double g, double t1, double t2, double t3, double t4, double t5, vector<double> vect_input, char leftOrRightFootStable);
00209
00210 void plotOneDimensionCOMZMPSeqHalfStep(ofstream & fb, char whichDimension, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vect_input, char leftOrRightFootStable);
00211
00212 void plotOneDimensionCOMZMPSeqSlidedHalfStep(ofstream & fb, char whichDimension, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vect_input, char leftOrRightFootStable);
00213
00214 void plotFootHeightSeqStep(ofstream & fb, char whichDimension, double incrTime, double zc, double g, double t1, double t2, double t3, double t4, double t5, vector<double> vect_input, char leftOrRightFootStable);
00215
00216 void plotFootHeightSeqHalfStep(ofstream & fb, char whichDimension, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vect_input, char leftOrRightFootStable);
00217
00218 void plotFootHeightSeqSlidedHalfStep(ofstream & fb, char whichDimension, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vect_input, char leftOrRightFootStable);
00219
00220
00221
00222
00223 void produceOneStepFeatures(StepFeatures & stepF, double incrTime, double zc, double g, double t1, double t2, double t3, double t4, double t5, vector<double> vectStep_input, char leftOrRightFootStable);
00224
00225 void produceOneUPHalfStepFeatures(StepFeatures & stepF, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vectStep_input, char leftOrRightFootStable);
00226
00227 void produceOneDOWNHalfStepFeatures(StepFeatures & stepF, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vectStep_input, char leftOrRightFootStable);
00228
00229 void produceSeqStepFeatures(StepFeatures & stepF, double incrTime, double zc, double g, double t1, double t2, double t3, double t4, double t5, vector<double> vectSteps_input, char leftOrRightFootStable);
00230
00231 void produceSeqHalfStepFeatures(StepFeatures & stepF, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vectSteps_input, char leftOrRightFootStable);
00232
00233 void produceSeqSlidedHalfStepFeatures(StepFeatures & stepF, double incrTime, double zc, double g, double t1, double t2, double t3, vector<double> vectSteps_input, char leftOrRightFootStable);
00234
00235 void addStepFeaturesWithSlide(StepFeatures & stepF1, StepFeatures & stepF2, double negativeSlideTime);
00236
00237
00238 private:
00239
00240 void genCOMZMPtrajectory(vector<double>& outputCOM, vector<double>& outputZMP, double incrTime, double zc, double g, double delta0, double deltaX, double deltaX2, double t1, double t2, double t3, double t4, double t5);
00241
00242 void genFOOTposition(vector<double>& outputX, vector<double>& outputY, double incrTime, double xinit, double yinit, double xend, double yend, double delay, double t1, double t2, double t3, double t4, double t5, char dh);
00243
00244 void genFOOTheight(vector<double>& output, double incrTime, double heightMax, double delay, double t1, double t2, double t3, double t4, double t5);
00245
00246 void genFOOTupDOWNheight(vector<double> & output, double incrTime, double heightMax, double delay, double t1, double t2, double t3);
00247
00248 void genFOOTdownUPheight(vector<double> & output, double incrTime, double heightMax, double delay, double t1, double t2, double t3);
00249
00250 void genFOOTorientation(vector<double>& output, double incrTime, double initOrient, double endOrient, double delay, double t1, double t2, double t3, double t4, double t5, char dh);
00251
00252 void genWAISTorientation(vector<double>& output, double incrTime, double initOrient, double endOrient, double delay, double t1, double t2, double t3, double t4, double t5, char dh);
00253
00254
00255 };
00256 #endif