Skip to content

Conversation

silanus23
Copy link

@silanus23 silanus23 commented Sep 26, 2025


Basic Info

Info Please fill out this column
Ticket(s) this addresses #5036
Primary OS tested on Ubuntu
Robotic platform tested on nav2_bringup
Does this PR contain AI generated software? unit tests
Was this PR description generated by AI software? Nope

Description of contribution in a few bullet points

I tried to implement the idea at #5036
I added run_id to the blackboard and it's symetrycal to action node template. So that everytime blackboard ticks nodes one can keep track of nodes init time. This is an insurance for synchronization in the background. Made this activated with a parameter so that it won't interfere with current implementations and break them too.

Description of documentation updates required from your changes

Action nodes now have the parameter is_global for this feature.

Description of how this change was tested

I have tested this locally with debug lines it was showing so integration tested too. Besides I wrote backward compatibility tests too.


Future work that may be required in bullet points

In future adding current behavior trees is_global = true for every node
As the final making this a default.

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
  • Should this be backported to current distributions? If so, tag with backport-*.

@silanus23
Copy link
Author

silanus23 commented Sep 26, 2025

@adivardi could you give this a review? I just wondered if I comprehend the idea correctly.
Sorry to ping you directly. No worries if you are too busy.
Cheers

Copy link
Contributor

@adivardi adivardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments, but looks good!

We would need to add it to other nodes as well, all the ones that use BT::isStatusActive() to initialize (you can see #5035, though may new nodes were added in the meantime).

}
} catch (const std::exception & e) {
// run_id not found on blackboard, use old behavior
if (!BT::isStatusActive(status())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this, that would be a weird surprise. Maybe just let it crash? It would be the same as if server_timeout is missing.


// Subsequent ticks with same RunID should continue without re-initialization
result = tree_->tickOnce();
EXPECT_EQ(result, BT::NodeStatus::RUNNING);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come all tests have the same EXPECT_EQ(result, BT::NodeStatus::RUNNING); ?

@silanus23
Copy link
Author

silanus23 commented Sep 26, 2025

Thank you.

return;
}

run_id_++;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use a UUID unique hash instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Behavior Tree: Add RunID Blackboard variable, and global version to Asynchronous nodes
3 participants