Skip to content

Static queue in the Loop Node gets erased #909

Closed
@ipa-dmo

Description

@ipa-dmo

When running a Behavior Tree with a Loop with a static queue twice, the first run works fine, but in the second run the static queue is already empty. The loop does not start and directly returns SUCCESS.

In line 63 of the loop_node.h file (https://github.com/BehaviorTree/BehaviorTree.CPP/blob/master/include/behaviortree_cpp/decorators/loop_node.h) the shared pointer static_queue_ is assigned to the current_queue_. When the current_queue_ is emptied in the first run, also the static_queue_ is emptied. Since the static_queue_ is only overwritten in the constructor, it remains empty before the next run.

Is this intended behavior?

Example:

<root BTCPP_format="4" main_tree_to_execute="MainTree">
  <include path="./free_planning.xml" />
  <BehaviorTree ID="MainTree">
    <Sequence>
      <LoopInt queue="0;1;2;3" value="{num}">
        <Sequence>
          <LoadGoalPose file_path="{transport_tasks}" number="{num}" goal="{goal}"/>
          <Fallback>
              <GoalPoseReached goal="{goal}" robot_base_frame="base_link"/>
              <SubTree ID="FreePlanning" _autoremap="true"/>
          </Fallback>
        </Sequence>
      </LoopInt>
    </Sequence>
  </BehaviorTree>
.```

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions