00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef CHokuyoURG_H
00029 #define CHokuyoURG_H
00030
00031 #include <mrpt/poses/CPose3D.h>
00032 #include <mrpt/hwdrivers/C2DRangeFinderAbstract.h>
00033
00034 namespace mrpt
00035 {
00036 namespace hwdrivers
00037 {
00060 class HWDLLIMPEXP CHokuyoURG : public C2DRangeFinderAbstract
00061 {
00062 DEFINE_GENERIC_SENSOR(CHokuyoURG)
00063 public:
00064
00066 struct TSensorInfo
00067 {
00068 std::string model;
00069 double d_min,d_max;
00070 int scans_per_360deg;
00071 int scan_first,scan_last, scan_front;
00072 int motor_speed_rpm;
00073 };
00074
00075 private:
00078 int m_firstRange,m_lastRange;
00079
00082 int m_motorSpeed_rpm;
00083
00086 poses::CPose3D m_sensorPose;
00087
00088 std::vector<char> m_rx_buffer;
00089 int m_rx_idx,m_wr_idx;
00090
00091 std::string m_lastSentMeasCmd;
00092
00096 bool enableSCIP20();
00097
00101 bool setHighBaudrate();
00102
00106 bool switchLaserOn();
00107
00111 bool switchLaserOff();
00112
00116 bool setMotorSpeed(int motoSpeed_rpm);
00117
00121 bool displayVersionInfo( );
00122
00127 bool displaySensorInfo( CHokuyoURG::TSensorInfo * out_data = NULL );
00128
00133 bool startScanningMode();
00134
00136 void initialize();
00137
00141 bool receiveResponse(
00142 const char *sentCmd_forEchoVerification,
00143 char &rcv_status0,
00144 char &rcv_status1,
00145 char *rcv_data,
00146 int &rcv_dataLength);
00147
00148
00152 bool assureBufferHasBytes(const int &nDesiredBytes);
00153
00154 public:
00157 CHokuyoURG();
00158
00160 virtual ~CHokuyoURG();
00161
00165 void doProcessSimple(
00166 bool &outThereIsObservation,
00167 mrpt::slam::CObservation2DRangeScan &outObservation,
00168 bool &hardwareError );
00169
00173 void loadConfig(
00174 const mrpt::utils::CConfigFileBase &configSource,
00175 const std::string &iniSection );
00176
00180 bool turnOn();
00181
00185 bool turnOff();
00186
00188 void purgeBuffers();
00189
00190
00191 std::string m_com_port;
00192
00193
00194 protected:
00197 bool checkCOMisOpen();
00198
00200 TSensorInfo m_sensor_info;
00201
00202 bool m_I_am_owner_serial_port;
00203
00204 uint32_t m_timeStartUI;
00205 mrpt::system::TTimeStamp m_timeStartTT;
00206
00207 std::string m_sensorLabel;
00208
00209 };
00210
00211 }
00212
00213 }
00214
00215 #endif