MRPT  2.0.4
CHeightGridMap2Ds_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>
13 
14 template <class MAP>
16 {
18  pt_params.update_map_after_insertion = false;
19 
20  MAP dem; // mrpt::maps::CHeightGridMap2D dem;
21  dem.setSize(-4.0, 4.0, 0.0, 4.0, 1.0); // x:[-10,10] * y:[0,5]
22  // Inside:
23  EXPECT_TRUE(dem.insertIndividualPoint(2.0, 3.0, 56.0, pt_params));
24  EXPECT_TRUE(dem.insertIndividualPoint(-3.0, 0.4, 56.0, pt_params));
25  EXPECT_TRUE(dem.insertIndividualPoint(3.0, 3.8, 56.0, pt_params));
26  // Outside:
27  EXPECT_FALSE(dem.insertIndividualPoint(-11.0, 2.0, 56.0, pt_params));
28  EXPECT_FALSE(dem.insertIndividualPoint(11.0, 2.0, 56.0, pt_params));
29  EXPECT_FALSE(dem.insertIndividualPoint(2.0, -1.0, 56.0, pt_params));
30  EXPECT_FALSE(dem.insertIndividualPoint(2.0, 6.0, 56.0, pt_params));
31 }
32 TEST(CHeightGridMap2Ds, insertCheckMapBounds)
33 {
34  do_test_insertCheckMapBounds<mrpt::maps::CHeightGridMap2D>();
35  do_test_insertCheckMapBounds<mrpt::maps::CHeightGridMap2D_MRF>();
36 }
37 
38 template <class MAP>
40 {
41  MAP dem;
42  dem.setSize(0.0, 5.0, 0.0, 5.0, 0.5); // x:[-10,10] * y:[0,5]
43  // Inside:
44  const double x = 2.1, y = 3.1, z_write = 56.0;
45  dem.insertIndividualPoint(x, y, z_write);
46  double z_read;
47  bool res = dem.dem_get_z(x, y, z_read);
48  EXPECT_TRUE(res);
49  EXPECT_NEAR(z_read, z_write, 1e-6);
50 }
51 TEST(CHeightGridMap2Ds, insertPointsAndRead)
52 {
53  do_test_insertPointsAndRead<mrpt::maps::CHeightGridMap2D>();
54  do_test_insertPointsAndRead<mrpt::maps::CHeightGridMap2D_MRF>();
55 }
Extra params for insertIndividualPoint()
EXPECT_TRUE(mrpt::system::fileExists(ini_fil))
bool update_map_after_insertion
(default: true) run any required operation to ensure the map reflects the changes caused by this poin...
void do_test_insertPointsAndRead()
TEST(CHeightGridMap2Ds, insertCheckMapBounds)
EXPECT_NEAR(out.cam_params.rightCameraPose.x, 0.1194, 0.005)
void do_test_insertCheckMapBounds()



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 5711e29ae Wed May 27 14:29:47 2020 +0200 at miƩ may 27 14:30:10 CEST 2020