|
Hormodular 1.0
Locomotion gait discovery by using digital hormones on modular robots
|
00001 //------------------------------------------------------------------------------ 00002 //-- Gait Table 00003 //------------------------------------------------------------------------------ 00004 //-- 00005 //-- A gait table that contains all the parameters needed for robot locomotion. 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 GAIT_TABLE_H 00025 #define GAIT_TABLE_H 00026 00027 #include <stdint.h> 00028 #include <cstdlib> 00029 #include <fstream> 00030 #include <iostream> 00031 #include <string> 00032 #include <vector> 00033 00034 namespace hormodular { 00035 00039 class GaitTable 00040 { 00041 public: 00046 GaitTable(const std::string file_path); 00047 00048 00049 00055 float at( int id, int parameter ); 00056 00063 std::vector<float> getParameters( int id); 00064 00071 std::vector<float> operator[](int id); 00072 00073 00074 int getNumParameters(); 00075 00080 std::vector<unsigned long> getIDs(); 00081 00082 00087 int reload(); 00088 00089 private: 00096 std::vector< std::vector<float> > data; 00097 std::vector<unsigned long> ids; 00098 int num_parameters; 00099 std::string file_path; 00100 00102 int lookForID(unsigned long id); 00103 00105 int loadFromFile( const std::string file_path); 00106 00108 void saveToFile(const std::string file_path); 00109 }; 00110 00111 } 00112 #endif
1.7.4