Main MRPT website > C++ reference for MRPT 1.5.6
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-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 
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 }
56 
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1166
Extra params for insertIndividualPoint()
GLint GLint GLint GLint GLint x
Definition: glew.h:1166
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()
GLuint res
Definition: glew.h:7143
TEST(CHeightGridMap2Ds, insertCheckMapBounds)
void do_test_insertCheckMapBounds()



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018