Skip to content

BT Action Node initialization does not timeout #3027

@vinnnyr

Description

@vinnnyr

Feature request

Feature description

Add timeout to action client initialization in a BT action client node.

https://github.com/ros-planning/navigation2/blob/08e558fd5a7205142935190ce26d196b8c828911/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp#L93

Currently this wait_for_action_server call does not have a timeout. If the given action server is not healthy, or we are having other RMW/DDS issues, whatever component of the system that initializes the plugin / BT will just get stuck here.

Implementation considerations

Instead, I propose that we use the server_timeout parameter to have a timeout for the wait_for_action_server and throw an exception if the timeout has been violated so that the upper level system can handle the error / inform the user, or other parts of the system rather than hang out waiting for the action server indefinitely.

I believe it should be as simple as

auto was_successful = action_client_->wait_for_action_server(server_timeout_)
if (!was_successful) {
  throw std::runtime_error("Server Timeout exceeded");

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions