HelpersTest.cpp
Go to the documentation of this file.
1 /*
2  * HelpersTest.cpp
3  *
4  * Created on: Nov 21, 2019
5  * Author: Edo Jelavic
6  * Institute: ETH Zurich, Robotic Systems Lab
7  */
8 
9 #include <cstdlib>
10 
11 #include <gtest/gtest.h>
12 
13 #include "grid_map_pcl/helpers.hpp"
14 
15 #include "PointcloudCreator.hpp"
16 #include "test_helpers.hpp"
17 
18 namespace grid_map {
19 namespace grid_map_pcl_test {
20 
21 TEST(HelpersTest, MeanPositionTest) {
23  const auto seed = rand();
25 
26  const unsigned int numTests = 10;
27  for (unsigned int i = 0; i < numTests; ++i) {
28  double mean, stdDev;
30  auto meanOfAllPoints = grid_map_pcl::calculateMeanOfPointPositions(cloud);
31 
32  EXPECT_NEAR(meanOfAllPoints.x(), mean, 3 * stdDev);
33  EXPECT_NEAR(meanOfAllPoints.y(), mean, 3 * stdDev);
34  EXPECT_NEAR(meanOfAllPoints.z(), mean, 3 * stdDev);
35  }
36 
37  if (::testing::Test::HasFailure()) {
38  std::cout << "\n Test MeanPositionTest failed with seed: " << seed << std::endl;
39  }
40 }
41 
42 } /*namespace grid_map_pcl_test */
43 } // namespace grid_map
Eigen::Vector3d calculateMeanOfPointPositions(Pointcloud::ConstPtr inputCloud)
Definition: helpers.cpp:138
TEST(GridMapPclLoaderTest, FlatGroundRealDataset)
void setVerbosityLevel(ros::console::levels::Level level)
static Pointcloud::Ptr createBlobOfPoints(double *mean, double *stdDev)


grid_map_pcl
Author(s): Dominic Jud , Edo Jelavic
autogenerated on Tue Jun 1 2021 02:13:43