-
Notifications
You must be signed in to change notification settings - Fork 724
Problems with order of subtrees #168
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
Comments
As you can see the error message is clearly telling you that you are trying to access a key called node. Are you absolutely sure that you copied the exact error message? But I do not see anything in your code called "node". Could the error be in your C++ code? It is also very weird that executing earlier the solves the problem because it is not writing (apparently) in any port. Something weird that is noticed: <PlanManipulatorPath plan_to_frame="{frame}"/>
<MoveManipulator path="{path}" move_to_frame="{move_to_frame}"/> I am guessing that |
In general... I can not see all the remapping, I don't expect input ports to work properly. If is Ok for a port to have an empty input, use the non-throwing version of get() and decide what to do accordingly. |
Hi. My problems were solved when I put everything into the same tree, and stopped using subtrees (but I would like to use them, as it simplifies my code a lot). I am aware of some problems with the ports, that is fixed now. But to show a simpler example:
This gives this output in the terminal:
As you can see, it is the same error message as previously.
What I said earlier about executing something before the subtree works was wrong. The same problem occurs then as well, only at a later time. |
I just tested it with the dummy implementation here: And I insist that the problem must be in your C++ code... unless you are using an old version of BehaviorTree.CPP. Which version are you using? Remember that I am not maintaining version 2 anymore. The best I can offer you is to have a look at your C++ code to see if I spot something weird, but otherwise, I will close this issue. |
My project folder is named behaviortree_cpp_v3, so i guess it is the correct version. My code can be found at: https://github.com/ninamwa/kmriiwa_ws/tree/eloquent/kmr_behaviortree As I said, the code works for me if I use only one behaviortree, with no subtrees, so there is not a big problem for me if this is not solved, but it would be interesting to know what is wrong :-) |
This problem is really bothering me. I will try to look into it more closely in the next days. |
Hi facontidavide, I don't know if I have the same problem with ninamwa. My bt xml looks like this:
In this case, the bt works perfectly fine, I can access the 'speed' from both actions. But if I revise my bt xml like this, where I added a subtree:
In this case, I cannot get the 'speed' variable from the blackboard by: It seems like a scope problem. Thanks!! |
@yimenghou Please read this https://www.behaviortree.dev/tutorial_06_subtree_ports/ Your subtree has its own isolated blavkoboard, separated from the parent. Furthermore, using the blackboard is strongly discouraged, you shous use Input/Outpu ports instead. |
@ninamwa, if you remember, I said that there was something fishy about your error that I could not understand from the information you provided. Now that I see the example of @yimenghou , I am realizing that maybe you are affected by the same error (using blackboard directly instead of using ports with proper remapping). Could it be? |
I see. Thank you :)@facontidavide facontidavide In my case, |
no, I created ports to prevent users from doing what you are doing. A "solution" to continue doing what you are doing (the wrong thing) is to have what I call a "transparent Subtree", i.e. a subtree that share the same blackboard of the parent, instead o having its own. I will add it soon. |
UPDATE: I implemented this:
But please, remember that using the config()->blackboard without the ports is strongly discouraged and it is not the intended way to use the library. The intended usage is clearly described in the tutorials. |
Hi. I am trying to use this library to build and execute my BT, but i have met a problem while creating my tree.
My tree is as following (NB: I omitted the "FindObject" subtree, to limit the amount of code).
`
`
When I try to run this i get the error message:
[behavior_tree_node-1] what(): Blackboard::get() error. Missing key [node]
The problem seems to be the lines:
<SubTree ID="MoveToFrame" frame="drive_frame"/> <CloseGripper/>
in the "Handle Object" subtree.
If I change the order of these two lines, hence: close gripper before the subtree, everything works as expected. I have seen this problem in my other subtrees as well. If the subtree is the first element inside a sequence, it is not working.
For example: my MainTree is not working either (for the same reason I guess). I needed to set main_tree_to_execute to HandleObject to find out the problem described above.
Could anyone tell me why this happens, and if there is something i have misunderstood?
I do not want to change the order of the nodes, as i need the manipulator to "MoveToFrame" before it closes...
Thanks!
The text was updated successfully, but these errors were encountered: