Skip to content

Commit

Permalink
Add viz_expansions parameter for debug (ros-navigation#3577)
Browse files Browse the repository at this point in the history
* viz_expansions

* lint

* switch to unique_ptr

* readme update

---------

Co-authored-by: Guillaume Doisy <[email protected]>
  • Loading branch information
2 people authored and Marc-Morcos committed Jul 4, 2024
1 parent 18b7a5a commit a2e2060
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions nav2_smac_planner/src/smac_planner_hybrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ void SmacPlannerHybrid::configure(
}

_raw_plan_publisher = node->create_publisher<nav_msgs::msg::Path>("unsmoothed_plan", 1);
if (_viz_expansions) {
_expansions_publisher = node->create_publisher<geometry_msgs::msg::PoseArray>("expansions", 1);
}

if (_debug_visualizations) {
_expansions_publisher = node->create_publisher<geometry_msgs::msg::PoseArray>("expansions", 1);
Expand Down Expand Up @@ -378,6 +381,20 @@ nav_msgs::msg::Path SmacPlannerHybrid::createPlan(
}
}

// Publish expansions for debug
if (_viz_expansions) {
geometry_msgs::msg::PoseArray msg;
geometry_msgs::msg::Pose msg_pose;
msg.header.stamp = _clock->now();
msg.header.frame_id = _global_frame;
for (auto & e : *expansions) {
msg_pose.position.x = std::get<0>(e);
msg_pose.position.y = std::get<1>(e);
msg.poses.push_back(msg_pose);
}
_expansions_publisher->publish(msg);
}

// Convert to world coordinates
plan.poses.reserve(path.size());
for (int i = path.size() - 1; i >= 0; --i) {
Expand Down

0 comments on commit a2e2060

Please sign in to comment.