67 lines
3.4 KiB
XML
67 lines
3.4 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="BTProbabilitySelector" inherits="BTComposite" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
|
<brief_description>
|
|
BT composite that chooses a child task to execute based on attached probabilities.
|
|
</brief_description>
|
|
<description>
|
|
BTProbabilitySelector chooses a child task to execute based on attached probabilities. It is typically used for decision-making purposes. Probability distribution is calculated based on weights assigned to each child task.
|
|
Returns [code]SUCCESS[/code] when a child task results in [code]SUCCESS[/code].
|
|
Returns [code]RUNNING[/code] when a child task results in [code]RUNNING[/code].
|
|
The behavior of BTProbabilitySelector when a child task results in [code]FAILURE[/code] depends on the [member abort_on_failure] value:
|
|
- If [member abort_on_failure] is [code]false[/code], when a child task results in [code]FAILURE[/code], BTProbabilitySelector will normalize the probability distribution over the remaining children and choose a new child task to be executed. If all child tasks fail, the composite will return [code]FAILURE[/code].
|
|
- If [member abort_on_failure] is [code]true[/code], when a child task results in [code]FAILURE[/code], BTProbabilitySelector will not choose another child task to be executed and will immediately return [code]FAILURE[/code].
|
|
</description>
|
|
<tutorials>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="get_probability" qualifiers="const">
|
|
<return type="float" />
|
|
<param index="0" name="p_index" type="int" />
|
|
<description>
|
|
Returns the child task's selection probability.
|
|
</description>
|
|
</method>
|
|
<method name="get_total_weight" qualifiers="const">
|
|
<return type="float" />
|
|
<description>
|
|
Returns the total weight of all child tasks.
|
|
</description>
|
|
</method>
|
|
<method name="get_weight" qualifiers="const">
|
|
<return type="float" />
|
|
<param index="0" name="p_index" type="int" />
|
|
<description>
|
|
Returns the child task's weight within the weighted probability selection algorithm.
|
|
</description>
|
|
</method>
|
|
<method name="has_probability" qualifiers="const">
|
|
<return type="bool" />
|
|
<param index="0" name="p_index" type="int" />
|
|
<description>
|
|
Returns whether the child task at index [param p_index] participates within the weighted probability selection algorithm and has a probability assigned to it. Returns [code]false[/code] for [BTComment] tasks.
|
|
</description>
|
|
</method>
|
|
<method name="set_probability">
|
|
<return type="void" />
|
|
<param index="0" name="p_index" type="int" />
|
|
<param index="1" name="p_probability" type="float" />
|
|
<description>
|
|
Sets the child task's weight calculated based on the desired probability.
|
|
</description>
|
|
</method>
|
|
<method name="set_weight">
|
|
<return type="void" />
|
|
<param index="0" name="p_index" type="int" />
|
|
<param index="1" name="p_weight" type="float" />
|
|
<description>
|
|
Sets the child task's weight for the weighted probability selection algorithm.
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="abort_on_failure" type="bool" setter="set_abort_on_failure" getter="get_abort_on_failure" default="false">
|
|
If [code]true[/code], BTProbabilitySelector will not choose another child to execute and will return [code]FAILURE[/code] when a child task results in [code]FAILURE[/code].
|
|
</member>
|
|
</members>
|
|
</class>
|