Main MRPT website > C++ reference
MRPT logo

PF_aux_structs.h

Go to the documentation of this file.
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 PF_aux_structs_H
00029 #define PF_aux_structs_H
00030 
00031 #include <mrpt/utils/utils_defs.h>
00032 #include <vector>
00033 #include <iostream>
00034 #include <iterator>
00035 
00036 #include <mrpt/slam/link_pragmas.h>
00037 
00038 namespace mrpt
00039 {
00040         namespace slam
00041         {
00042                 namespace detail
00043                 {
00044                         using namespace mrpt;
00045                         using namespace mrpt::math;
00046                         using namespace std;
00047 
00048                         /** Auxiliary structure used in KLD-sampling in particle filters \sa CPosePDFParticles, CMultiMetricMapPDF */
00049                         struct SLAM_IMPEXP TPoseBin2D
00050                         {
00051                                 TPoseBin2D() : x(0),y(0),phi(0) { }
00052 
00053                                 int     x,y,phi; //!< Bin indices
00054 
00055                                 /** less-than ordering of bins for usage in STL containers */
00056                                 struct SLAM_IMPEXP lt_operator
00057                                 {
00058                                         inline bool operator()(const TPoseBin2D& s1, const TPoseBin2D& s2) const
00059                                         {
00060                                                 if (s1.x < s2.x)  return true;
00061                                                 if (s1.x > s2.x)  return false;
00062                                                 if (s1.y < s2.y)  return true;
00063                                                 if (s1.y > s2.y)  return false;
00064                                                 return s1.phi<s2.phi;
00065                                         }
00066                                 };
00067                         };
00068 
00069                         /** Auxiliary structure   */
00070                         struct SLAM_IMPEXP TPathBin2D
00071                         {
00072                                 std::vector<TPoseBin2D> bins;
00073 
00074                                 /** less-than ordering of bins for usage in STL containers */
00075                                 struct SLAM_IMPEXP lt_operator
00076                                 {
00077                                         bool operator()(const TPathBin2D& s1, const TPathBin2D& s2) const
00078                                         {
00079                                                 ASSERT_(s1.bins.size()==s2.bins.size())
00080                                                 for (size_t i=0;i<s1.bins.size();i++)
00081                                                 {
00082                                                         if (s1.bins[i].x < s2.bins[i].x)  return true;
00083                                                         if (s1.bins[i].x > s2.bins[i].x)  return false;
00084                                                         if (s1.bins[i].y < s2.bins[i].y)  return true;
00085                                                         if (s1.bins[i].y > s2.bins[i].y)  return false;
00086                                                         if (s1.bins[i].phi < s2.bins[i].phi)  return true;
00087                                                         if (s1.bins[i].phi > s2.bins[i].phi)  return false;
00088                                                         // else, keep comparing:
00089                                                 }
00090                                                 return false; // If they're exactly equal, s1 is NOT < s2.
00091                                         }
00092                                 };
00093                         };
00094 
00095                         /** Auxiliary structure used in KLD-sampling in particle filters \sa CPosePDFParticles, CMultiMetricMapPDF */
00096                         struct SLAM_IMPEXP TPoseBin3D
00097                         {
00098                                 TPoseBin3D() : x(0),y(0),z(0),yaw(0),pitch(0),roll(0) { }
00099 
00100                                 int     x,y,z,yaw,pitch,roll; //!< Bin indices
00101 
00102                                 /** less-than ordering of bins for usage in STL containers */
00103                                 struct SLAM_IMPEXP lt_operator
00104                                 {
00105                                         bool operator()(const TPoseBin3D& s1, const TPoseBin3D& s2) const
00106                                         {
00107                                                 if (s1.x < s2.x)  return true;
00108                                                 if (s1.x > s2.x)  return false;
00109                                                 if (s1.y < s2.y)  return true;
00110                                                 if (s1.y > s2.y)  return false;
00111                                                 if (s1.z < s2.z)  return true;
00112                                                 if (s1.z > s2.z)  return false;
00113                                                 if (s1.yaw < s2.yaw)  return true;
00114                                                 if (s1.yaw > s2.yaw)  return false;
00115                                                 if (s1.pitch < s2.pitch)  return true;
00116                                                 if (s1.pitch > s2.pitch)  return false;
00117                                                 return s1.roll<s2.roll;
00118                                         }
00119                                 };
00120                         };
00121 
00122 
00123                 } // End of namespace
00124         } // End of namespace
00125 } // End of namespace
00126 
00127 #endif



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011