-
Notifications
You must be signed in to change notification settings - Fork 684
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
Cannot set SubTree ports without using a SetBlackBoard #173
Comments
I think it would be nice to use the syntax |
I should find some time to look into this during the weekend |
Whe you use a subtree, you would like to:
Is that correct? I must admit that I didn't consider this case and, what is worth, changing this would break everybody's code :( Let me explain with an example: This is the current syntax <BehaviorTree ID="MainTree">
<Sequence>
<SetBlackboard output_key="greetings" value="hello"" />
<SubTree ID="SaySubtree" message="greetings" />
</Sequence>
</BehaviorTree>
<BehaviorTree ID="SaySubtree">
<SaySomething message="{greetings}" />
</BehaviorTree> That remaps the port "greetings" to "message" You may want this: <BehaviorTree ID="MainTree">
<Sequence>
<SetBlackboard output_key="greetings" value="hello"" />
<SubTree ID="SaySubtree" message="{greetings}" />
<SubTree ID="SaySubtree" message="just say goodbye" />
</Sequence>
</BehaviorTree>
<BehaviorTree ID="SaySubtree">
<SaySomething message="{greetings}" />
</BehaviorTree> Note that in this way, similarly to other ports, we use the { } syntax to mean "reference to blackboard". Unfortunately, changing this now would break any existing BT code :( Another solution could be to use something new (and not consistent with the existing syntax) to mean "this is a string, not the name to another port", like: <SubTree ID="SaySubtree" message="[[just say goodbye]]" /> |
A solution that comes to my mind (that is also backward compatible) is to create a new kind of node with a different name and a new syntax that accommodates your particular use case. |
Hi @facontidavide, thanks for the quick and complete reply !
Yes correct, I think that would be more user-friendly.
I don't think it would break the code, only the xml, right ?
I've been thinking about that too, but it would make things too complex in my opinion...
I'm not against the idea. Making a new kind of subtree, right? |
DONE: This new Subtree Solve all your problem and also add an optional way to remap ports withthe very same name automatically. I will mergi it to master soon-ish. Try it and tell me if it works for you. |
Hi @facontidavide, thank you very much ! I've tried the SubTreePlus on my graph, the three remapping methods works. The Here is an example that works well with
And here is the same example that doesn't work as expected, with
the last example ouputs:
|
Thanks for reporting, I will double check. |
I (hopefully) fixed the issue and merged the branch to master |
Please remember that nothing I just did will probably work in Groot!!!!! I need to check that out, but my priority right now is the BehaviorTree.CPP library itself. |
Hi @facontidavide, |
Unless I'm mistaken, I think he just allowed it to be imported; if you save in Groot it will get exported as a regular SubTree which will break the BT. I've opened an issue in Groot about adding support. Thanks for the SubTreePlus, I think for common cases it is significantly cleaner and will be using it myself. I've opened an issue to discuss implementing it. |
@BenArtes Indeed, it only works when imported |
Hello,
It seems that it is not possible to directly set a value to an input port of a SubTree.
I have to map the input port to a key of the BlackBoard otherwise the value is [undefined].
Here is a snapshot of my tree:
And here is the terminal output when I load the tree:
As you can see, the port
approach_offset
of the actionMoveArmToSI
is correctly set.But its ports
ee_si
andgoal_si
are[undefined]
albeit I have set the values of the GrabTileFromContainer ports.Am I missing something, or is it a requirement to use a
SetBlackBoard
to initialise SubTree ports ?The text was updated successfully, but these errors were encountered: