00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2010 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, 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 CBoardENoses_H 00030 #define CBoardENoses_H 00031 00032 #include <mrpt/hwdrivers/CInterfaceFTDIMessages.h> 00033 #include <mrpt/hwdrivers/CGenericSensor.h> 00034 00035 #include <mrpt/slam/CObservationGasSensors.h> 00036 #include <mrpt/utils/CConfigFileBase.h> 00037 00038 00039 namespace mrpt 00040 { 00041 namespace hwdrivers 00042 { 00043 /** A class for interfacing an e-Noses via a FTDI USB link. 00044 * Implemented for the board v1.0 designed by 2007 @ ISA (University of Malaga). 00045 * 00046 * \code 00047 * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS: 00048 * ------------------------------------------------------- 00049 * [supplied_section_name] 00050 * USB_serialname=ENOSE001 00051 * 00052 * ; 3D position (in meters) of the master +slave eNoses 00053 * enose_poses_x=<MASTER X> <SLAVE#1 X> <SLAVE#2 X> <SLAVE#3 X>... 00054 * enose_poses_y=<MASTER Y> <SLAVE#1 Y> <SLAVE#2 Y> <SLAVE#3 Y>... 00055 * enose_poses_z=<MASTER Z> <SLAVE#1 Z> <SLAVE#2 Z> <SLAVE#3 Z>... 00056 * 00057 * ; 3D pose angles (in degrees) of the master +slave eNoses 00058 * enose_poses_yaw=<MASTER YAW> <SLAVE#1 YAW> <SLAVE#2 YAW> <SLAVE#3 YAW>... 00059 * enose_poses_pitch=<MASTER PITCH> <SLAVE#1 PITCH> <SLAVE#2 PITCH> <SLAVE#3 PITCH>... 00060 * enose_poses_roll=<MASTER ROLL> <SLAVE#1 ROLL> <SLAVE#2 ROLL> <SLAVE#3 ROLL>... 00061 * 00062 * \endcode 00063 * 00064 */ 00065 class HWDLLIMPEXP CBoardENoses : public mrpt::hwdrivers::CGenericSensor, public mrpt::hwdrivers::CInterfaceFTDIMessages 00066 { 00067 DEFINE_GENERIC_SENSOR(CBoardENoses) 00068 00069 protected: 00070 /** A copy of the device serial number (to open the USB FTDI chip) 00071 */ 00072 std::string m_usbSerialNumber; 00073 std::string m_sensorLabel; 00074 00075 /** The 3D pose of the master + N slave eNoses on the robot (meters & radians) 00076 */ 00077 std::vector<float> enose_poses_x,enose_poses_y,enose_poses_z,enose_poses_yaw,enose_poses_pitch,enose_poses_roll; 00078 00079 /** Tries to connect to the USB device (if disconnected). 00080 * \return True on connection OK, false on error. 00081 */ 00082 bool checkConnectionAndConnect(); 00083 00084 /** Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) 00085 * See hwdrivers::CBoardENoses for the possible parameters 00086 */ 00087 void loadConfig_sensorSpecific( 00088 const mrpt::utils::CConfigFileBase &configSource, 00089 const std::string §ion ); 00090 00091 public: 00092 /** Constructor 00093 * \param serialNumberUSBdevice The serial number (text) of the device to open. 00094 * The constructor will try to open the device. You can check if it failed calling "isOpen()". 00095 */ 00096 CBoardENoses( ); 00097 00098 /** Destructor 00099 */ 00100 virtual ~CBoardENoses(); 00101 00102 /** Query the firmware version on the device (can be used to test communications). 00103 * \return true on success, false on communications errors or device not found. 00104 */ 00105 bool queryFirmwareVersion( std::string &out_firmwareVersion ); 00106 00107 /** Request the master eNose the latest readings from all the eNoses. 00108 * The output observation contains a valid timestamp and 3D positions if "loadConfig" has been called previously. 00109 * \return true if OK, false if there were any error. 00110 */ 00111 bool getObservation( mrpt::slam::CObservationGasSensors &outObservation ); 00112 00113 00114 /** This method should be called periodically (at least at 1Hz to capture ALL the real-time data) 00115 * It is thread safe, i.e. you can call this from one thread, then to other methods from other threads. 00116 */ 00117 void doProcess(); 00118 00119 /** Tries to open the camera, after setting all the parameters with a call to loadConfig. 00120 * \exception This method must throw an exception with a descriptive message if some critical error is found. 00121 */ 00122 virtual void initialize(); 00123 00124 00125 00126 }; // end of class 00127 } // end of namespace 00128 } // end of namespace 00129 00130 00131 #endif 00132 00133
| Page generated by Doxygen 1.6.2 for MRPT 0.8.1 SVN:exported at Mon Feb 15 22:01:07 UTC 2010 |
