|
Hormodular 1.0
Locomotion gait discovery by using digital hormones on modular robots
|
00001 //----------------------------------------------------------------------------------- 00002 //-- SimulationOpenRAVE 00003 //----------------------------------------------------------------------------------- 00004 //-- 00005 //-- Class wrapping all the components of a OpenRAVE simulation 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 //-- Based on the 'TestBase' example from OpenMR ( https://github.com/Obijuan/openmr ) 00016 //-- made by Juan Gonzalez-Gomez 00017 //-- 00018 //-- Released under the GPL license (more info on LICENSE.txt file) 00019 //------------------------------------------------------------------------------------ 00020 00021 00029 #ifndef SIMULATION_OPENRAVE_H 00030 #define SIMULATION_OPENRAVE_H 00031 00032 #include <openrave-core.h> 00033 #include <boost/thread/thread.hpp> 00034 #include <boost/bind.hpp> 00035 00036 #include <iostream> 00037 #include <vector> 00038 #include <string> 00039 00040 namespace hormodular { 00041 00046 class SimulationOpenRAVE 00047 { 00048 public: 00054 SimulationOpenRAVE( std::string environment_file , bool show_simulation = true); 00055 ~SimulationOpenRAVE(); 00056 00057 00059 void init(); 00060 00061 00062 OpenRAVE::EnvironmentBasePtr getPenv() const; 00063 std::vector<OpenRAVE::RobotBasePtr> getRobots() const; 00064 OpenRAVE::RobotBasePtr getRobot( int index = 0) const; 00065 00066 00068 void showViewer(); 00069 00071 void start(OpenRAVE::dReal step_period, bool real_time = true); 00072 00074 void stop(); 00075 00077 void step( OpenRAVE::dReal step_period); 00078 00080 void reset(); 00081 00082 private: 00084 void startViewer(); 00085 std::string environment_file; 00086 OpenRAVE::EnvironmentBasePtr penv; 00087 OpenRAVE::ViewerBasePtr pviewer; 00088 boost::thread * pthviewer; 00089 std::vector< OpenRAVE::RobotBasePtr > robots; 00090 bool show_simulation; 00091 }; 00092 } 00093 00094 #endif //-- SIMULATION_OPENRAVE_H
1.7.4