Repository navigation
Release 2.6.x
This release improves and matures the experimental Ports API from the previous release (2.5.x).
Port declaration changes
Found some easy performance improvements by changing the BehaviourWithPorts port declarations from class methods to attributes.
Old:
class Multiply(BehaviourWithPorts):
@classmethod
def input_ports(cls):
return {
"a": PortInformation(data_type=float, required=True),
"b": PortInformation(data_type=float, required=True),
}
@classmethod
def output_ports(cls):
return {
"product": PortInformation(data_type=float, required=True),
}New:
class Multiply(BehaviourWithPorts):
INPUT_PORTS = {
"a": PortInformation(data_type=float, required=True),
"b": PortInformation(data_type=float, required=True),
}
OUTPUT_PORTS = {
"product": PortInformation(data_type=float, required=True),
}Default values in port declarations and XML
You can specify default values in port declarations:
class MyTimeout(BehaviourWithPorts):
INPUT_PORTS = {
"timeout": PortInformation(data_type=float, default_value=5.0),
}as well as in subtree XMLs
<root main_tree_to_execute="MainTree">
<BehaviorTree ID="SubTree" input1="default_str" input2="42">
<Sequence>
<Consumer name="Consumer" input="{input1}"/>
<FloatConsumer name="FloatConsumer" input="{input2}"/>
</Sequence>
</BehaviorTree>
<BehaviorTree ID="MainTree">
<Sequence>
<SubTree ID="SubTree" name="AllDefaults" />
<SubTree ID="SubTree" name="FirstInputSet" input1="override_str" />
<SubTree ID="SubTree" name="SecondInputSet" input2="67" />
<SubTree ID="SubTree" name="BothInputsSet" input1="another_str" input2="9001" />
</Sequence>
</BehaviorTree>
</root>... and in top-level XMLs!
Note that inputs in top-level XML trees can have their default overridden, or specify required nondefault arguments, with a new input_mappings argument to the parse_behaviour_tree_xml() function.
<root main_tree_to_execute="MainTree">
<!-- input1 has a default, but input2 does not -->
<BehaviorTree ID="MainTree" input1="default_str">
<Sequence>
<Consumer name="Consumer" input="{input1}"/>
<FloatConsumer name="FloatConsumer" input="{input2}"/>
</Sequence>
</BehaviorTree>
</root>root_node = parse_behaviour_tree_xml(
self.tempfile.name,
logger=StdoutLogger(),
input_mappings={"input1": "override_str", "input2": "67"},
)- Get Started - quickly ramp up an environment for exploring or modifying PyTrees.
- Changelog - a list of New Features, Breaking APIs, Bugfixes with notes and examples
- Release Branch - this will update as
2.6.xpatches roll in - Documentation - on readthedocs.org