-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
BT "node" port remapping does not work with subtrees #4004
Comments
This is fixed in Humble in source https://github.com/ros-planning/navigation2/blame/humble/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp#L188-L193, it just hasn't been released into binary format yet. Can you confirm source builds of Nav2 on Humble resolves your issue? |
Sorry to say, |
@facontidavide, @AndyZe is saying that the soln in #3640 didn't work to share the subtree blackboard members (which seems odd to me). Anything that seems clear to you to be the cause? Does the |
Not sure if this is correct, but it looks like |
Ah, that is a good catch, but we do give We unfortunately do require that those are done in the constructor. |
You should be able to "fix" it by either enabling If I recall correctly from when I looked at this problem before, the tldr is that a key is only available on the blackboard of a subtree if:
From the source code, you can see that a A key is written to the blackboard via the You can observe that if you call On the XML parsing side, you have that EDIT: Also, I believe this only applies to v3.8.5, I'm not 100% sure but I believe it works out of the box on v4.4 |
@SteveMacenski knows what I think about sharing the node using the blackboard in that way 😉 The way a node should be shared is documented in Tutorial 8 and demonstrated in BehaviorTree.ROS2. Said that, I am happy to help 😄
If any of these two statements are not true, I will be happy to investigate, but I would greatly appreciate if @AndyZe can share a unit test of "hello world" example to reproduce the issue. As you can see here, |
Are you referring to this fix?
So, from my understanding, Please correct me if I'm wrong @facontidavide, but to me the problem seems to be on the constructor of the offending node, not when it ticks, so when you traverse the blackboard stack to ensure all blackboards have the required entries it is already too late. If you use either
The underlying problem however seems to be that just manually remapping a key to a subtree does not guarantee it is written to the subtree's blackboard storage unless there is at least one node in the subtree that is using it. This was the conclusion I got to when I looked at this problem, but please correct me if I misunderstood something here I understand that Nav2 is not using the library as you intended, hence why these issues keep popping up. I'm just trying to help here 😄 |
correct.
😢 you are right, I stand corrected.
The solution is to change the code to follow the pattern in Tutorial 8
Let me update this unit test. Since that is not my intent, once confirmed, I will correct it, also in branch 3.8 👍 |
In case you still need it (patch for v3.8 branch of BehaviorTree.CPP nav2_subtree_patch.zip):
|
moved the issue here: BehaviorTree/BehaviorTree.CPP#724 |
OK - closing here then since covered in BT.CPP. Thanks for the good discussion! |
FYI, the solution was pushed and can be found in version 3.8.6 |
Note for @AndyZe : you MUST use SubTreePlus, otherwise the remapping syntax in your example won't work |
Thank you! |
Bug report
Required Info:
Ubuntu 22
Humble
1.1.12-1jammy.20231117.204507
Steps to reproduce issue
This should be considered low priority. It's easy to work around by simply not using BT subtrees.
I was trying to use a subtree which included a
DriveOnHeading
nav node, like so:The parent tree defines the
node
port and should remap it for the subtree like so:However there is still this error at runtime:
It works fine if I simply don't use the subtree but rather combine everything in one large BT.
Suspect it's related to this line:
https://github.com/ros-planning/navigation2/blob/113564965f54009686d521902ff3fcc9d101c5b5/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp#L52
The text was updated successfully, but these errors were encountered: