00001 #ifndef __3D_MAP_DEMON_H_ 00002 #define __3D_MAP_DEMON_H_ 00003 00004 // standard includes 00005 #include <pthread.h> 00006 #include <string> 00007 00008 //own includes 00009 //#include <cob_3d_mapping_demonstrator/MapDemonCtrl.h> 00010 #include <cob_3d_mapping_demonstrator/demonstrator_params.h> 00011 #include <cob_3d_mapping_demonstrator/serial_device.h> 00012 00013 class MapDemonCtrl 00014 { 00015 public: 00016 00018 MapDemonCtrl(DemonstratorParams * params); 00019 //MapDemonCtrl(MapDemonCtrlParams * params, SerialDevice * sd); 00020 00022 virtual ~MapDemonCtrl(); 00023 00024 pthread_mutex_t m_mutex; 00025 00026 virtual bool init(DemonstratorParams * params); 00027 00028 virtual bool isInitialized() const 00029 { 00030 return initialized_; 00031 } 00032 00033 virtual bool runCalibration() ; 00034 00035 virtual bool movePos( const std::vector<double>& target_positions ); 00036 //virtual bool MoveVel( const std::vector<double>& target_velocities ); 00037 00038 virtual std::string getErrorMessage() const 00039 { 00040 return error_message_; 00041 } 00042 00043 virtual bool close() ; 00044 virtual bool stop(); 00045 virtual bool recover() ; 00046 00048 // functions to set parameters: // 00050 00056 virtual void setVelocity() {}; 00057 bool setMaxVelocity(const std::vector<double>& velocities); 00058 00062 virtual std::vector<double> getPositions() 00063 { 00064 return positions_; 00065 } 00066 00070 virtual std::vector<double> getVelocities() 00071 { 00072 return velocities_; 00073 } 00074 00075 virtual bool updatePositions(); 00076 00077 00078 protected: 00079 bool initialized_; 00080 int device_handle_; 00081 bool serial_device_opened_; 00082 00083 DemonstratorParams* params_; 00084 00085 SerialDevice * sd_; 00086 00087 std::vector<double> positions_; 00088 std::vector<double> old_positions_; 00089 00090 std::vector<double> velocities_; 00091 00092 double encoder_; 00093 00094 ros::Time last_time_pub_; 00095 00096 std::string error_message_; 00097 00098 00099 }; 00100 00101 #endif