Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Modules/WalkingEngine/GT2005WalkingEngine.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002 * @file GT2005WalkingEngine.h
    00003 * Definition of class GT2005WalkingEngine
    00004 * @author Denis Fisseler
    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 * @class GT2005WalkingEngine
    00021 *
    00022 * Walking engine based on calculation of polygonal shape foot movement
    00023 * @author Denis Fisseler
    00024 ***************************************************************************/
    00025 class GT2005WalkingEngine : public WalkingEngine
    00026 {
    00027 public:
    00028   // Constructor.
    00029   // @param interfaces The paramters of the WalkingEngine module.
    00030   GT2005WalkingEngine(const WalkingEngineInterfaces& interfaces);
    00031
    00032   // Destructor
    00033   ~GT2005WalkingEngine();
    00034
    00035   // Executes the engine
    00036   virtual bool executeParameterized(JointData& jointData, const WalkRequest& walkRequest, double positionInWalkingCycle);
    00037
    00038   /**
    00039   * Called from a MessageQueue to distribute messages
    00040   * @param message The message that can be read.
    00041   * @return true if the message was read (handled).
    00042   */
    00043   virtual bool handleMessage(InMessage& message);
    00044
    00045 public:
    00046
    00047   bool initWithOldStyleShape; // calculate 4 edged polygon from old rectangel data
    00048
    00049   // constants for the legs
    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; // points: [0 ... n-1]
    00056
    00057   double footPhase[4]; // relative foot phase offsets
    00058   Vector3<double> footZeroPosition[4]; // foot zero positions
    00059   GT2005Polygon* currentPoly[4]; // a different polygon for each leg is possible.
    00060
    00061   GT2005Parameters* currentFIPSParameters;
    00062
    00063   int currentStep; //the current step from 0 to StepLength
    00064
    00065   bool standing;
    00066
    00067   bool loadingFailed;
    00068
    00069 private:
    00070   // Zeug damit das funzt
    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]; //[x][y][rot]
    00109   odometryPoint odometryCalibrationData2[2][21]; // calibration data for pure rotation
    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