Main MRPT website > C++ reference for MRPT 1.9.9
CHeightGridMap2Ds_unittest.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 
12 #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 }
do_test_insertCheckMapBounds
void do_test_insertCheckMapBounds()
Definition: CHeightGridMap2Ds_unittest.cpp:15
mrpt::maps::CHeightGridMap2D_Base::TPointInsertParams
Extra params for insertIndividualPoint()
Definition: CHeightGridMap2D_Base.h:42
do_test_insertPointsAndRead
void do_test_insertPointsAndRead()
Definition: CHeightGridMap2Ds_unittest.cpp:39
mrpt::maps::CHeightGridMap2D_Base::TPointInsertParams::update_map_after_insertion
bool update_map_after_insertion
(default: true) run any required operation to ensure the map reflects the changes caused by this poin...
Definition: CHeightGridMap2D_Base.h:51
res
GLuint res
Definition: glext.h:7268
CHeightGridMap2D.h
CHeightGridMap2D_MRF.h
y
GLenum GLint GLint y
Definition: glext.h:3538
x
GLenum GLint x
Definition: glext.h:3538
TEST
TEST(CHeightGridMap2Ds, insertCheckMapBounds)
Definition: CHeightGridMap2Ds_unittest.cpp:32



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST