Main MRPT website > C++ reference for 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-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
24  * [0,1]), possibly taking into account their relative positions.
25  * \note This is used in mrpt::slam::CIncrementalMapPartitioner
26  */
29  const mrpt::poses::CPose3D* pose_o2_wrt_o1)
30 {
33  {
34  const CObservation2DRangeScan* this_obs =
35  static_cast<const CObservation2DRangeScan*>(o1);
36  const CObservation2DRangeScan* obs =
37  static_cast<const CObservation2DRangeScan*>(o2);
38 
39  const CPointsMap* map1 =
41  const CPointsMap* map2 =
43 
44  // if PDF is available, get "mean" value as an estimation:
45  CPose3D otherObsPose;
46  if (pose_o2_wrt_o1) otherObsPose = *pose_o2_wrt_o1;
47 
48  mrpt::utils::TMatchingPairList correspondences;
49  mrpt::maps::TMatchingParams matchParams;
50  mrpt::maps::TMatchingExtraResults matchExtraResults;
51 
52  matchParams.maxDistForCorrespondence = 0.04f;
53  matchParams.maxAngularDistForCorrespondence = 0;
54  map1->determineMatching3D(
55  map2, // The other map
56  otherObsPose, // The other map pose
57  correspondences, matchParams, matchExtraResults);
58 
59  return matchExtraResults.correspondencesRatio;
60  }
61  else
62  {
63  // No idea...
64  return 0;
65  }
66 }
67 
68 /** Estimates the "overlap" or "matching ratio" of two set of observations
69  * (range [0,1]), possibly taking into account their relative positions.
70  * This method computes the average between each of the observations in each
71  * SF.
72  * \note This is used in mrpt::slam::CIncrementalMapPartitioner
73  */
76  const mrpt::poses::CPose3D* pose_sf2_wrt_sf1)
77 {
78  MRPT_UNUSED_PARAM(pose_sf2_wrt_sf1);
79  // Return the average value:
80  size_t N = 0;
81  double accum = 0;
82  for (CSensoryFrame::const_iterator i1 = sf1.begin(); i1 != sf1.end(); ++i1)
83  {
84  for (CSensoryFrame::const_iterator i2 = sf2.begin(); i2 != sf2.end();
85  ++i2)
86  {
87  accum += observationsOverlap(*i1, *i2);
88  N++;
89  }
90  }
91  return N ? (accum / N) : 0;
92 }
float maxAngularDistForCorrespondence
Allowed "angular error" (in radians): this permits larger pairing threshold distances to more distant...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
virtual void determineMatching3D(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, mrpt::utils::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 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:63
Additional results from the determination of matchings between point clouds, etc., apart from the pairings themselves.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
A list of TMatchingPair.
Definition: TMatchingPair.h:93
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:54
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...
Definition: CPoint.h:17
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:88
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:41
#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:103
std::deque< CObservation::Ptr >::const_iterator const_iterator
You can use CSensoryFrame::begin to get a iterator to the first element.
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.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019