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 returns [code]SUCCESS[/code].
Returns [code]RUNNING[/code] when a child task returns [code]RUNNING[/code].
The behavior of BTProbabilitySelector when a child task results in [code]FAILURE[/code] depends on the value of the [member abort_on_failure] property:
- 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 remaiming 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>
<methodname="get_probability"qualifiers="const">
<returntype="float"/>
<paramindex="0"name="p_index"type="int"/>
<description>
Returns the child task's selection probability.
</description>
</method>
<methodname="get_total_weight"qualifiers="const">
<returntype="float"/>
<description>
Returns the total weight of all child tasks.
</description>
</method>
<methodname="get_weight"qualifiers="const">
<returntype="float"/>
<paramindex="0"name="p_index"type="int"/>
<description>
Returns the child task's weight within the weighted probability selection algorithm.
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.
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].