Skip to content

Commit

Permalink
Add error codes NONE and UNKNOWN to Wait.action (#4341)
Browse files Browse the repository at this point in the history
This allows setting a default failure error_code and
message in nav2_system_tests behavior_tree dummy_action_server

Signed-off-by: Mike Wake <[email protected]>
  • Loading branch information
aosmw committed Dec 15, 2024
1 parent d194507 commit 30b36da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions nav2_msgs/action/Wait.action
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ builtin_interfaces/Duration time
builtin_interfaces/Duration total_elapsed_time
uint16 error_code
string error_msg

uint16 NONE=0
uint16 UNKNOWN=740
---
#feedback definition
builtin_interfaces/Duration time_left
8 changes: 6 additions & 2 deletions nav2_system_tests/src/behavior_tree/dummy_action_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,16 @@ class DummyActionServer
return std::make_shared<typename ActionT::Result>();
}

virtual void updateResultForFailure(std::shared_ptr<typename ActionT::Result> &)
virtual void updateResultForFailure(std::shared_ptr<typename ActionT::Result> &result)
{
result->error_code = ActionT::Result::UNKNOWN;
result->error_msg = "Unknown Failure";
}

virtual void updateResultForSuccess(std::shared_ptr<typename ActionT::Result> &)
virtual void updateResultForSuccess(std::shared_ptr<typename ActionT::Result> &result)
{
result->error_code = ActionT::Result::NONE;
result->error_msg = "";
}

virtual rclcpp_action::GoalResponse handle_goal(
Expand Down

0 comments on commit 30b36da

Please sign in to comment.