From 1f75913b1a384745c7d9580e91eb54ae3470e3d7 Mon Sep 17 00:00:00 2001 From: Steve Macenski Date: Mon, 10 Jul 2023 16:33:45 +0200 Subject: [PATCH] Update costmap_2d_ros.cpp --- nav2_costmap_2d/src/costmap_2d_ros.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nav2_costmap_2d/src/costmap_2d_ros.cpp b/nav2_costmap_2d/src/costmap_2d_ros.cpp index feedb552c2..0d7b442a8a 100644 --- a/nav2_costmap_2d/src/costmap_2d_ros.cpp +++ b/nav2_costmap_2d/src/costmap_2d_ros.cpp @@ -338,9 +338,7 @@ Costmap2DROS::on_cleanup(const rclcpp_lifecycle::State & /*state*/) costmap_publisher_.reset(); clear_costmap_service_.reset(); - for (auto & layer_pub : layer_publishers_) { - layer_pub.reset(); - } + layer_publishers_.clear(); layered_costmap_.reset();