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