00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2011 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 00032 #include <mrpt/obs/link_pragmas.h> 00033 00034 #include <mrpt/utils/CSerializable.h> 00035 #include <mrpt/utils/CStream.h> 00036 #include <mrpt/system/os.h> 00037 #include <mrpt/system/datetime.h> 00038 00039 /** The main namespace for all the Mobile Robot Programming Toolkit (MRPT) C++ libraries. */ 00040 namespace mrpt 00041 { 00042 namespace poses 00043 { 00044 class CPosePDF; 00045 class CPose2D; 00046 class CPose3D; 00047 } 00048 00049 namespace math { struct TPose3D; } 00050 00051 /** This namespace contains algorithms for SLAM, localization, map building, representation of robot's actions and observations, and representation of many kinds of metric maps. 00052 */ 00053 namespace slam 00054 { 00055 using namespace poses; 00056 00057 /** Used for CObservationBearingRange::TMeasurement::beaconID 00058 */ 00059 #define INVALID_LANDMARK_ID (-1) 00060 00061 /** Used for CObservationBeaconRange 00062 */ 00063 #define INVALID_BEACON_ID (-1) 00064 00065 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CObservation, mrpt::utils::CSerializable,OBS_IMPEXP ) 00066 00067 /** Declares a class that represents any robot's observation. 00068 This is a base class for many types of sensors 00069 observations. Users can add a new observation type 00070 creating a new class deriving from this one.<br> 00071 <b>IMPORTANT</b>: Observations doesn't include any information about the 00072 robot pose beliefs, just the raw observation and, where 00073 aplicable, information about sensor position or 00074 orientation respect to robotic coordinates origin. 00075 * 00076 * \sa CSensoryFrame, CMetricMap 00077 */ 00078 class OBS_IMPEXP CObservation : public mrpt::utils::CSerializable 00079 { 00080 // This must be added to any CSerializable derived class: 00081 DEFINE_VIRTUAL_SERIALIZABLE(CObservation) 00082 00083 protected: 00084 void swap(CObservation &o); //!< Swap with another observation, ONLY the data defined here in the base class CObservation. It's protected since it'll be only called from child classes that should know what else to swap appart from these common data. 00085 00086 public: 00087 00088 /** @name Data common to any observation 00089 @{ */ 00090 00091 /** The associated time-stamp. 00092 */ 00093 mrpt::system::TTimeStamp timestamp; 00094 00095 /** An arbitrary label that can be used to identify the sensor. 00096 */ 00097 std::string sensorLabel; 00098 00099 /** @} */ 00100 00101 /** Constructor: It sets the initial timestamp to current time 00102 */ 00103 CObservation(); 00104 00105 00106 /** This method is equivalent to: 00107 * \code 00108 * map->insertObservation(this, robotPose) 00109 * \endcode 00110 * \param theMap The map where this observation is to be inserted: the map will be updated. 00111 * \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) 00112 * 00113 * \return Returns true if the map has been updated, or false if this observations 00114 * has nothing to do with a metric map (for example, a sound observation). 00115 * 00116 * \sa CMetricMap, CMetricMap::insertObservation 00117 */ 00118 template <class METRICMAP> 00119 inline bool insertObservationInto( METRICMAP *theMap, const CPose3D *robotPose = NULL ) const 00120 { 00121 return theMap->insertObservation(this,robotPose); 00122 } 00123 00124 /** A general method to retrieve the sensor pose on the robot. 00125 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00126 * \sa setSensorPose 00127 */ 00128 virtual void getSensorPose( CPose3D &out_sensorPose ) const = 0; 00129 00130 /** A general method to retrieve the sensor pose on the robot. 00131 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00132 * \sa setSensorPose 00133 */ 00134 void getSensorPose( mrpt::math::TPose3D &out_sensorPose ) const; 00135 00136 /** A general method to change the sensor pose on the robot. 00137 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00138 * \sa getSensorPose 00139 */ 00140 virtual void setSensorPose( const CPose3D &newSensorPose ) = 0; 00141 00142 /** A general method to change the sensor pose on the robot. 00143 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00144 * \sa getSensorPose 00145 */ 00146 void setSensorPose( const mrpt::math::TPose3D &newSensorPose ); 00147 00148 /** @name Delayed-load manual control methods. 00149 @{ */ 00150 00151 /** Makes sure all images and other fields which may be externally stored are loaded in memory. 00152 * Note that for all CImages, calling load() is not required since the images will be automatically loaded upon first access, so load() shouldn't be needed to be called in normal cases by the user. 00153 * If all the data were alredy loaded or this object has no externally stored data fields, calling this method has no effects. 00154 * \sa unload 00155 */ 00156 virtual void load() const { /* Default implementation: do nothing */ } 00157 /** Unload all images, for the case they being delayed-load images stored in external files (othewise, has no effect). 00158 * \sa load 00159 */ 00160 virtual void unload() { /* Default implementation: do nothing */ } 00161 00162 /** @} */ 00163 00164 }; // End of class def. 00165 00166 00167 } // End of namespace 00168 } // End of namespace 00169 00170 #endif
Page generated by Doxygen 1.7.1 for MRPT 0.9.4 SVN: at Mon Jan 10 23:33:19 UTC 2011 |