MapBasedRandomSpaceSampler.cpp
Go to the documentation of this file.
1 
21 
22 namespace next_best_view {
23 
25  {
27 
28  SamplePoint currentSamplePoint;
29  currentSamplePoint.x = currentSpacePosition[0];
30  currentSamplePoint.y = currentSpacePosition[1];
31  pointCloud->push_back(currentSamplePoint);
32 
33  double width = mMapHelperPtr->getMetricWidth() * contractor;
34  double height = mMapHelperPtr->getMetricHeight() * contractor;
35 
36  while (pointCloud->size() < mSampleSize)
37  {
38  //random numbers between -1 and 1;
39  double xRandom = ((double) std::rand() / (RAND_MAX)) * 2 - 1;
40  double yRandom = ((double) std::rand() / (RAND_MAX)) * 2 - 1;
41 
42  SimpleVector3 randomPoint(currentSpacePosition[0] + xRandom * width, currentSpacePosition[1] + yRandom * height, currentSpacePosition[2]);
43 
44  //make sure randomPoint does not intersect with an obstacle and is inside the map
45  int8_t occupancyValue = mMapHelperPtr->getRaytracingMapOccupancyValue(randomPoint);
46  if (mMapHelperPtr->isOccupancyValueAcceptable(occupancyValue))
47  {
48  SamplePoint samplePoint;
49  samplePoint.x = randomPoint[0];
50  samplePoint.y = randomPoint[1];
51  pointCloud->push_back(samplePoint);
52  }
53  }
54 
55  return pointCloud;
56 
57 
58  }
59 }
Eigen::Matrix< Precision, 3, 1 > SimpleVector3
Definition: typedef.hpp:53
SamplePointCloud::Ptr SamplePointCloudPtr
Definition: typedef.hpp:93
pcl::PointCloud< SamplePoint > SamplePointCloud
Definition: typedef.hpp:92
this namespace contains all generally usable classes.
SamplePointCloudPtr getSampledSpacePointCloud(SimpleVector3 currentSpacePosition=SimpleVector3(), float contractor=1.0)


asr_next_best_view
Author(s): Aumann Florian, Borella Jocelyn, Heller Florian, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Stroh Daniel, Trautmann Jeremias, Walter Milena, Wittenbeck Valerij
autogenerated on Thu Jan 9 2020 07:20:18