MRPT  1.9.9
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-2018, 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::poses;
20 using namespace std;
21 
22 /** Estimates the "overlap" or "matching ratio" of two observations (range
23  * [0,1]), possibly taking into account their relative positions.
24  * \note This is used in mrpt::slam::CIncrementalMapPartitioner
25  */
28  const mrpt::poses::CPose3D* pose_o2_wrt_o1)
29 {
32  {
33  const CObservation2DRangeScan* this_obs =
34  static_cast<const CObservation2DRangeScan*>(o1);
35  const CObservation2DRangeScan* obs =
36  static_cast<const CObservation2DRangeScan*>(o2);
37 
38  const CPointsMap* map1 =
40  const CPointsMap* map2 =
42 
43  // if PDF is available, get "mean" value as an estimation:
44  CPose3D otherObsPose;
45  if (pose_o2_wrt_o1) otherObsPose = *pose_o2_wrt_o1;
46 
47  mrpt::tfest::TMatchingPairList correspondences;
48  mrpt::maps::TMatchingParams matchParams;
49  mrpt::maps::TMatchingExtraResults matchExtraResults;
50 
51  matchParams.maxDistForCorrespondence = 0.04f;
52  matchParams.maxAngularDistForCorrespondence = 0;
53  map1->determineMatching3D(
54  map2, // The other map
55  otherObsPose, // The other map pose
56  correspondences, matchParams, matchExtraResults);
57 
58  return matchExtraResults.correspondencesRatio;
59  }
60  else
61  {
62  // No idea...
63  return 0;
64  }
65 }
66 
67 /** Estimates the "overlap" or "matching ratio" of two set of observations
68  * (range [0,1]), possibly taking into account their relative positions.
69  * This method computes the average between each of the observations in each
70  * SF.
71  * \note This is used in mrpt::slam::CIncrementalMapPartitioner
72  */
75  const mrpt::poses::CPose3D* pose_sf2_wrt_sf1)
76 {
77  MRPT_UNUSED_PARAM(pose_sf2_wrt_sf1);
78  // Return the average value:
79  size_t N = 0;
80  double accum = 0;
81  for (CSensoryFrame::const_iterator i1 = sf1.begin(); i1 != sf1.end(); ++i1)
82  {
83  for (CSensoryFrame::const_iterator i2 = sf2.begin(); i2 != sf2.end();
84  ++i2)
85  {
86  accum += observationsOverlap(*i1, *i2);
87  N++;
88  }
89  }
90  return N ? (accum / N) : 0;
91 }
float maxAngularDistForCorrespondence
Allowed "angular error" (in radians): this permits larger pairing threshold distances to more distant...
const POINTSMAP * buildAuxPointsMap(const void *options=nullptr) const
Returns a cached points map representing this laser scan, building it upon the first call...
double observationsOverlap(const mrpt::obs::CObservation *o1, const mrpt::obs::CObservation *o2, const mrpt::poses::CPose3D *pose_o2_wrt_o1=nullptr)
Estimates the "overlap" or "matching ratio" of two observations (range [0,1]), possibly taking into a...
STL namespace.
const_iterator begin() const
Returns a constant iterator to the first observation: this is an example of usage: ...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
Definition: CPointsMap.h:64
Additional results from the determination of matchings between point clouds, etc., apart from the pairings themselves.
A list of TMatchingPair.
Definition: TMatchingPair.h:81
std::deque< CObservation::Ptr >::const_iterator const_iterator
You can use CSensoryFrame::begin to get a iterator to the first element.
This namespace contains representation of robot actions and observations.
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
Definition: CSensoryFrame.h:52
float maxDistForCorrespondence
Maximum linear distance between two points to be paired (meters)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
float correspondencesRatio
The ratio [0,1] of points in otherMap with at least one correspondence.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:86
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:43
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::rtti::CObject) is of the give...
Definition: CObject.h:102
virtual void determineMatching3D(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, mrpt::tfest::TMatchingPairList &correspondences, const TMatchingParams &params, TMatchingExtraResults &extraResults) const override
Computes the matchings between this and another 3D points map - method used in 3D-ICP.
const_iterator end() const
Returns a constant iterator to the end of the list of observations: this is an example of usage: ...
Parameters for the determination of matchings between point clouds, etc.
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
Definition: common.h:186



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020