Go to the source code of this file.
◆ main()
◆ xml_maintree
Initial value:= R"(
<root BTCPP_format="4">
<BehaviorTree ID="MainTree">
<Sequence>
<Script code="in_name:= 'john' "/>
<SubTree ID="MySub" sub_in_name="{in_name}"
sub_out_state="{out_state}"/>
<ScriptCondition code=" out_result==69 && out_state=='ACTIVE' " />
</Sequence>
</BehaviorTree>
</root>
)"
Here, when calling "MySub", only sub_in_name and sub_out_state are explicitly remapped. We will use the default values for the other two.
Definition at line 51 of file t14_subtree_model.cpp.
◆ xml_subtree
Initial value:= R"(
<root BTCPP_format="4">
<TreeNodesModel>
<SubTree ID="MySub">
<input_port name="sub_in_value" default="42"/>
<input_port name="sub_in_name"/>
<output_port name="sub_out_result" default="{out_result}"/>
<output_port name="sub_out_state"/>
</SubTree>
</TreeNodesModel>
<BehaviorTree ID="MySub">
<Sequence>
<ScriptCondition code="sub_in_value==42 && sub_in_name=='john'" />
<Script code="sub_out_result:=69; sub_out_state:='ACTIVE'" />
</Sequence>
</BehaviorTree>
</root>
)"
You can optionally add a model to a SubTrees, in this case, "MySub". We are telling the factory that the callee should remap two mandatory inputs, and two outputs:
- sub_in_value (that has the default value 42)
- sub_in_name (no default)
- sub_out_result (default remapping to port {output})
- sub_out_state (no default)
The callee (parent tree, including the subtree) MUST specify those remapping which have no default value.
Definition at line 25 of file t14_subtree_model.cpp.