Skip to content

Set BT::NodeStatus based on service result msg (class BtServiceNode) #2467

@philison

Description

@philison

Required Info:

  • Operating System:
    • Ubuntu 20.04.2 LTS
  • ROS2 Version:
    • Galactic binaries
  • Version or commit hash:
  • DDS implementation:

Feature request

Feature description

It is the goal to set the BT::NodeStatus of a behavior tree leave node based on the result send from the service server.
More specifically, I tried to implement a Condition-Node that makes a request to a service server via the ROS2 service interface and sets its BT::NodeStatus based on the result.. Therefore, the BtServiceNode class (bt_service_node.cpp) seemed to me to be the best suited class to use. However, in contrast to the BtActionNode class (bt_action_node.cpp) it missed the virtual on_success() function, that can be used to define the custom BT::NodeStatus behavior based on the service's answer. The current BtServiceNode class sets the BT::NodeStatus solely based on the success of the service request.

I am not sure if I missed a class that implements this feature, if there is a simpler solution or if I should just use the BT::ConditionNode base class with a normal service client after all.

Implementation considerations

The proposed implementation simply adds a call to the virtual on_success() function in the check_future() function (Similar to the BtActionNode).

The changes do not change do not affect the default behavior of the BtServiceNode as the default definition of on_success() does still simply return BT::NodeStatus::SUCCESS.

If the proposed implementation is an appropriate modification I could create a pull request.

Changes:
https://github.com/angsa-robotics/navigation2/blob/033cdc49b4c106f2747772f2081fca47bee6e9ec/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp#L150-L187

Original:
https://github.com/ros-planning/navigation2/blob/0764e5af5b23ea7a08629876792a8da1465ef261/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp#L145-L171

Edit: Updated BtServiceNode Link to no longer point to the changed/forked version.

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