Hormodular 1.0
Locomotion gait discovery by using digital hormones on modular robots
Module.hpp
00001 //------------------------------------------------------------------------------
00002 //-- Module
00003 //------------------------------------------------------------------------------
00004 //--
00005 //-- Base class for different types of modules for modular robotics
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 
00024 #ifndef MODULE_H
00025 #define MODULE_H
00026 
00027 #include <string>
00028 #include <sstream>
00029 
00030 #include "Connector.hpp"
00031 #include "SinusoidalOscillator.h"
00032 #include "ConfigParser.h"
00033 #include "GaitTable.h"
00034 #include "Orientation.hpp"
00035 #include "Utils.hpp"
00036 
00037 namespace hormodular {
00038 
00039 
00044 class Module
00045 {
00046     public:
00053         Module(ConfigParser configParser, int index);
00054         ~Module();
00055 
00056 
00057 
00059         bool reset();
00060 
00061 
00062 
00071         bool attach( int localConnector, Connector* remoteConnector, int orientation = -1);
00072         Connector* getConnector(int localConnector);
00073 
00074 
00075 
00080         bool processHormones();
00081 
00086         bool sendHormones();
00087 
00092         bool updateOscillatorParameters();
00093 
00094 
00096         float calculateNextJointPos();
00097 
00103         bool updateElapsedTime(float timeIncrement_ms);
00104 
00105 
00106 
00107         unsigned long getID();
00108         float getCurrentJointPos();
00109 
00110 
00111     private:
00112         ConfigParser configParser;
00113         std::vector<GaitTable *> gaitTables;
00114         GaitTable * frequencyTable;
00115         std::vector<Connector*> connectors;
00116         Oscillator* oscillator;
00117         int module_index;
00118         unsigned long id;
00119         int configurationId;
00120         float currentJointPos;
00121         unsigned long elapsedTime; //-- This time is in uS
00122         Orientation orientation;
00123 };
00124 
00125 }
00126 
00127 
00128 
00129 #endif //-- MODULE_H
 All Classes Functions Variables Friends