|
Hormodular 1.0
Locomotion gait discovery by using digital hormones on modular robots
|
00001 //------------------------------------------------------------------------------ 00002 //-- SimulatedModularRobotInterface 00003 //------------------------------------------------------------------------------ 00004 //-- 00005 //-- Interface to the simulated 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 00026 #ifndef SIMULATED_MODULAR_ROBOT_INTERFACE_H 00027 #define SIMULATED_MODULAR_ROBOT_INTERFACE_H 00028 00029 #include "ModularRobotInterface.hpp" 00030 #include "SimulationOpenRAVE.hpp" 00031 #include "ConfigParser.h" 00032 00033 namespace hormodular { 00034 00040 class SimulatedModularRobotInterface : public ModularRobotInterface 00041 { 00042 public: 00043 SimulatedModularRobotInterface( ConfigParser configParser); 00044 00045 00050 virtual bool start(); 00051 00056 virtual bool stop(); 00057 00062 virtual bool destroy(); 00063 00068 virtual bool reset(); 00069 00070 00071 00080 virtual bool setProperty(std::string property, std::string value); 00081 00082 00083 00091 virtual float getTravelledDistance(); 00092 00094 virtual bool sendJointValues(std::vector<float> joint_values, float step_ms=0); 00095 00097 virtual std::vector<float> getJointValues(); 00098 00099 private: 00100 SimulationOpenRAVE * simulation; 00101 std::string environment_file; 00102 OpenRAVE::ControllerBasePtr controller; 00103 00104 int step_ms; 00105 double step_s; 00106 00107 //-- Position-related things: 00108 00110 void calculatePos(); 00111 00112 std::pair<float, float> start_pos; 00113 std::pair<float, float> current_pos; 00114 }; 00115 00116 } 00117 00118 #endif
1.7.4