Skip to content

Commit 1aac01d

Browse files
authored
Merge branch 'main' into feat/charger-settings
2 parents 359022a + 332eaad commit 1aac01d

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

src/mower_map/src/mower_map_service.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -411,19 +411,24 @@ void buildMap() {
411411
for (const auto& area : map_data.areas) {
412412
if (!area.active) continue;
413413

414-
double value;
415414
if (area.type == "mow" || area.type == "nav") {
416-
value = 0.0;
417-
} else if (area.type == "obstacle") {
418-
value = 1.0;
419-
} else {
420-
continue;
415+
grid_map::Polygon poly = internalPolygonToGridMap(area.outline);
416+
for (grid_map::PolygonIterator iterator(map, poly); !iterator.isPastEnd(); ++iterator) {
417+
const grid_map::Index index(*iterator);
418+
data(index[0], index[1]) = 0.0;
419+
}
421420
}
421+
}
422422

423-
grid_map::Polygon poly = internalPolygonToGridMap(area.outline);
424-
for (grid_map::PolygonIterator iterator(map, poly); !iterator.isPastEnd(); ++iterator) {
425-
const grid_map::Index index(*iterator);
426-
data(index[0], index[1]) = value;
423+
for (const auto& area : map_data.areas) {
424+
if (!area.active) continue;
425+
426+
if (area.type == "obstacle") {
427+
grid_map::Polygon poly = internalPolygonToGridMap(area.outline);
428+
for (grid_map::PolygonIterator iterator(map, poly); !iterator.isPastEnd(); ++iterator) {
429+
const grid_map::Index index(*iterator);
430+
data(index[0], index[1]) = 1.0;
431+
}
427432
}
428433
}
429434

0 commit comments

Comments
 (0)