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

# Modules/WalkingEngine/GT2005Parameters.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002 * @file GT2005Parameters.h
    00003 * Definition of class GT2005Parameters
    00004 * @author Denis Fisseler
    00005 ****************************************************************************/
    00006
    00007 #ifndef GT2005Parameters_h
    00008 #define GT2005Parameters_h
    00009
    00010 #include "Tools/Math/Vector3.h"
    00011 #include "Tools/Math/Pose2D.h"
    00012 #include "Representations/Motion/MotionRequest.h"
    00013 #include "GT2005Polygon.h"
    00014 #include "Tools/Debugging/Debugging.h"
    00015 #include <string.h>
    00016 #include <math.h>
    00017
    00018 /***************************************************************************
    00019 * @class GT2005Parameters
    00020 *
    00021 * Parameter class for the GT2005 Walking Engine
    00022 * @author Denis Fisseler
    00023 ***************************************************************************/
    00024 class GT2005Parameters
    00025 {
    00026 public:
    00027   // Constructor
    00028   GT2005Parameters();
    00029
    00030   // Destructor
    00031   ~GT2005Parameters();
    00032
    00033   static const int Leg_FR;
    00034   static const int Leg_FL;
    00035   static const int Leg_HR;
    00036   static const int Leg_HL;
    00037
    00038   int stepLength; // time for one walking cycle in ticks (do not use for own calculations!)
    00039
    00040   double counterRotation; // rotation correction value for sidesteps (not working yet)
    00041
    00042   bool specialMode;
    00043
    00044   double footPhase[4]; // relative foot phase offsets
    00045   Vector3<double> footZeroPosition[4]; // foot zero positions
    00046
    00047   int activePoints; // number of point actually used by this parameter set
    00048
    00049   GT2005Polygon* evoPoly[4]; // polygon used during evolution
    00050
    00051   GT2005Polygon* omniPoly[4]; // polygon optimized for omnidirectional walking
    00052   GT2005Polygon* rotPoly[4]; // polygon optimized for fast turning
    00053   GT2005Polygon* sforwardPoly[4]; // polygon optimized for smoothly walking forward
    00054   GT2005Polygon* forwardPoly[4]; // polygon optimized for walking fast forward
    00055   GT2005Polygon* dforwardPoly[4]; // polygon optimized for walking diagonal forward
    00056   GT2005Polygon* sbackwardPoly[4]; // polygon optimized for smoothly walking backwards
    00057   GT2005Polygon* backwardPoly[4]; // polygon optimized for walking fast backwards
    00058   GT2005Polygon* dbackwardPoly[4]; // polygon optimized for walking diagonal backwards
    00059   GT2005Polygon* sidewardsPoly[4]; // polygon optimized for fast sidesteps
    00060   GT2005Polygon* boostPoly[4]; // polygon optimized for beating the dash walk
    00061   GT2005Polygon* grabPoly[4];
    00062   GT2005Polygon* rgrabPoly[4];
    00063
    00064   bool load(char* filename); // load parameter set from a file
    00065   void save(char* filename); // save parameter set to a file
    00066
    00067   GT2005Polygon* calculateCurrentPoly(int leg, Pose2D mRequest, WalkRequest::WalkType walkType); // calcultates the optimal polygon for a specific motion request
    00068
    00069   bool loadingFailed;
    00070
    00071 private:
    00072
    00073   void setBasicParameters(); // set some standars parameters for stepLength ... footZeroPosition
    00074   void setBasicPolygons(); // set some standard 4-sided rectangular polygons
    00075   void setOptimizedPolys(); // load specialized polygons from files
    00076
    00077   unsigned long framesSinceBoost;
    00078 };
    00079
    00080 In& operator>>(In& stream, GT2005Parameters& Parameters);
    00081 Out& operator<<(Out& stream, const GT2005Parameters& Parameters);
    00082
    00083 /**
    00084 * @class GTWalkParametersIndividual
    00085 *
    00086 * The class represents an individual for a set of walking parameters.
    00087 *
    00088 * @author Matthias Hebbel, Denis Fisseler
    00089 */
    00090 class GTWalkParametersIndividual
    00091 {
    00092 public:
    00093   GTWalkParametersIndividual();
    00094   GT2005Parameters walkingParameters; //< The walkingParameters of the individual.
    00095   double fitness; //< The fitness of the individual.
    00096   double strategyParameters[2][32]; //< The mutationStrengths for the walkingParameters.
    00097   double strategyParameterStepLength; //< The mutationStrengths for the stepLength.
    00098   void mutate();
    00099   void calculateTauTau0();
    00100   void crossOver(GTWalkParametersIndividual* parent2);
    00101   // be very careful with using (check if internel delete calls may cause errors)
    00102   void crossingOverOf(GTWalkParametersIndividual* parent1, GTWalkParametersIndividual* parent2);
    00103
    00104   int bMessage; //used for evolution messages
    00105
    00106   GTWalkParametersIndividual& operator=(const GTWalkParametersIndividual& other);
    00107
    00108 private:
    00109   double tau, tau0;
    00110   double randG(const double mutationStrength);
    00111 };
    00112
    00113 In& operator>>(In& stream, GTWalkParametersIndividual& individualParameters);
    00114 Out& operator<<(Out& stream, const GTWalkParametersIndividual& individualParameters);
    00115
    00116 #endif // GT2005Parameters_h