Skip to content

Commit 0a2ac46

Browse files
Merge pull request #95 from logivations/amrnav-6948
Amrnav 6948
2 parents 67d1913 + c2493b1 commit 0a2ac46

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

nav2_planner/include/nav2_planner/planner_server.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ class PlannerServer : public nav2_util::LifecycleNode
251251

252252
// Global Costmap
253253
std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros_;
254+
std::shared_ptr<nav2_costmap_2d::Costmap2DROS> no_waiting_costmap_ros_;
254255
std::unique_ptr<nav2_util::NodeThread> costmap_thread_;
256+
std::unique_ptr<nav2_util::NodeThread> no_waiting_costmap_thread_;
255257
nav2_costmap_2d::Costmap2D * costmap_;
256258
std::unique_ptr<nav2_costmap_2d::FootprintCollisionChecker<nav2_costmap_2d::Costmap2D *>>
257259
collision_checker_;

nav2_planner/src/planner_server.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ PlannerServer::PlannerServer(const rclcpp::NodeOptions & options)
6767
costmap_ros_ = std::make_shared<nav2_costmap_2d::Costmap2DROS>(
6868
"global_costmap", std::string{get_namespace()}, "global_costmap",
6969
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());
7074
}
7175

7276
PlannerServer::~PlannerServer()
@@ -77,6 +81,7 @@ PlannerServer::~PlannerServer()
7781
*/
7882
planners_.clear();
7983
costmap_thread_.reset();
84+
no_waiting_costmap_thread_.reset();
8085
}
8186

8287
nav2_util::CallbackReturn
@@ -85,6 +90,7 @@ PlannerServer::on_configure(const rclcpp_lifecycle::State & state)
8590
RCLCPP_INFO(get_logger(), "Configuring");
8691

8792
costmap_ros_->configure();
93+
no_waiting_costmap_ros_->configure();
8894
costmap_ = costmap_ros_->getCostmap();
8995

9096
if (!costmap_ros_->getUseRadius()) {
@@ -95,6 +101,7 @@ PlannerServer::on_configure(const rclcpp_lifecycle::State & state)
95101

96102
// Launch a thread to run the costmap node
97103
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_);
98105

99106
RCLCPP_DEBUG(
100107
get_logger(), "Costmap size: %d,%d",
@@ -186,6 +193,7 @@ PlannerServer::on_activate(const rclcpp_lifecycle::State & /*state*/)
186193
plan_publisher_->on_activate();
187194
action_server_pose_->activate();
188195
action_server_poses_->activate();
196+
no_waiting_costmap_ros_->activate();
189197
const auto costmap_ros_state = costmap_ros_->activate();
190198
if (costmap_ros_state.id() != lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE) {
191199
return nav2_util::CallbackReturn::FAILURE;
@@ -231,6 +239,7 @@ PlannerServer::on_deactivate(const rclcpp_lifecycle::State & /*state*/)
231239
* ordering assumption: https://github.com/ros2/rclcpp/issues/2096
232240
*/
233241
costmap_ros_->deactivate();
242+
no_waiting_costmap_ros_->deactivate();
234243

235244
PlannerMap::iterator it;
236245
for (it = planners_.begin(); it != planners_.end(); ++it) {
@@ -256,6 +265,7 @@ PlannerServer::on_cleanup(const rclcpp_lifecycle::State & /*state*/)
256265
tf_.reset();
257266

258267
costmap_ros_->cleanup();
268+
no_waiting_costmap_ros_->cleanup();
259269

260270
PlannerMap::iterator it;
261271
for (it = planners_.begin(); it != planners_.end(); ++it) {
@@ -264,6 +274,7 @@ PlannerServer::on_cleanup(const rclcpp_lifecycle::State & /*state*/)
264274

265275
planners_.clear();
266276
costmap_thread_.reset();
277+
no_waiting_costmap_thread_.reset();
267278
costmap_ = nullptr;
268279
return nav2_util::CallbackReturn::SUCCESS;
269280
}

0 commit comments

Comments
 (0)