From fded988ecd5f2f40d2f2dfa8948313a87bc15026 Mon Sep 17 00:00:00 2001 From: Kemal Bektas Date: Tue, 2 Jul 2024 10:04:48 +0200 Subject: [PATCH] fix(nav2_costmap_2d): make obstacle layer not current on enabled toggle Signed-off-by: Kemal Bektas --- nav2_costmap_2d/plugins/obstacle_layer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nav2_costmap_2d/plugins/obstacle_layer.cpp b/nav2_costmap_2d/plugins/obstacle_layer.cpp index cccae4d393..057acb125d 100644 --- a/nav2_costmap_2d/plugins/obstacle_layer.cpp +++ b/nav2_costmap_2d/plugins/obstacle_layer.cpp @@ -307,8 +307,11 @@ ObstacleLayer::dynamicParametersCallback( max_obstacle_height_ = parameter.as_double(); } } else if (param_type == ParameterType::PARAMETER_BOOL) { - if (param_name == name_ + "." + "enabled") { + if (param_name == name_ + "." + "enabled" && enabled_ != parameter.as_bool()) { enabled_ = parameter.as_bool(); + if (enabled_) { + current_ = false; + } } else if (param_name == name_ + "." + "footprint_clearing_enabled") { footprint_clearing_enabled_ = parameter.as_bool(); }