Skip to content

Commit cb39462

Browse files
action timeout in BT client edits error code and string (#5184)
Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>
1 parent c9438b4 commit cb39462

36 files changed

+195
-0
lines changed

nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ class BtActionNode : public BT::ActionNodeBase
187187
return BT::NodeStatus::SUCCESS;
188188
}
189189

190+
/**
191+
* @brief Function to perform work in a BT Node when the action server times out
192+
* Such as setting the error code ID status to timed out for action clients.
193+
*/
194+
virtual void on_timeout()
195+
{
196+
return;
197+
}
198+
190199
/**
191200
* @brief The main override required by a BT action
192201
* @return BT::NodeStatus Status of tick execution
@@ -231,6 +240,7 @@ class BtActionNode : public BT::ActionNodeBase
231240
"Timed out while waiting for action server to acknowledge goal request for %s",
232241
action_name_.c_str());
233242
future_goal_handle_.reset();
243+
on_timeout();
234244
return BT::NodeStatus::FAILURE;
235245
}
236246
}
@@ -261,6 +271,7 @@ class BtActionNode : public BT::ActionNodeBase
261271
"Timed out while waiting for action server to acknowledge goal request for %s",
262272
action_name_.c_str());
263273
future_goal_handle_.reset();
274+
on_timeout();
264275
return BT::NodeStatus::FAILURE;
265276
}
266277
}

nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/assisted_teleop_action.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ class AssistedTeleopAction : public BtActionNode<nav2_msgs::action::AssistedTele
6666
*/
6767
BT::NodeStatus on_cancelled() override;
6868

69+
/**
70+
* @brief Function to perform work in a BT Node when the action server times out
71+
* Such as setting the error code ID status to timed out for action clients.
72+
*/
73+
void on_timeout() override;
74+
6975
/**
7076
* @brief Function to read parameters and initialize class variables
7177
*/

nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/back_up_action.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ class BackUpAction : public BtActionNode<nav2_msgs::action::BackUp>
6666
*/
6767
BT::NodeStatus on_cancelled() override;
6868

69+
/**
70+
* @brief Function to perform work in a BT Node when the action server times out
71+
* Such as setting the error code ID status to timed out for action clients.
72+
*/
73+
void on_timeout() override;
74+
6975
/**
7076
* @brief Function to read parameters and initialize class variables
7177
*/

nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/compute_and_track_route_action.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ class ComputeAndTrackRouteAction : public BtActionNode<nav2_msgs::action::Comput
6464
*/
6565
BT::NodeStatus on_cancelled() override;
6666

67+
/**
68+
* @brief Function to perform work in a BT Node when the action server times out
69+
* Such as setting the error code ID status to timed out for action clients.
70+
*/
71+
void on_timeout() override;
72+
6773
/**
6874
* @brief Function to perform some user-defined operation after a timeout
6975
* waiting for a result that hasn't been received yet

nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/compute_path_through_poses_action.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ class ComputePathThroughPosesAction
6969
*/
7070
BT::NodeStatus on_cancelled() override;
7171

72+
/**
73+
* @brief Function to perform work in a BT Node when the action server times out
74+
* Such as setting the error code ID status to timed out for action clients.
75+
*/
76+
void on_timeout() override;
77+
7278
/**
7379
* \brief Override required by the a BT action. Cancel the action and set the path output
7480
*/

nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/compute_path_to_pose_action.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ class ComputePathToPoseAction : public BtActionNode<nav2_msgs::action::ComputePa
6666
*/
6767
BT::NodeStatus on_cancelled() override;
6868

69+
/**
70+
* @brief Function to perform work in a BT Node when the action server times out
71+
* Such as setting the error code ID status to timed out for action clients.
72+
*/
73+
void on_timeout() override;
74+
6975
/**
7076
* \brief Override required by the a BT action. Cancel the action and set the path output
7177
*/

nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/compute_route_action.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ class ComputeRouteAction : public BtActionNode<nav2_msgs::action::ComputeRoute>
6464
*/
6565
BT::NodeStatus on_cancelled() override;
6666

67+
/**
68+
* @brief Function to perform work in a BT Node when the action server times out
69+
* Such as setting the error code ID status to timed out for action clients.
70+
*/
71+
void on_timeout() override;
72+
6773
/**
6874
* \brief Override required by the a BT action. Cancel the action and set the path output
6975
*/

nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/drive_on_heading_action.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ class DriveOnHeadingAction : public BtActionNode<nav2_msgs::action::DriveOnHeadi
8888
* @brief Function to perform some user-defined operation upon cancellation of the action
8989
*/
9090
BT::NodeStatus on_cancelled() override;
91+
92+
/**
93+
* @brief Function to perform work in a BT Node when the action server times out
94+
* Such as setting the error code ID status to timed out for action clients.
95+
*/
96+
void on_timeout() override;
9197
};
9298

9399
} // namespace nav2_behavior_tree

nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/follow_path_action.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ class FollowPathAction : public BtActionNode<nav2_msgs::action::FollowPath>
6666
*/
6767
BT::NodeStatus on_cancelled() override;
6868

69+
/**
70+
* @brief Function to perform work in a BT Node when the action server times out
71+
* Such as setting the error code ID status to timed out for action clients.
72+
*/
73+
void on_timeout() override;
74+
6975
/**
7076
* @brief Function to perform some user-defined operation after a timeout
7177
* waiting for a result that hasn't been received yet

nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ class NavigateThroughPosesAction : public BtActionNode<nav2_msgs::action::Naviga
6767
*/
6868
BT::NodeStatus on_cancelled() override;
6969

70+
/**
71+
* @brief Function to perform work in a BT Node when the action server times out
72+
* Such as setting the error code ID status to timed out for action clients.
73+
*/
74+
void on_timeout() override;
75+
7076
/**
7177
* @brief Creates list of BT ports
7278
* @return BT::PortsList Containing basic ports along with node-specific ports

0 commit comments

Comments
 (0)