You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/nodes-library/DecoratorNode.md
+62-12Lines changed: 62 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ A decorator is a node that must have a single child.
5
5
It is up to the Decorator to decide if, when and how many times the child should be
6
6
ticked.
7
7
8
-
> Some nodes are not listed yet. See [decorators](https://github.com/BehaviorTree/BehaviorTree.CPP/tree/master/include/behaviortree_cpp/decorators) on Github for complete definitions.
8
+
> For the complete list of built-in nodes, see the other pages in this section and the [source code](https://github.com/BehaviorTree/BehaviorTree.CPP/tree/master/include/behaviortree_cpp) on Github.
9
9
10
10
## Inverter
11
11
@@ -28,24 +28,45 @@ Otherwise, it returns always FAILURE.
28
28
29
29
## Repeat
30
30
31
-
Tick the child up to N times (within one of its tick), where N is passed as [Input Port](tutorial-basics/tutorial_02_basic_ports.md)`num_cycles`,
32
-
as long as the child returns SUCCESS.
33
-
Return SUCCESS after the N repetitions in the case that the child always returned SUCCESS.
34
-
If `num_cycles` is -1, repeat indefinitely.
31
+
Tick the child up to N times, as long as the child returns SUCCESS.
35
32
36
-
Interrupt the loop if the child returns FAILURE and, in that case, return FAILURE too.
33
+
| Port | Type | Default | Description |
34
+
|------|------|---------|-------------|
35
+
|`num_cycles`| InputPort\<int\>| (required) | Number of repetitions. Use `-1` for infinite loop. |
37
36
38
-
If the child returns RUNNING, this node returns RUNNING too and the repetitions will continue without incrementing on the next tick of the Repeat node.
37
+
- Returns **SUCCESS** after all N repetitions complete successfully.
38
+
- Returns **FAILURE** immediately if the child returns FAILURE (loop is interrupted).
39
+
- Returns **RUNNING** if the child returns RUNNING; the counter is **not** incremented and the same iteration resumes on the next tick.
40
+
- If the child returns **SKIPPED**, the child is reset but the counter is not incremented.
41
+
42
+
```xml
43
+
<Repeatnum_cycles="3">
44
+
<ClapYourHandsOnce/>
45
+
</Repeat>
46
+
```
39
47
40
48
## RetryUntilSuccessful
41
49
42
-
Tick the child up to N times, where N is passed as [Input Port](tutorial-basics/tutorial_02_basic_ports.md)`num_attempts`,
43
-
as long as the child returns FAILURE.
44
-
Return FAILURE after the N attempts in the case that the child always returned FAILURE.
50
+
Tick the child up to N times, as long as the child returns FAILURE.
51
+
52
+
| Port | Type | Default | Description |
53
+
|------|------|---------|-------------|
54
+
|`num_attempts`| InputPort\<int\>| (required) | Number of attempts. Use `-1` for infinite retries. |
55
+
56
+
- Returns **SUCCESS** immediately if the child returns SUCCESS (loop is interrupted).
57
+
- Returns **FAILURE** after all N attempts are exhausted.
58
+
- Returns **RUNNING** if the child returns RUNNING; the attempt counter is **not** incremented and the same iteration resumes on the next tick.
59
+
- If the child returns **SKIPPED**, the child is reset and SKIPPED is returned.
45
60
46
-
Interrupt the loop if the child returns SUCCESS and, in that case, return SUCCESS too.
61
+
```xml
62
+
<RetryUntilSuccessfulnum_attempts="3">
63
+
<OpenDoor/>
64
+
</RetryUntilSuccessful>
65
+
```
47
66
48
-
If the child returns RUNNING, this node returns RUNNING too and the attempts will continue without incrementing on the next tick of the RetryUntilSuccessful node.
67
+
:::note
68
+
The deprecated name `RetryUntilSuccesful` (single 's') is still supported for backward compatibility but should not be used in new trees.
69
+
:::
49
70
50
71
## KeepRunningUntilFailure
51
72
@@ -55,6 +76,35 @@ The KeepRunningUntilFailure node returns always FAILURE (FAILURE in child) or RU
55
76
56
77
Tick the child after a specified time has passed. The delay is specified as [Input Port](tutorial-basics/tutorial_02_basic_ports.md)`delay_msec`. If the child returns RUNNING, this node returns RUNNING too and will tick the child on next tick of the Delay node. Otherwise, return the status of the child node.
57
78
79
+
## Timeout
80
+
81
+
Halt a running child if it has been RUNNING longer than a given duration. This is the opposite of Delay: while Delay waits *before* ticking the child, Timeout interrupts a child that takes *too long*.
82
+
83
+
| Port | Type | Default | Description |
84
+
|------|------|---------|-------------|
85
+
|`msec`| InputPort\<unsigned\>| (required) | Timeout duration in milliseconds. |
86
+
87
+
- If the child completes (SUCCESS or FAILURE) before the timeout, its status is returned.
88
+
- If the child is still RUNNING when the timeout expires, it is halted and **FAILURE** is returned.
89
+
90
+
```xml
91
+
<Timeoutmsec="5000">
92
+
<KeepYourBreath/>
93
+
</Timeout>
94
+
```
95
+
96
+
:::tip
97
+
Combine Timeout with RetryUntilSuccessful for a robust retry-with-timeout pattern:
98
+
99
+
```xml
100
+
<RetryUntilSuccessfulnum_attempts="3">
101
+
<Timeoutmsec="5000">
102
+
<LongRunningAction/>
103
+
</Timeout>
104
+
</RetryUntilSuccessful>
105
+
```
106
+
:::
107
+
58
108
## RunOnce
59
109
60
110
The RunOnce node is used when you want to execute the child only once.
Copy file name to clipboardExpand all lines: docs/nodes-library/FallbackNode.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ To understand how the two ControlNodes differ, refer to the following table:
36
36
same child is ticked again. Previous siblings, which returned FAILURE already,
37
37
are not ticked again.
38
38
39
-
> Some nodes are not listed yet. See [controls](https://github.com/BehaviorTree/BehaviorTree.CPP/tree/master/include/behaviortree_cpp/controls) on Github for complete definitions.
39
+
> For the complete list of built-in nodes, see the other pages in this section and the [source code](https://github.com/BehaviorTree/BehaviorTree.CPP/tree/master/include/behaviortree_cpp) on Github.
Copy file name to clipboardExpand all lines: docs/nodes-library/SequenceNode.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ To understand how the three ControlNodes differ, refer to the following table:
34
34
same child is ticked again. Previous siblings, which returned SUCCESS already,
35
35
are not ticked again.
36
36
37
-
> Some nodes are not listed yet. See [controls](https://github.com/BehaviorTree/BehaviorTree.CPP/tree/master/include/behaviortree_cpp/controls) on Github for complete definitions.
37
+
> For the complete list of built-in nodes, see the other pages in this section and the [source code](https://github.com/BehaviorTree/BehaviorTree.CPP/tree/master/include/behaviortree_cpp) on Github.
0 commit comments