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 #ifndef COBSERVATION_H 00029 #define COBSERVATION_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/system/os.h> 00033 #include <mrpt/system/datetime.h> 00034 00035 /** The main namespace for all the Mobile Robot Programming Toolkit (MRPT) C++ libraries. */ 00036 namespace mrpt 00037 { 00038 namespace poses 00039 { 00040 class CPosePDF; 00041 class CPose2D; 00042 class CPose3D; 00043 } 00044 00045 namespace math { struct TPose3D; } 00046 00047 /** This namespace contains algorithms for SLAM, localization, map building, representation of robot's actions and observations, and representation of many kinds of metric maps. 00048 */ 00049 namespace slam 00050 { 00051 using namespace poses; 00052 00053 /** Used for CObservationBearingRange::TMeasurement::beaconID 00054 */ 00055 #define INVALID_LANDMARK_ID (-1) 00056 00057 /** Used for CObservationBeaconRange 00058 */ 00059 #define INVALID_BEACON_ID (-1) 00060 00061 class CMetricMap; 00062 class CObservation; 00063 00064 /** Declares a class that represents any robot's observation. 00065 This is a base class for many types of sensors 00066 observations. Users can add a new observation type 00067 creating a new class deriving from this one.<br> 00068 <b>IMPORTANT</b>: Observations doesn't include any information about the 00069 robot pose beliefs, just the raw observation and, where 00070 aplicable, information about sensor position or 00071 orientation respect to robotic coordinates origin. 00072 * 00073 * \sa CSensoryFrame, CMetricMap 00074 */ 00075 class MRPTDLLIMPEXP CObservation : public mrpt::utils::CSerializable 00076 { 00077 // This must be added to any CSerializable derived class: 00078 DEFINE_VIRTUAL_SERIALIZABLE( CObservation ) 00079 00080 public: 00081 00082 /** Constructor: It sets the initial timestamp to current time 00083 */ 00084 CObservation(); 00085 00086 /** Inserts a pure virtual method for finding the likelihood between this 00087 * and another observation, probably only of the same derived class. The operator 00088 * may be asymmetric. 00089 * 00090 * \param anotherObs The other observation to compute likelihood with. 00091 * \param anotherObsPose If known, the belief about the robot pose when the other observation was taken can be supplied here, or NULL if it is unknown. 00092 * 00093 * \return Returns a likelihood measurement, in the range [0,1]. 00094 * \exception std::exception On any error, as another observation being of an invalid class. 00095 */ 00096 virtual float likelihoodWith( const CObservation *anotherObs, const CPosePDF *anotherObsPose = NULL ) const = 0; 00097 00098 00099 /** This method is equivalent to: 00100 * \code 00101 * map->insertObservation(this, robotPose) 00102 * \endcode 00103 * \param theMap The map where this observation is to be inserted: the map will be updated. 00104 * \param robotPose The pose of the robot base for this observation, relative to the target metric map. Set to NULL (default) to use (0,0,0deg) 00105 * 00106 * \return Returns true if the map has been updated, or false if this observations 00107 * has nothing to do with a metric map (for example, a sound observation). 00108 * 00109 * \sa CMetricMap::insertObservation 00110 */ 00111 bool insertObservationInto( CMetricMap *theMap, const CPose3D *robotPose = NULL ) const; 00112 00113 /** The associated time-stamp. 00114 */ 00115 mrpt::system::TTimeStamp timestamp; 00116 00117 /** An arbitrary label that can be used to identify the sensor. 00118 */ 00119 std::string sensorLabel; 00120 00121 /** A general method to retrieve the sensor pose on the robot. 00122 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00123 * \sa setSensorPose 00124 */ 00125 virtual void getSensorPose( CPose3D &out_sensorPose ) const = 0; 00126 00127 /** A general method to retrieve the sensor pose on the robot. 00128 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00129 * \sa setSensorPose 00130 */ 00131 void getSensorPose( mrpt::math::TPose3D &out_sensorPose ) const; 00132 00133 /** A general method to change the sensor pose on the robot. 00134 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00135 * \sa getSensorPose 00136 */ 00137 virtual void setSensorPose( const CPose3D &newSensorPose ) = 0; 00138 00139 /** A general method to change the sensor pose on the robot. 00140 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00141 * \sa getSensorPose 00142 */ 00143 void setSensorPose( const mrpt::math::TPose3D &newSensorPose ); 00144 00145 }; // End of class def. 00146 00147 DEFINE_SERIALIZABLE_PRE( CObservation ) 00148 00149 00150 } // End of namespace 00151 } // End of namespace 00152 00153 #endif
| Page generated by Doxygen 1.6.2 for MRPT 0.8.1 SVN:exported at Mon Feb 15 22:01:07 UTC 2010 |
