33 currentSamplePoint.x = currentSpacePosition[0];
34 currentSamplePoint.y = currentSpacePosition[1];
35 pointCloud->push_back(currentSamplePoint);
37 mDebugHelperPtr->write(std::stringstream() <<
"MapBasedHexagonSpaceSampler::getSampledSpacePointCloud contractor " << contractor,
45 float horizontalSpacing = radius * cos(M_PI / 6.0);
46 float interPointSpacing = radius;
49 int spanX = ceil(contractor * .5 * width / horizontalSpacing);
50 int spanY = ceil(contractor * .25 * height / radius);
51 int span = std::max(spanX, spanY);
59 for (
int x = -span;
x < span;
x++) {
60 for (
int y = -span;
y <= span;
y++) {
99 double offsetting = std::abs(
y) % 2 == 0 ? horizontalSpacing : 0.0;
101 SimpleVector3 upperPoint(
x * 2.0 * horizontalSpacing + offsetting, .5 * interPointSpacing +
y * 1.5 * radius, 0);
102 upperPoint[0] += currentSpacePosition[0];
103 upperPoint[1] += currentSpacePosition[1];
106 SimpleVector3 lowerPoint(
x * 2.0 * horizontalSpacing + offsetting, -.5 * interPointSpacing +
y * 1.5 * radius, 0);
107 lowerPoint[0] += currentSpacePosition[0];
108 lowerPoint[1] += currentSpacePosition[1];
111 int8_t upperOccupancyValue =
mMapHelperPtr->getRaytracingMapOccupancyValue(upperPoint);
112 int8_t lowerOccupancyValue =
mMapHelperPtr->getRaytracingMapOccupancyValue(lowerPoint);
115 if(lowerPoint[0] <
xbot)
xbot = lowerPoint[0];
116 if(lowerPoint[1] <
ybot)
ybot = lowerPoint[1];
117 if(upperPoint[0] >
xtop)
xtop = upperPoint[0];
118 if(upperPoint[1] >
ytop)
ytop = upperPoint[1];
121 if (
mMapHelperPtr->isOccupancyValueAcceptable(upperOccupancyValue)) {
123 pointCloud->push_back(samplePoint);
126 if (
mMapHelperPtr->isOccupancyValueAcceptable(lowerOccupancyValue)) {
128 pointCloud->push_back(samplePoint);
132 mDebugHelperPtr->write(std::stringstream() <<
"MapBasedHexagonSpaceSampler::size " << pointCloud->size(),
SamplePointCloudPtr getSampledSpacePointCloud(SimpleVector3 currentSpacePosition=SimpleVector3(), float contractor=1.0)
MapHelperPtr mMapHelperPtr
MapBasedHexagonSpaceSampler(const MapHelperPtr &mapHelperPtr)
constructor for CostmapBasedSpaceSampler object
Eigen::Matrix< Precision, 3, 1 > SimpleVector3
void setHexagonRadius(double radius)
TFSIMD_FORCE_INLINE const tfScalar & y() const
double getHexagonRadius()
virtual ~MapBasedHexagonSpaceSampler()
destructor for CostmapBasedSpaceSampler object
SamplePointCloud::Ptr SamplePointCloudPtr
pcl::PointCloud< SamplePoint > SamplePointCloud
DebugHelperPtr mDebugHelperPtr
this namespace contains all generally usable classes.
static boost::shared_ptr< DebugHelper > getInstance()
TFSIMD_FORCE_INLINE const tfScalar & x() const