Skip to content

Commit

Permalink
ComputePathToPose Sets empty path on blackboard if action is aborted …
Browse files Browse the repository at this point in the history
…or cancelled (#3114)

* set empty path on black on failure

* docs

* switched to correct message type

* set empty path for compute_path_through_poses
  • Loading branch information
jwallace42 committed Aug 22, 2022
1 parent f0d3147 commit 870fb8c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ class ComputePathThroughPosesAction
*/
BT::NodeStatus on_success() override;

/**
* @brief Function to perform some user-defined operation upon abortion of the action
*/
BT::NodeStatus on_aborted() override;

/**
* @brief Function to perform some user-defined operation upon cancelation of the action
*/
BT::NodeStatus on_cancelled() override;

/**
* @brief Creates list of BT ports
* @return BT::PortsList Containing basic ports along with node-specific ports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ class ComputePathToPoseAction : public BtActionNode<nav2_msgs::action::ComputePa
*/
BT::NodeStatus on_success() override;

/**
* @brief Function to perform some user-defined operation upon abortion of the action
*/
BT::NodeStatus on_aborted() override;

/**
* @brief Function to perform some user-defined operation upon cancelation of the action
*/
BT::NodeStatus on_cancelled() override;

/**
* @brief Creates list of BT ports
* @return BT::PortsList Containing basic ports along with node-specific ports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ BT::NodeStatus ComputePathThroughPosesAction::on_success()
return BT::NodeStatus::SUCCESS;
}

BT::NodeStatus ComputePathThroughPosesAction::on_aborted() {
nav_msgs::msg::Path empty_path;
setOutput("path", empty_path);
return BT::NodeStatus::FAILURE;
}

BT::NodeStatus ComputePathThroughPosesAction::on_cancelled() {
nav_msgs::msg::Path empty_path;
setOutput("path", empty_path);
return BT::NodeStatus::SUCCESS;
}

} // namespace nav2_behavior_tree

#include "behaviortree_cpp_v3/bt_factory.h"
Expand Down
14 changes: 14 additions & 0 deletions nav2_behavior_tree/plugins/action/compute_path_to_pose_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ BT::NodeStatus ComputePathToPoseAction::on_success()
return BT::NodeStatus::SUCCESS;
}

BT::NodeStatus ComputePathToPoseAction::on_aborted()
{
nav_msgs::msg::Path empty_path;
setOutput("path", empty_path);
return BT::NodeStatus::FAILURE;
}

BT::NodeStatus ComputePathToPoseAction::on_cancelled()
{
nav_msgs::msg::Path empty_path;
setOutput("path", empty_path);
return BT::NodeStatus::SUCCESS;
}

} // namespace nav2_behavior_tree

#include "behaviortree_cpp_v3/bt_factory.h"
Expand Down

0 comments on commit 870fb8c

Please sign in to comment.