-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hello,
I hope you are having a nice day.
Thank you very much for creating this nice library. I appreciate the work you folks put into this.
Problem Overview
I observed the following issue. When a subtree is used multiple times, the indices do not generate correctly. As a result, the tree execution does not follow the proper evaluation order.
Here is the tree I created in groot2:
<?xml version="1.0" encoding="UTF-8"?>
<root BTCPP_format="4"
main_tree_to_execute="btree_debug">
<BehaviorTree ID="btree_debug">
<Sequence>
<SubTree ID="btree_subtree"
_autoremap="true"/>
<A/>
<SubTree ID="btree_subtree"
_autoremap="true"/>
<B/>
</Sequence>
</BehaviorTree>
<BehaviorTree ID="btree_subtree">
<sub/>
</BehaviorTree>
<!-- Description of Node Models (used by Groot) -->
<TreeNodesModel>
<Action ID="A"
editable="true"/>
<Action ID="B"
editable="true"/>
<Action ID="sub"
editable="true"/>
</TreeNodesModel>
</root>
Here is the invalid generated output:
static struct zephyrbt_node btree_debug_nodes[] = {
{
.function=zephyrbt_action_b,
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INIT, (
.init=zephyrbt_action_b_init,
))
.sibling=-1,
.child=-1,
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INFO, (
.name="b [action, 0]",
.index=0,
))
},
{
.function=zephyrbt_action_sub,
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INIT, (
.init=zephyrbt_action_sub_init,
))
.sibling=0,
.child=-1,
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INFO, (
.name="sub [action, 1]",
.index=1,
))
},
{
.function=zephyrbt_action_a,
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INIT, (
.init=zephyrbt_action_a_init,
))
.sibling=1,
.child=-1,
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INFO, (
.name="a [action, 2]",
.index=2,
))
},
{
.function=zephyrbt_action_sub,
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INIT, (
.init=zephyrbt_action_sub_init,
))
.sibling=0, **<------- Sibling should be 2**
.child=-1,
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INFO, (
.name="sub [action, 1]",
.index=1, **<------- Index should be 3**
))
},
{
.function=zephyrbt_control_sequence,
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INIT, (
.init=NULL,
))
.sibling=-1,
.child=1, **<--------- Child should be 3**
IF_ENABLED(CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INFO, (
.name="sequence [control, 4]",
.index=4,
))
},
};- as you can see, the 'A' action will never be executed.
Thank you for your time.
Metadata
Metadata
Assignees
Labels
No labels