MRPT  2.0.4
CIncrementalMapPartitioner_unittest.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 <gtest/gtest.h>
11 #include <mrpt/maps/CSimpleMap.h>
13 #include <mrpt/system/filesystem.h>
14 #include <test_mrpt_common.h>
15 
16 TEST(CIncrementalMapPartitioner, test_dataset)
17 {
19 
20  // Options:
21  imp.options.partitionThreshold = 0.5;
22  imp.options.mrp.maxDistForCorr = 0.2f;
23  imp.options.mrp.maxMahaDistForCorr = 10.0f;
25 
26  const std::string map_file =
27  mrpt::UNITTEST_BASEDIR +
28  std::string("/share/mrpt/datasets/malaga-cs-fac-building.simplemap.gz");
29  ASSERT_FILE_EXISTS_(map_file);
30 
31  mrpt::maps::CSimpleMap in_map, out_map;
32  in_map.loadFromFile(map_file);
33 
34  for (const auto& pair : in_map)
35  {
36  const auto& [posePDF, sf] = pair;
37  imp.addMapFrame(*sf, *posePDF);
38  }
39 
40  std::vector<std::vector<uint32_t>> parts;
41  imp.updatePartitions(parts);
42 
43  EXPECT_EQ(parts.size(), 2UL);
44  if (parts.size() != 2UL) return;
45 
46  const std::vector<uint32_t>
47  expected_p0 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
48  13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
49  26, 27, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
50  73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
51  86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98},
52  expected_p1 = {28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
53  40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
54  52, 53, 54, 55, 56, 57, 58, 59, 60, 61};
55 
56  EXPECT_EQ(parts[0], expected_p0);
57  EXPECT_EQ(parts[1], expected_p1);
58 }
void updatePartitions(std::vector< std::vector< uint32_t >> &partitions)
Recalculate the map/graph partitions.
mrpt::maps::TMatchingRatioParams mrp
These parameters are loaded/saved to config files with the prefix "mrp.{param_name}".
This class stores a sequence of <Probabilistic Pose,SensoryFrame> pairs, thus a "metric map" can be t...
Definition: CSimpleMap.h:32
uint32_t addMapFrame(const mrpt::obs::CSensoryFrame &frame, const mrpt::poses::CPose3DPDF &robotPose3D)
Insert a new keyframe to the graph.
bool loadFromFile(const std::string &filName)
Load the contents of this object from a .simplemap binary file (possibly compressed with gzip) ...
Definition: CSimpleMap.cpp:297
float maxDistForCorr
(Default: 0.10f) The minimum distance between 2 non-probabilistic map elements for counting them as a...
similarity_method_t simil_method
Defines the method for determining the adjacency matrix values.
double partitionThreshold
!< N-cut partition threshold [0,2] (default=1)
TEST(CIncrementalMapPartitioner, test_dataset)
Finds partitions in metric maps based on N-cut graph partition theory.
EXPECT_EQ(out.image_pair_was_used.size(), NUM_IMGS)
float maxMahaDistForCorr
(Default: 2.0f) The minimum Mahalanobis distance between 2 probabilistic map elements for counting th...
#define ASSERT_FILE_EXISTS_(FIL)
Definition: filesystem.h:22



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