Skip to content

Question about internal loop vs. counter management for Repeater node #938

Open

Description

@Lecrapouille

Hello !

I read the code source of the repeater node.

NodeStatus RepeatNode::tick()
{
...
  bool do_loop = repeat_count_ < num_cycles_ || num_cycles_ == -1;
  setStatus(NodeStatus::RUNNING);

  while(do_loop)
  {

Why do you use an internal loop instead of using a counter forcing the Repeater node to be ticked "num_cycles_" times ?

My naive implementation would be:

        Status status = m_child->tick();
        if (status == Status::RUNNING)
        {
            return Status::RUNNING;
        }
        else if (status == Status::FAILURE)
        {
            return Status::FAILURE;
        }
        
        if ((m_num_cycles > 0) && (++m_counter == m_num_cycles))
        {
            m_counter = m_num_cycles;
            return Status::SUCCESS;
        }
        
        return Status::RUNNING;

I guess with your method, you do not have the timestamp of the tree between each iteration ? I think the last method is more in the spirit of BT: blocking less each node and each iteration scheduled by a fixed time stamp ?

Activity

  1. facontidavide commented on Feb 4, 2026

    @facontidavide
    Collaborator

    yes, that should be changed probably

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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