Add class doc for BTProbabilitySelector

This commit is contained in:
Serhii Snitsaruk 2023-09-26 15:05:37 +02:00
parent 27254581a4
commit dd978b636c
1 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="BTProbabilitySelector" inherits="BTComposite" version="4.1" 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 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>
<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="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>