Hormodular 1.0
Locomotion gait discovery by using digital hormones on modular robots
ModularRobotEvalOp.h
00001 //------------------------------------------------------------------------------
00002 //-- ModularRobotEvalOp
00003 //------------------------------------------------------------------------------
00004 //--
00005 //-- Function evaluator (objective function) for the Modular Robot
00006 //--
00007 //------------------------------------------------------------------------------
00008 //--
00009 //-- This file belongs to the Hormodular project
00010 //-- (https://github.com/David-Estevez/hormodular.git)
00011 //--
00012 //------------------------------------------------------------------------------
00013 //-- Author: David Estevez-Fernandez
00014 //--
00015 //-- Released under the GPL license (more info on LICENSE.txt file)
00016 //------------------------------------------------------------------------------
00017 
00018 #include <ecf/ECF.h>
00019 #include "ConfigParser.h"
00020 #include "SinusoidalOscillator.h"
00021 #include "ModularRobotInterface.hpp"
00022 #include "ModularRobotInterfaceFactory.hpp"
00023 
00024 using namespace hormodular;
00025 
00026 
00031 class ModularRobotEvalOp : public EvaluateOp
00032 {
00033     public:
00034 
00035         ~ModularRobotEvalOp();
00036 
00038         bool initialize(StateP state);
00039 
00041         void registerParameters( StateP state);
00042 
00044         FitnessP evaluate(IndividualP individual);
00045 
00046     protected:
00047 
00048         /***** Constants to bound the oscillator values *****/
00049         int max_offset;
00050         float max_amp_0_5;
00051         float max_pha_0_5;
00052         float max_freq_0_5;
00053 
00054         /* Other needed stuff */
00055         ConfigParser configParser;
00056         std::vector<Oscillator *> oscillators;
00057         ModularRobotInterface * robotInterface;
00058         std::vector<float> joint_values;
00059 
00060         int n_modules;
00061         unsigned long max_runtime;
00062         float timestep;
00063         std::string config_file;
00064 
00065     private:
00067         void genotypeToRobot(FloatingPoint::FloatingPoint* genotype);
00068 };
 All Classes Functions Variables Friends