diff --git a/nav2_costmap_2d/src/costmap_layer.cpp b/nav2_costmap_2d/src/costmap_layer.cpp index 1179454d6f3..3f9da4013d8 100644 --- a/nav2_costmap_2d/src/costmap_layer.cpp +++ b/nav2_costmap_2d/src/costmap_layer.cpp @@ -69,7 +69,7 @@ void CostmapLayer::clearArea(int start_x, int start_y, int end_x, int end_y, boo bool xrange = x > start_x && x < end_x; for (int y = 0; y < static_cast(getSizeInCellsY()); y++) { - if ((xrange && y > start_y && y < end_y) != invert) { + if ((xrange && y > start_y && y < end_y) == invert) { continue; } int index = getIndex(x, y);