@@ -67,6 +67,10 @@ PlannerServer::PlannerServer(const rclcpp::NodeOptions & options)
67
67
costmap_ros_ = std::make_shared<nav2_costmap_2d::Costmap2DROS>(
68
68
" global_costmap" , std::string{get_namespace ()}, " global_costmap" ,
69
69
get_parameter (" use_sim_time" ).as_bool (), options.use_intra_process_comms ());
70
+
71
+ no_waiting_costmap_ros_ = std::make_shared<nav2_costmap_2d::Costmap2DROS>(
72
+ " global_no_waiting_zones_costmap" , std::string{get_namespace ()}, " global_no_waiting_zones_costmap" ,
73
+ get_parameter (" use_sim_time" ).as_bool (), options.use_intra_process_comms ());
70
74
}
71
75
72
76
PlannerServer::~PlannerServer ()
@@ -77,6 +81,7 @@ PlannerServer::~PlannerServer()
77
81
*/
78
82
planners_.clear ();
79
83
costmap_thread_.reset ();
84
+ no_waiting_costmap_thread_.reset ();
80
85
}
81
86
82
87
nav2_util::CallbackReturn
@@ -85,6 +90,7 @@ PlannerServer::on_configure(const rclcpp_lifecycle::State & state)
85
90
RCLCPP_INFO (get_logger (), " Configuring" );
86
91
87
92
costmap_ros_->configure ();
93
+ no_waiting_costmap_ros_->configure ();
88
94
costmap_ = costmap_ros_->getCostmap ();
89
95
90
96
if (!costmap_ros_->getUseRadius ()) {
@@ -95,6 +101,7 @@ PlannerServer::on_configure(const rclcpp_lifecycle::State & state)
95
101
96
102
// Launch a thread to run the costmap node
97
103
costmap_thread_ = std::make_unique<nav2_util::NodeThread>(costmap_ros_);
104
+ no_waiting_costmap_thread_ = std::make_unique<nav2_util::NodeThread>(no_waiting_costmap_ros_);
98
105
99
106
RCLCPP_DEBUG (
100
107
get_logger (), " Costmap size: %d,%d" ,
@@ -186,6 +193,7 @@ PlannerServer::on_activate(const rclcpp_lifecycle::State & /*state*/)
186
193
plan_publisher_->on_activate ();
187
194
action_server_pose_->activate ();
188
195
action_server_poses_->activate ();
196
+ no_waiting_costmap_ros_->activate ();
189
197
const auto costmap_ros_state = costmap_ros_->activate ();
190
198
if (costmap_ros_state.id () != lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE) {
191
199
return nav2_util::CallbackReturn::FAILURE;
@@ -231,6 +239,7 @@ PlannerServer::on_deactivate(const rclcpp_lifecycle::State & /*state*/)
231
239
* ordering assumption: https://github.com/ros2/rclcpp/issues/2096
232
240
*/
233
241
costmap_ros_->deactivate ();
242
+ no_waiting_costmap_ros_->deactivate ();
234
243
235
244
PlannerMap::iterator it;
236
245
for (it = planners_.begin (); it != planners_.end (); ++it) {
@@ -256,6 +265,7 @@ PlannerServer::on_cleanup(const rclcpp_lifecycle::State & /*state*/)
256
265
tf_.reset ();
257
266
258
267
costmap_ros_->cleanup ();
268
+ no_waiting_costmap_ros_->cleanup ();
259
269
260
270
PlannerMap::iterator it;
261
271
for (it = planners_.begin (); it != planners_.end (); ++it) {
@@ -264,6 +274,7 @@ PlannerServer::on_cleanup(const rclcpp_lifecycle::State & /*state*/)
264
274
265
275
planners_.clear ();
266
276
costmap_thread_.reset ();
277
+ no_waiting_costmap_thread_.reset ();
267
278
costmap_ = nullptr ;
268
279
return nav2_util::CallbackReturn::SUCCESS;
269
280
}
0 commit comments