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 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 #include <mrpt/math/CPolygon.h> 00038 00039 00040 namespace mrpt 00041 { 00042 namespace slam 00043 { 00044 00045 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CObservation2DRangeScan, CObservation ) 00046 00047 00054 class MRPTDLLIMPEXP CObservation2DRangeScan : public CObservation 00055 { 00056 // This must be added to any CSerializable derived class: 00057 DEFINE_SERIALIZABLE( CObservation2DRangeScan ) 00058 00059 public: 00060 class CAuxMapWrapper 00061 { 00062 CPointsMap *auxPointsMap; 00063 public: 00064 CAuxMapWrapper() :auxPointsMap(NULL) { } 00065 CAuxMapWrapper(const CAuxMapWrapper &o) : auxPointsMap(NULL) { } 00066 CAuxMapWrapper & operator =(const CAuxMapWrapper &o) { clear(); return *this; } 00067 00068 ~CAuxMapWrapper() { clear(); } 00069 00070 void clear() { if (auxPointsMap) delete auxPointsMap; auxPointsMap=NULL; } 00071 00072 CPointsMap *get() { return auxPointsMap; } 00073 const CPointsMap *get() const { return auxPointsMap; } 00074 00075 void set(CPointsMap *m) { if (auxPointsMap) delete auxPointsMap; auxPointsMap = m; } 00076 00077 }; 00078 00079 protected: 00080 mutable CAuxMapWrapper m_auxMap; 00081 00082 public: 00085 CObservation2DRangeScan( ); 00086 00089 ~CObservation2DRangeScan( ); 00090 00093 vector_float scan; 00094 00098 std::vector<char> validRange; 00099 00102 float aperture; 00103 00106 bool rightToLeft; 00107 00110 float maxRange; 00111 00114 CPose3D sensorPose; 00115 00118 float stdError; 00119 00123 float beamAperture; 00124 00127 double deltaPitch; 00128 00132 const CPointsMap *getAuxPointsMap() const { return m_auxMap.get(); } 00133 00138 const CPointsMap *buildAuxPointsMap( CPointsMap::TInsertionOptions *options = NULL ) const; 00139 00142 bool isPlanarScan(const double &tolerance = 0) const; 00143 00154 float likelihoodWith( const CObservation *anotherObs, const CPosePDF *anotherObsPose = NULL ) const; 00155 00160 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; } 00161 00162 00167 void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; } 00168 00172 void truncateByDistanceAndAngle(float min_distance, float max_angle, float min_height = 0, float max_height = 0, float h = 0 ); 00173 00177 void filterByExclusionAreas( const std::vector<mrpt::math::CPolygon> &areas ); 00178 00179 00180 }; // End of class def. 00181 00182 00183 } // End of namespace 00184 } // End of namespace 00185 00186 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.6.5 SVN: at Mon Feb 23 13:25:04 EST 2009 |