Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class ComputePathToPoseAction : public BtActionNode<nav2_msgs::action::ComputePa
{
BT::OutputPort<nav_msgs::msg::Path>("path", "Path created by ComputePathToPose node"),
BT::InputPort<geometry_msgs::msg::PoseStamped>("goal", "Destination to plan to"),
BT::InputPort<geometry_msgs::msg::PoseStamped>(
"start", "Start pose of the path if overriding current robot pose"),
BT::InputPort<std::string>("planner_id", ""),
});
}
Expand Down
1 change: 1 addition & 0 deletions nav2_behavior_tree/nav2_tree_nodes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<Action ID="ComputePathToPose">
<input_port name="goal">Destination to plan to</input_port>
<input_port name="start_pose">Start pose of the path if overriding current robot pose</input_port>
Comment thread
doisyg marked this conversation as resolved.
Outdated
<output_port name="path">Path created by ComputePathToPose node</output_port>
<input_port name="planner_id"/>
</Action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ void ComputePathToPoseAction::on_tick()
{
getInput("goal", goal_.pose);
getInput("planner_id", goal_.planner_id);
if (getInput("start", goal_.start)) {
goal_.use_start_pose = true;
}
}

BT::NodeStatus ComputePathToPoseAction::on_success()
Expand Down
2 changes: 2 additions & 0 deletions nav2_msgs/action/ComputePathToPose.action
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#goal definition
geometry_msgs/PoseStamped pose
Comment thread
doisyg marked this conversation as resolved.
Outdated
geometry_msgs/PoseStamped start
string planner_id
bool use_start_pose
---
#result definition
nav_msgs/Path path
Expand Down
5 changes: 4 additions & 1 deletion nav2_planner/src/planner_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,11 @@ PlannerServer::computePlan()
r.sleep();
}

// Use start_pose if provided otherwise use current robot pose
geometry_msgs::msg::PoseStamped start;
if (!costmap_ros_->getRobotPose(start)) {
if (goal->use_start_pose) {
start = goal->start;
Comment thread
doisyg marked this conversation as resolved.
} else if (!costmap_ros_->getRobotPose(start)) {
action_server_->terminate_current();
return;
}
Expand Down