Skip to content

Commit b19cb4d

Browse files
GoesMGoesM_server
andauthored
completely shutdown dyn_params_handler_ (s) (#4521)
* completely shutdown dny_params_handler_ in nav2_amcl Signed-off-by: GoesM_server <[email protected]> * completely shutdown dyn_param_handler_ in controller_server Signed-off-by: goes <[email protected]> * compeletly shutdown dyn_params_handler in nav2_costmap_2d Signed-off-by: goes <[email protected]> * compeletly shutdown dyn_param_handler in nav2_docking Signed-off-by: goes <[email protected]> * completely shutdown dyn_params_handler in nav2_velocity_smoother Signed-off-by: goes <[email protected]> * compeletly shutdown dyn_param_handler in waypoint_follower Signed-off-by: goes <[email protected]> * typo fixed Signed-off-by: goes <[email protected]> * graceful-controller & dwb_controller Signed-off-by: goes <[email protected]> * mppi-controller Signed-off-by: goes <[email protected]> * navfn_planner & regulated_..controller Signed-off-by: goes <[email protected]> * rotation_..controller & samc_planners Signed-off-by: goes <[email protected]> * A*planner Signed-off-by: goes <[email protected]> * code style Signed-off-by: goes <[email protected]> * 1 Signed-off-by: goes <[email protected]> * fixed Signed-off-by: goes <[email protected]> * fix the usage of weak_ptr Signed-off-by: goes <[email protected]> * code-style Signed-off-by: goes <[email protected]> * weak_ptr released Signed-off-by: goes <[email protected]> * code style Signed-off-by: goes <[email protected]> * code style Signed-off-by: goes <[email protected]> * code style Signed-off-by: goes <[email protected]> * code style update Signed-off-by: goes <[email protected]> * back Signed-off-by: goes <[email protected]> * rebase conflict resovled Signed-off-by: goes <[email protected]> * rebase error fixed Signed-off-by: goes <[email protected]> * fixed2 Signed-off-by: goes <[email protected]> * rebase fixed 3 Signed-off-by: goes <[email protected]> * 33 Signed-off-by: goes <[email protected]> * shared_ptr into weak_ptr Signed-off-by: GoesM <[email protected]> * remove adundant node.resest() Signed-off-by: GoesM <[email protected]> --------- Signed-off-by: GoesM_server <[email protected]> Signed-off-by: goes <[email protected]> Signed-off-by: GoesM <[email protected]> Co-authored-by: GoesM_server <[email protected]>
1 parent 14e1e84 commit b19cb4d

File tree

25 files changed

+99
-4
lines changed

25 files changed

+99
-4
lines changed

nav2_amcl/src/amcl_node.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ AmclNode::on_deactivate(const rclcpp_lifecycle::State & /*state*/)
312312
pose_pub_->on_deactivate();
313313
particle_cloud_pub_->on_deactivate();
314314

315-
// reset dynamic parameter handler
315+
// shutdown and reset dynamic parameter handler
316+
remove_on_set_parameters_callback(dyn_params_handler_.get());
316317
dyn_params_handler_.reset();
317318

318319
// destroy bond connection

nav2_controller/src/controller_server.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ ControllerServer::on_deactivate(const rclcpp_lifecycle::State & /*state*/)
294294

295295
publishZeroVelocity();
296296
vel_publisher_->on_deactivate();
297+
298+
remove_on_set_parameters_callback(dyn_params_handler_.get());
297299
dyn_params_handler_.reset();
298300

299301
// destroy bond connection

nav2_costmap_2d/plugins/inflation_layer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ InflationLayer::InflationLayer()
7878

7979
InflationLayer::~InflationLayer()
8080
{
81+
auto node = node_.lock();
82+
if (dyn_params_handler_ && node) {
83+
node->remove_on_set_parameters_callback(dyn_params_handler_.get());
84+
}
8185
dyn_params_handler_.reset();
8286
delete access_;
8387
}

nav2_costmap_2d/plugins/obstacle_layer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ namespace nav2_costmap_2d
6262

6363
ObstacleLayer::~ObstacleLayer()
6464
{
65+
auto node = node_.lock();
66+
if (dyn_params_handler_ && node) {
67+
node->remove_on_set_parameters_callback(dyn_params_handler_.get());
68+
}
6569
dyn_params_handler_.reset();
6670
for (auto & notifier : observation_notifiers_) {
6771
notifier.reset();

nav2_costmap_2d/plugins/static_layer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ StaticLayer::activate()
112112
void
113113
StaticLayer::deactivate()
114114
{
115+
auto node = node_.lock();
116+
if (dyn_params_handler_ && node) {
117+
node->remove_on_set_parameters_callback(dyn_params_handler_.get());
118+
}
115119
dyn_params_handler_.reset();
116120
}
117121

nav2_costmap_2d/plugins/voxel_layer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ void VoxelLayer::onInitialize()
116116

117117
VoxelLayer::~VoxelLayer()
118118
{
119+
auto node = node_.lock();
120+
if (dyn_params_handler_ && node) {
121+
node->remove_on_set_parameters_callback(dyn_params_handler_.get());
122+
}
119123
dyn_params_handler_.reset();
120124
}
121125

nav2_costmap_2d/src/costmap_2d_ros.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ Costmap2DROS::on_deactivate(const rclcpp_lifecycle::State & /*state*/)
329329
{
330330
RCLCPP_INFO(get_logger(), "Deactivating");
331331

332+
remove_on_set_parameters_callback(dyn_params_handler.get());
332333
dyn_params_handler.reset();
333334

334335
stop();

nav2_docking/opennav_docking/src/docking_server.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ DockingServer::on_deactivate(const rclcpp_lifecycle::State & /*state*/)
131131
navigator_->deactivate();
132132
vel_publisher_->on_deactivate();
133133

134+
remove_on_set_parameters_callback(dyn_params_handler_.get());
134135
dyn_params_handler_.reset();
135136
tf2_listener_.reset();
136137

nav2_dwb_controller/dwb_plugins/include/dwb_plugins/kinematic_parameters.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class KinematicsHandler
150150
using Ptr = std::shared_ptr<KinematicsHandler>;
151151

152152
protected:
153+
nav2_util::LifecycleNode::WeakPtr node_;
153154
std::atomic<KinematicParameters *> kinematics_;
154155

155156
// Dynamic parameters handler

nav2_dwb_controller/dwb_plugins/src/kinematic_parameters.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,19 @@ KinematicsHandler::KinematicsHandler()
5656

5757
KinematicsHandler::~KinematicsHandler()
5858
{
59+
auto node = node_.lock();
60+
if (dyn_params_handler_ && node) {
61+
node->remove_on_set_parameters_callback(dyn_params_handler_.get());
62+
}
63+
dyn_params_handler_.reset();
5964
delete kinematics_.load();
6065
}
6166

6267
void KinematicsHandler::initialize(
6368
const nav2_util::LifecycleNode::SharedPtr & nh,
6469
const std::string & plugin_name)
6570
{
71+
node_ = nh;
6672
plugin_name_ = plugin_name;
6773

6874
declare_parameter_if_not_declared(nh, plugin_name + ".min_vel_x", rclcpp::ParameterValue(0.0));

0 commit comments

Comments
 (0)