New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set BT::NodeStatus based on service result msg (class BtServiceNode) #2467
Comments
Yes, but its virtual, if you made your own custom BTServiceNode implementation using it, you can override it with whatever you like. This is exactly the same as the action node. Ex. navigation2/nav2_behavior_tree/plugins/action/compute_path_through_poses_action.cpp Lines 41 to 46 in c6294d5
Edit: you linked to your fork / changed, no the core tools, that mixed me up. Why don't you just submit a draft PR and we can take a look together so that we have some diffs to review. What you describe sounds reasonable. The only thing I'd probably ask you to do is make it more complete, so that if there are any other |
Sorry for the confusion. I thought I had double checked, so exactly that wouldn't happen, but it is the wrong link. navigation2/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp Lines 239 to 255 in c417e2f
However, as cancelling and aborting is not possible with services, those would not be relevant. An on-function that might be relevant would be the on_wait_for_result() , as implemented in the BtActionNode.
Edit: Never mind, the navigation2/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp Lines 180 to 186 in c417e2f
Regarding the wording, are you alluding to the two different types of success ?
I agree with you about the wording issue, as the Thanks. |
I think if you open a Pr, this would be much easier so we're talking over specific code vs abstract ideas (especially since you already did it) |
I finally got to open a Pr #2481. I had to do some commit/feature de-cluttering, therefore it took a while. |
Merging imminent |
Required Info:
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:
navigation2/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp
Lines 145 to 171 in 0764e5a
Edit: Updated BtServiceNode Link to no longer point to the changed/forked version.
The text was updated successfully, but these errors were encountered: