00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 University of Malaga | 00007 | | 00008 | This software was written by the Perception and Robotics | 00009 | research group, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 00029 #ifndef CGPSInterface_H 00030 #define CGPSInterface_H 00031 00032 #include <mrpt/slam/CObservationGPS.h> 00033 #include <mrpt/poses/CPoint3D.h> 00034 #include <mrpt/hwdrivers/CSerialPort.h> 00035 #include <mrpt/utils/CDebugOutputCapable.h> 00036 #include <mrpt/hwdrivers/CGenericSensor.h> 00037 00038 namespace mrpt 00039 { 00040 namespace slam { class CObservationGPS; } 00041 00042 namespace hwdrivers 00043 { 00070 class HWDLLIMPEXP CGPSInterface : public utils::CDebugOutputCapable, public CGenericSensor 00071 { 00072 DEFINE_GENERIC_SENSOR(CGPSInterface) 00073 00074 public: 00078 CGPSInterface( int BUFFER_LENGTH = 500 ); 00079 00082 virtual ~CGPSInterface(); 00083 00088 void doProcess(); 00089 00093 void loadConfig( 00094 const mrpt::utils::CConfigFileBase &configSource, 00095 const std::string &iniSection ); 00096 00099 bool isGPS_connected(); 00100 00103 bool isGPS_signalAcquired(); 00104 00105 protected: 00109 bool OnConnectionEstablished(); 00110 00111 /* This will be NULL on any error opening the com port: 00112 */ 00113 CSerialPort *m_COM; 00114 00115 poses::CPoint3D m_sensorPose; 00116 00117 std::string m_sensorLabel; 00118 std::string m_customInit; 00119 00120 private: 00121 std::string m_COMname; 00122 int m_COMbauds; 00123 bool m_GPS_comsWork; 00124 bool m_GPS_signalAcquired; 00125 int m_BUFFER_LENGTH; 00126 00127 char *m_buffer; 00128 size_t m_bufferLength; 00129 size_t m_bufferWritePos; 00130 00134 bool tryToOpenTheCOM(); 00135 00138 void processBuffer(); 00139 00142 void processGPSstring( const std::string &s); 00143 00146 void getNextToken( 00147 const std::string &str, 00148 std::string &token, 00149 unsigned int &parserPos); 00150 00151 /* A private copy of the last received gps datum: 00152 */ 00153 mrpt::slam::CObservationGPS m_latestGPS_data; 00154 00155 }; // end class 00156 00157 } // end namespace 00158 } // end namespace 00159 00160 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.6.5 SVN: at Mon Feb 23 13:25:04 EST 2009 |