00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2008 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 CObservation2DRangeScan_H 00029 #define CObservation2DRangeScan_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/slam/CObservation.h> 00033 #include <mrpt/poses/CPose3D.h> 00034 #include <mrpt/poses/CPose2D.h> 00035 #include <mrpt/slam/CPointsMap.h> 00036 00037 00038 namespace mrpt 00039 { 00040 namespace slam 00041 { 00042 00043 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CObservation2DRangeScan, CObservation ) 00044 00045 00052 class MRPTDLLIMPEXP CObservation2DRangeScan : public CObservation 00053 { 00054 // This must be added to any CSerializable derived class: 00055 DEFINE_SERIALIZABLE( CObservation2DRangeScan ) 00056 00057 public: 00058 class CAuxMapWrapper 00059 { 00060 CPointsMap *auxPointsMap; 00061 public: 00062 CAuxMapWrapper() :auxPointsMap(NULL) { } 00063 CAuxMapWrapper(const CAuxMapWrapper &o) : auxPointsMap(NULL) { } 00064 CAuxMapWrapper & operator =(const CAuxMapWrapper &o) { clear(); return *this; } 00065 00066 ~CAuxMapWrapper() { clear(); } 00067 00068 void clear() { if (auxPointsMap) delete auxPointsMap; auxPointsMap=NULL; } 00069 00070 CPointsMap *get() { return auxPointsMap; } 00071 const CPointsMap *get() const { return auxPointsMap; } 00072 00073 void set(CPointsMap *m) { if (auxPointsMap) delete auxPointsMap; auxPointsMap = m; } 00074 00075 }; 00076 00077 protected: 00078 mutable CAuxMapWrapper m_auxMap; 00079 00080 public: 00083 CObservation2DRangeScan( ); 00084 00087 ~CObservation2DRangeScan( ); 00088 00091 vector_float scan; 00092 00096 std::vector<char> validRange; 00097 00100 float aperture; 00101 00104 bool rightToLeft; 00105 00108 float maxRange; 00109 00112 CPose3D sensorPose; 00113 00116 float stdError; 00117 00121 float beamAperture; 00122 00125 double deltaPitch; 00126 00130 const CPointsMap *getAuxPointsMap() const { return m_auxMap.get(); } 00131 00136 const CPointsMap *buildAuxPointsMap( CPointsMap::TInsertionOptions *options = NULL ) const; 00137 00140 bool isPlanarScan(const double &tolerance = 0) const; 00141 00152 float likelihoodWith( const CObservation *anotherObs, const CPosePDF *anotherObsPose = NULL ) const; 00153 00158 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; } 00159 00160 00165 void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; } 00166 00170 void truncateByDistanceAndAngle(float min_distance, float max_angle, float min_height = 0, float max_height = 0, float h = 0 ); 00171 00172 }; // End of class def. 00173 00174 00175 } // End of namespace 00176 } // End of namespace 00177 00178 #endif
Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN:exported at Mon Jan 12 13:00:16 UTC 2009 |