From bf18d3ae8b014b978c96c3e99a81a8a85d73349e Mon Sep 17 00:00:00 2001 From: Steve Macenski Date: Thu, 17 Nov 2022 15:03:20 -0800 Subject: [PATCH] adding getCostScalingFactor (#3290) --- nav2_costmap_2d/include/nav2_costmap_2d/inflation_layer.hpp | 5 +++++ nav2_costmap_2d/plugins/inflation_layer.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/nav2_costmap_2d/include/nav2_costmap_2d/inflation_layer.hpp b/nav2_costmap_2d/include/nav2_costmap_2d/inflation_layer.hpp index 5f68dcaed12..c330cd4ef6c 100644 --- a/nav2_costmap_2d/include/nav2_costmap_2d/inflation_layer.hpp +++ b/nav2_costmap_2d/include/nav2_costmap_2d/inflation_layer.hpp @@ -172,6 +172,11 @@ class InflationLayer : public Layer return access_; } + double getCostScalingFactor() + { + return cost_scaling_factor_; + } + protected: /** * @brief Process updates on footprint changes to the inflation layer diff --git a/nav2_costmap_2d/plugins/inflation_layer.cpp b/nav2_costmap_2d/plugins/inflation_layer.cpp index 796c2fd62f7..067877e5484 100644 --- a/nav2_costmap_2d/plugins/inflation_layer.cpp +++ b/nav2_costmap_2d/plugins/inflation_layer.cpp @@ -442,7 +442,7 @@ InflationLayer::dynamicParametersCallback( need_reinflation_ = true; need_cache_recompute = true; } else if (param_name == name_ + "." + "cost_scaling_factor" && // NOLINT - cost_scaling_factor_ != parameter.as_double()) + getCostScalingFactor() != parameter.as_double()) { cost_scaling_factor_ = parameter.as_double(); need_reinflation_ = true;