Skip to content
Snippets Groups Projects
Commit 97005730 authored by Rescue Group's avatar Rescue Group
Browse files

MM: Wall search extended to find expansion if wall/restricted not available.

parent 23c91a03
Branches
No related tags found
No related merge requests found
...@@ -175,6 +175,33 @@ Point Explorer::findWall(const VoronoiGrid& voronoi, const Pose& robot, double s ...@@ -175,6 +175,33 @@ Point Explorer::findWall(const VoronoiGrid& voronoi, const Pose& robot, double s
} }
} }
for (double rayAngle = 0; rayAngle < 2*M_PIl && !CELL_IS_VALID(wallCell, voronoi); rayAngle += search.angleStep) {
if (search.side == SearchParameters::Left) {
cosRay = cos(Y + startAngle - rayAngle);
sinRay = sin(Y + startAngle - rayAngle);
} else {
cosRay = cos(Y + startAngle + rayAngle);
sinRay = sin(Y + startAngle + rayAngle);
}
for (double ray = 0; ray <= (search.searchDistance / voronoi.resolution) &&
!CELL_IS_VALID(wallCell, voronoi); ray += search.rayStep) {
cell = Index2D(robotCell.x + ray * cosRay, robotCell.y + ray * sinRay);
if (!CELL_IS_VALID(cell, voronoi))
continue;
const VoronoiGrid::VoronoiCell& vCell = voronoi.getVoronoiCell(cell);
if (vCell.status & VoronoiGrid::VoronoiCell::Wall) {
wallCell = cell;
} else if ((vCell.status & VoronoiGrid::VoronoiCell::Restricted) ||
(vCell.status & VoronoiGrid::VoronoiCell::PatiallyRestricted) ||
(vCell.status & VoronoiGrid::VoronoiCell::Expansion)) {
wallCell = vCell.nearestWallCell;
}
}
}
if (CELL_IS_VALID(wallCell, voronoi)) { if (CELL_IS_VALID(wallCell, voronoi)) {
return voronoi.getPosition(wallCell); return voronoi.getPosition(wallCell);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment