MRPT  2.0.4
observations_overlap.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "slam-precomp.h" // Precompiled headers
11 
12 #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 auto* this_obs = static_cast<const CObservation2DRangeScan*>(o1);
34  const auto* obs = static_cast<const CObservation2DRangeScan*>(o2);
35 
36  const auto* map1 =
38  const auto* map2 = obs->buildAuxPointsMap<mrpt::maps::CPointsMap>();
39 
40  // if PDF is available, get "mean" value as an estimation:
41  CPose3D otherObsPose;
42  if (pose_o2_wrt_o1) otherObsPose = *pose_o2_wrt_o1;
43 
44  mrpt::tfest::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, matchParams, matchExtraResults);
54 
55  return matchExtraResults.correspondencesRatio;
56  }
57  else
58  {
59  // No idea...
60  return 0;
61  }
62 }
63 
64 /** Estimates the "overlap" or "matching ratio" of two set of observations
65  * (range [0,1]), possibly taking into account their relative positions.
66  * This method computes the average between each of the observations in each
67  * SF.
68  * \note This is used in mrpt::slam::CIncrementalMapPartitioner
69  */
72  [[maybe_unused]] const mrpt::poses::CPose3D* pose_sf2_wrt_sf1)
73 {
74  // Return the average value:
75  size_t N = 0;
76  double accum = 0;
77  for (const auto& i1 : sf1)
78  {
79  for (const auto& i2 : sf2)
80  {
81  accum += observationsOverlap(i1, i2);
82  N++;
83  }
84  }
85  return N ? (accum / N) : 0;
86 }
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.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
Definition: CPointsMap.h:67
Additional results from the determination of matchings between point clouds, etc., apart from the pairings themselves.
A list of TMatchingPair.
Definition: TMatchingPair.h:70
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:51
float maxDistForCorrespondence
Maximum linear distance between two points to be paired (meters)
#define IS_CLASS(obj, class_name)
True if the given reference to object (derived from mrpt::rtti::CObject) is of the given class...
Definition: CObject.h:146
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:85
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:43
Parameters for the determination of matchings between point clouds, etc.



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020