Skip to content

Loop Decorators Poorly documented within BT.CPP #988

Open
@shaur-k

Description

@shaur-k

Describe the bug

  • Repeat and RetryUntilSuccessful run a loop WITHIN one BT tick
    • this is outside of the BT "tick" paradigm, which can easily lead to an OOM with an infinite loop
      • This behavior can exist (see suggestion below), but it should not be standard practice, and should include clear warnings

Related concerns:

  • Behavior naming:
    • Repeat and RetryUntilSuccessful are redundant, except they're inverses. (one should be deleted, as it can be achieved with the Inverter behavior)
    • Naming does not adequately describe the Tick-ing behavior
  • Interaction with Async child nodes
    • Repeat and RetryUntilSuccessful actually do respect the BT tick with Async child nodes that return RUNNING. This is probably the only sensible implementation for this, but it just further confuses their function (sometimes respecting it, and sometimes not).

Proposed solution:

  • Rename Repeat to RepeatUnlessFailureWithinTick and deprecate RetryUntilSuccessful
  • Rename KeepRunningUntilFailure to RepeatUnlessFailureEachTick
    • Also add the N iterations port (with -1 being infinite loops) that Repeat and RetryUntilSuccessful have.

How to Reproduce*

See .zip file for Objectives that demonstrate the current functionality of each Behavior, with both Sync and Async nodes. Note that if you change Repeat or RetryUntilSuccessful from N=10 to -1, they will crash (due to infinite loop OOM).
test_loop_decorators.zip

See also the BT docs ref that describes this functionality: https://www.behaviortree.dev/docs/nodes-library/DecoratorNode#repeat

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions