Main MRPT website > C++ reference for MRPT 1.5.7
observations_overlap.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include "slam-precomp.h" // Precompiled headers
11 
13 #include <mrpt/maps/CPointsMap.h>
15 
16 using namespace mrpt::slam;
17 using namespace mrpt::maps;
18 using namespace mrpt::obs;
19 using namespace mrpt::utils;
20 using namespace mrpt::poses;
21 using namespace std;
22 
23 /** Estimates the "overlap" or "matching ratio" of two observations (range [0,1]), possibly taking into account their relative positions.
24  * \note This is used in mrpt::slam::CIncrementalMapPartitioner
25  */
27  const mrpt::obs::CObservation* o1,
28  const mrpt::obs::CObservation* o2,
29  const mrpt::poses::CPose3D *pose_o2_wrt_o1 )
30 {
32  {
33  const CObservation2DRangeScan *this_obs = static_cast<const CObservation2DRangeScan *>(o1);
34  const CObservation2DRangeScan *obs = static_cast<const CObservation2DRangeScan *>(o2);
35 
36  const CPointsMap *map1 = this_obs->buildAuxPointsMap<mrpt::maps::CPointsMap>();
38 
39  // if PDF is available, get "mean" value as an estimation:
40  CPose3D otherObsPose;
41  if (pose_o2_wrt_o1)
42  otherObsPose = *pose_o2_wrt_o1;
43 
44  mrpt::utils::TMatchingPairList correspondences;
45  mrpt::maps::TMatchingParams matchParams;
46  mrpt::maps::TMatchingExtraResults matchExtraResults;
47 
48  matchParams.maxDistForCorrespondence = 0.04f;
49  matchParams.maxAngularDistForCorrespondence = 0;
50  map1->determineMatching3D(
51  map2, // The other map
52  otherObsPose, // The other map pose
53  correspondences,
54  matchParams, matchExtraResults);
55 
56  return matchExtraResults.correspondencesRatio;
57  }
58  else
59  {
60  // No idea...
61  return 0;
62  }
63 
64 }
65 
66 /** Estimates the "overlap" or "matching ratio" of two set of observations (range [0,1]), possibly taking into account their relative positions.
67  * This method computes the average between each of the observations in each SF.
68  * \note This is used in mrpt::slam::CIncrementalMapPartitioner
69  */
71  const mrpt::obs::CSensoryFrame &sf1,
72  const mrpt::obs::CSensoryFrame &sf2,
73  const mrpt::poses::CPose3D *pose_sf2_wrt_sf1 )
74 {
75  MRPT_UNUSED_PARAM(pose_sf2_wrt_sf1);
76  // Return the average value:
77  size_t N=0;
78  double accum = 0;
79  for (CSensoryFrame::const_iterator i1=sf1.begin();i1!=sf1.end();++i1)
80  {
81  for (CSensoryFrame::const_iterator i2=sf2.begin();i2!=sf2.end();++i2)
82  {
83  accum += observationsOverlap(*i1,*i2);
84  N++;
85  }
86  }
87  return N ? (accum/N) : 0;
88 }
89 
90 
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
Definition: CObject.h:93
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
virtual void determineMatching3D(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, mrpt::utils::TMatchingPairList &correspondences, const TMatchingParams &params, TMatchingExtraResults &extraResults) const MRPT_OVERRIDE
Computes the matchings between this and another 3D points map - method used in 3D-ICP.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
const POINTSMAP * buildAuxPointsMap(const void *options=NULL) const
Returns a cached points map representing this laser scan, building it upon the first call.
Declares a class that represents any robot's observation.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
const_iterator end() const
Returns a constant iterator to the end of the list of observations: this is an example of usage:
const_iterator begin() const
Returns a constant iterator to the first observation: this is an example of usage:
std::deque< CObservationPtr >::const_iterator const_iterator
You can use CSensoryFrame::begin to get a iterator to the first element.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:73
A list of TMatchingPair.
Definition: TMatchingPair.h:79
double SLAM_IMPEXP observationsOverlap(const mrpt::obs::CObservation *o1, const mrpt::obs::CObservation *o2, const mrpt::poses::CPose3D *pose_o2_wrt_o1=NULL)
Estimates the "overlap" or "matching ratio" of two observations (range [0,1]), possibly taking into a...
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
Definition: mrpt_macros.h:307
This namespace contains representation of robot actions and observations.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:18
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
Definition: zip.h:16
Additional results from the determination of matchings between point clouds, etc.,...
float correspondencesRatio
The ratio [0,1] of points in otherMap with at least one correspondence.
Parameters for the determination of matchings between point clouds, etc.
float maxDistForCorrespondence
Maximum linear distance between two points to be paired (meters)
float maxAngularDistForCorrespondence
Allowed "angular error" (in radians): this permits larger pairing threshold distances to more distant...



Page generated by Doxygen 1.9.1 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at mar 26 may 2026 13:12:03 CEST