From fdb6244e474b2ca9041e6a1f3a823c1c0a97dd88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Aguizo?= Date: Tue, 18 Jul 2023 20:12:56 +0100 Subject: [PATCH] Fix illegal bounds change warning. (#64) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Aguizo --- polygon_layer/src/polygon_layer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/polygon_layer/src/polygon_layer.cpp b/polygon_layer/src/polygon_layer.cpp index 8539368..ab71211 100644 --- a/polygon_layer/src/polygon_layer.cpp +++ b/polygon_layer/src/polygon_layer.cpp @@ -157,10 +157,10 @@ void PolygonLayer::updateBounds(double robot_x, double robot_y, double robot_yaw if (!activated_ || !enabled_ || polygon_.polygon.points.empty()) { return; } - *min_x = min_x_; - *min_y = min_y_; - *max_x = max_x_; - *max_y = max_y_; + *min_x = std::min(*min_x, min_x_); + *min_y = std::min(*min_y, min_y_); + *max_x = std::max(*max_x, max_x_); + *max_y = std::max(*max_y, max_y_); MarkCell marker(costmap_, LETHAL_OBSTACLE); for (unsigned int i = 0, j = polygon_.polygon.points.size()-1; i < polygon_.polygon.points.size(); j = i++) {