00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "Locomotion/Walk/step.h"
00013
00014 class Optimiser
00015 {
00016 public:
00017 Optimiser();
00018 ~Optimiser();
00019
00020 void doOptimisation(Step* currentstep, float currentspeed);
00021 private:
00022 void tickOptimiser(float speed, float power);
00023 void mutateBestParameters();
00024
00025 void initBestParameters();
00026 void copyToBestParameters();
00027
00028 float normalDistribution(float mean, float sigma);
00029
00030 void assessParameters(Step* currentstep, float currentspeed);
00031 public:
00032 float BestSpeed;
00033 float BestCost;
00034 float BestParameters[SM_NUM_MODES][SH_NUM_JOINTS];
00035 float BestDeltaParameters[SM_NUM_MODES][SH_NUM_JOINTS];
00036
00037 float CurrentParameters[SM_NUM_MODES][SH_NUM_JOINTS];
00038 private:
00039 Step* LeftStep;
00040 Step* RightStep;
00041
00042 int SpeedCount;
00043 float SpeedSum;
00044 int SpeedCountLimit;
00045
00046 float SpeedImprovement;
00047 float SpeedPreviousImprovement;
00048 float CostImprovement;
00049 float CostPreviousImprovement;
00050
00051 float PowerSum;
00052
00053 float Alpha;
00054 int ResetLimit;
00055 int CountSinceLastImprovement;
00056
00057 int AssessSpeedCount;
00058 float AssessSpeedSum;
00059 float AssessPowerSum;
00060 int AssessSpeedCountLimit;
00061 };
00062
00063