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 CBoardENoses_H 00030 #define CBoardENoses_H 00031 00032 #include <mrpt/hwdrivers/CInterfaceFTDIMessages.h> 00033 00034 #include <mrpt/slam/CObservationGasSensors.h> 00035 #include <mrpt/utils/CConfigFileBase.h> 00036 00037 00038 namespace mrpt 00039 { 00040 namespace hwdrivers 00041 { 00042 /** A class for interfacing an e-Noses via a FTDI USB link. 00043 * Implemented for the board v1.0 designed by 2007 @ ISA (University of Malaga). 00044 * 00045 * \code 00046 * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS: 00047 * ------------------------------------------------------- 00048 * [supplied_section_name] 00049 * USB_serialname=ENOSE001 00050 * 00051 * ; 3D position (in meters) of the master +slave eNoses 00052 * enose_poses_x=<MASTER X> <SLAVE#1 X> <SLAVE#2 X> <SLAVE#3 X>... 00053 * enose_poses_y=<MASTER Y> <SLAVE#1 Y> <SLAVE#2 Y> <SLAVE#3 Y>... 00054 * enose_poses_z=<MASTER Z> <SLAVE#1 Z> <SLAVE#2 Z> <SLAVE#3 Z>... 00055 * 00056 * ; 3D pose angles (in degrees) of the master +slave eNoses 00057 * enose_poses_yaw=<MASTER YAW> <SLAVE#1 YAW> <SLAVE#2 YAW> <SLAVE#3 YAW>... 00058 * enose_poses_pitch=<MASTER PITCH> <SLAVE#1 PITCH> <SLAVE#2 PITCH> <SLAVE#3 PITCH>... 00059 * enose_poses_roll=<MASTER ROLL> <SLAVE#1 ROLL> <SLAVE#2 ROLL> <SLAVE#3 ROLL>... 00060 * 00061 * \endcode 00062 * 00063 */ 00064 class HWDLLIMPEXP CBoardENoses : public hwdrivers::CInterfaceFTDIMessages 00065 { 00066 protected: 00067 /** A copy of the device serial number (to open the USB FTDI chip) 00068 */ 00069 std::string m_usbSerialNumber; 00070 00071 /** The 3D pose of the master + N slave eNoses on the robot (meters & radians) 00072 */ 00073 std::vector<float> enose_poses_x,enose_poses_y,enose_poses_z,enose_poses_yaw,enose_poses_pitch,enose_poses_roll; 00074 00075 /** Tries to connect to the USB device (if disconnected). 00076 * \return True on connection OK, false on error. 00077 */ 00078 bool checkConnectionAndConnect(); 00079 00080 public: 00081 /** Constructor 00082 * \param serialNumberUSBdevice The serial number (text) of the device to open. 00083 * The constructor will try to open the device. You can check if it failed calling "isOpen()". 00084 */ 00085 CBoardENoses( ); 00086 00087 /** Destructor 00088 */ 00089 virtual ~CBoardENoses(); 00090 00091 /** 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) 00092 * See hwdrivers::CBoardENoses for the possible parameters 00093 */ 00094 void loadConfig( 00095 const mrpt::utils::CConfigFileBase *configSource, 00096 const std::string &iniSection ); 00097 00098 /** Query the firmware version on the device (can be used to test communications). 00099 * \return true on success, false on communications errors or device not found. 00100 */ 00101 bool queryFirmwareVersion( std::string &out_firmwareVersion ); 00102 00103 /** Request the master eNose the latest readings from all the eNoses. 00104 * The output observation contains a valid timestamp and 3D positions if "loadConfig" has been called previously. 00105 * \return true if OK, false if there were any error. 00106 */ 00107 bool getObservation( mrpt::slam::CObservationGasSensors &outObservation ); 00108 00109 00110 00111 }; // end of class 00112 } // end of namespace 00113 } // end of namespace 00114 00115 00116 #endif 00117 00118
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009 |