00001
00002
00003
00004
00005
00006
00007 #ifndef GT2005WalkingEngine_h
00008 #define GT2005WalkingEngine_h
00009
00010 #include "WalkingEngine.h"
00011 #include "Tools/Actorics/Kinematics.h"
00012 #include "Tools/Math/Pose2D.h"
00013 #include "Tools/Math/Vector3.h"
00014 #include "GT2005Polygon.h"
00015 #include "GT2005Parameters.h"
00016 #include "Tools/Streams/OutStreams.h"
00017 #include "Tools/Streams/InStreams.h"
00018
00019
00020
00021
00022
00023
00024
00025 class GT2005WalkingEngine : public WalkingEngine
00026 {
00027 public:
00028
00029
00030 GT2005WalkingEngine(const WalkingEngineInterfaces& interfaces);
00031
00032
00033 ~GT2005WalkingEngine();
00034
00035
00036 virtual bool executeParameterized(JointData& jointData, const WalkRequest& walkRequest, double positionInWalkingCycle);
00037
00038
00039
00040
00041
00042
00043 virtual bool handleMessage(InMessage& message);
00044
00045 public:
00046
00047 bool initWithOldStyleShape;
00048
00049
00050 static const int Leg_FR;
00051 static const int Leg_FL;
00052 static const int Leg_HR;
00053 static const int Leg_HL;
00054
00055 int activePoints;
00056
00057 double footPhase[4];
00058 Vector3<double> footZeroPosition[4];
00059 GT2005Polygon* currentPoly[4];
00060
00061 GT2005Parameters* currentFIPSParameters;
00062
00063 int currentStep;
00064
00065 bool standing;
00066
00067 bool loadingFailed;
00068
00069 private:
00070
00071 double neckHeight;
00072 double bodyTilt;
00073
00074 Pose2D odometry;
00075 Pose2D currentRequest;
00076 double currentStepPercentage;
00077 GT2004Parameters* currentParameters;
00078 GT2004ParametersSet paramSet;
00079
00080 void calculateData(JointData &j);
00081 void smoothMotionRequest(const Pose2D& request, Pose2D& currentRequest);
00082
00083 bool debugging;
00084 bool debugRequest;
00085 bool debugLoop;
00086 void readDebugData(double ssf[4], double a[4], double c_offset[4], JointData &j);
00087 Vector3<double> debugDataReal[4][128];
00088 Vector3<double> debugDataIdeal[4][128];
00089 long debugDataBuffer[4][12];
00090 void streamDebugData();
00091
00092 bool resampleRequest;
00093 bool resampling;
00094 void readResampleData(double c_scale[4], double c_angle[4], double c_offset[4], JointData &j, Vector3<double> fp[4]);
00095
00096 void loadPolys(int polyID, InMessage& message);
00097 void sendPolys(int polyID);
00098
00099 int polygonsRecieved;
00100
00101 void readOdometryCalibrationData();
00102 Pose2D calculateOdometryCalibrationData(Pose2D request, WalkRequest::WalkType walkType);
00103 typedef struct
00104 {
00105 Pose2D controlled;
00106 Pose2D measured;
00107 } odometryPoint;
00108 odometryPoint odometryCalibrationData[15][13][7];
00109 odometryPoint odometryCalibrationData2[2][21];
00110
00111 void loadOdometryPlane(int planeNum, char* filename, int alternateDir);
00112 void loadOdometryRotation(int rotNum, char* filename, int alternateDir);
00113 };
00114
00115 #endif // GT2005WalkingEngine_h