Skip to content

Add runid#5553

Open
silanus23 wants to merge 23 commits into
ros-navigation:mainfrom
silanus23:add-runid
Open

Add runid#5553
silanus23 wants to merge 23 commits into
ros-navigation:mainfrom
silanus23:add-runid

Conversation

@silanus23

@silanus23 silanus23 commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

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

silanus23 commented Sep 26, 2025

Copy link
Copy Markdown
Contributor Author

@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

@adivardi adivardi left a comment

Copy link
Copy Markdown
Contributor

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).

@silanus23

silanus23 commented Sep 26, 2025

Copy link
Copy Markdown
Contributor Author

Thank you.

Comment thread nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp Outdated
@SteveMacenski

Copy link
Copy Markdown
Member

@silanus23 any update?

@silanus23

Copy link
Copy Markdown
Contributor Author

@SteveMacenski Sorry for late update. I couldn't give attention in here and other PRs. I am handling my hiring test case. Deadline is tomorrow. After that I beleive I can give others with this an answer in a week.

@codecov

codecov Bot commented Oct 23, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.76190% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../plugins/condition/distance_traveled_condition.cpp 73.68% 5 Missing ⚠️
...tree/include/nav2_behavior_tree/bt_action_node.hpp 70.00% 3 Missing ⚠️
..._tree/plugins/condition/goal_updated_condition.cpp 83.33% 3 Missing ⚠️
..._tree/plugins/condition/time_expired_condition.cpp 80.00% 3 Missing ⚠️
...ior_tree/plugins/decorator/single_trigger_node.cpp 72.72% 3 Missing ⚠️
Files with missing lines Coverage Δ
...ee/include/nav2_behavior_tree/bt_action_server.hpp 83.33% <ø> (ø)
...clude/nav2_behavior_tree/bt_action_server_impl.hpp 88.42% <100.00%> (+0.33%) ⬆️
.../plugins/condition/distance_traveled_condition.hpp 100.00% <100.00%> (ø)
..._tree/plugins/condition/goal_updated_condition.hpp 100.00% <100.00%> (ø)
..._tree/plugins/condition/time_expired_condition.hpp 100.00% <100.00%> (ø)
...ior_tree/plugins/decorator/single_trigger_node.hpp 100.00% <100.00%> (ø)
...tree/include/nav2_behavior_tree/bt_action_node.hpp 75.17% <70.00%> (-4.37%) ⬇️
..._tree/plugins/condition/goal_updated_condition.cpp 88.88% <83.33%> (-11.12%) ⬇️
..._tree/plugins/condition/time_expired_condition.cpp 90.00% <80.00%> (-10.00%) ⬇️
...ior_tree/plugins/decorator/single_trigger_node.cpp 78.57% <72.72%> (-4.77%) ⬇️
... and 1 more

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SteveMacenski

Copy link
Copy Markdown
Member

@adivardi can you review / close any resolved comments from your review?

#include <string>
#include <vector>

#include <boost/uuid/uuid.hpp>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need to link this / package.xml the dependency? Please only include just the boost libraries required (not all)


// To keep track of the execution number
boost::uuids::random_generator uuid_generator_;
std::string run_id_;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe current_run_id_ to be clear?

"wait_for_service_timeout",
wait_for_service_timeout_);

run_id_ = boost::uuids::to_string(uuid_generator_());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we ever actually use run_id_? If not, then we don't need to store this as a member.

if (getInput("server_name", remapped_action_name)) {
action_name_ = remapped_action_name;
}
getInput("is_global", is_global_);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question: should this be applied to non-action nodes or only the action nodes?

@SteveMacenski SteveMacenski Oct 23, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, I think this is also missing the other nodes that have the initialization procedure within their implementations themselves (not just the action server base node). I think that's a key part of the ticket #5036 but I can understand just starting in one spot to get it right before doing all the others!

BT::InputPort<std::string>("server_name", "Action server name"),
BT::InputPort<std::chrono::milliseconds>("server_timeout")
BT::InputPort<std::chrono::milliseconds>("server_timeout"),
BT::InputPort<bool>("is_global", false, "Use RunID for initialization")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The configuration guide would need to be updated to mention this.

Question: does this make more sense as a BT XML parameter for each and every node, or as a ROS configuration parameter applied to every node automatically from a yaml file? Is there a situation we'd want some nodes to do this and not others?

// first step to be done only at the beginning of the Action
if (!BT::isStatusActive(status())) {
if (is_global_) {
std::string current_run_id = config().blackboard->get<std::string>("run_id");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should throw an exception if the run_id is not set but is_global_. That's an invalid situation.

@SteveMacenski

Copy link
Copy Markdown
Member

Any updates here? This would be good to get in before the lyrical sync. If this is not going to be picked up again, letting me know would be awesome :-)

@mergify

mergify Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

This pull request is in conflict. Could you fix it @silanus23?

@silanus23

silanus23 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

Currently I think I have added most of them. I will carry on batch by batch.

Edit: When I start to write others I have realized that goal updated and battery nodes in current commit could need a fix please let me+ I have made is_global param node by node cause update conditions of these nodes and siutations can vary user to user.

@silanus23

Copy link
Copy Markdown
Contributor Author

@SteveMacenski are these correct nodes? I have gone over the list and some of them might not need so I applied only to these nodes.

@silanus23 silanus23 marked this pull request as ready for review April 14, 2026 18:55
@silanus23

silanus23 commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

@SteveMacenski Don't want to ping you but can you give this a look please? How should I resolve conflict? Should I drop this runid on those nodes?

silanus23 added 9 commits May 27, 2026 11:57
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
…des and their tests

Signed-off-by: silanus23 <berkantali23@outlook.com>
…goal_updated and single_trigger node updated.

Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
@silanus23

silanus23 commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

Later looking back at conflicting PRs I have seen they are only commenting PRs, I thought that it was something that can deprecate ruin-id at first. So I have handled conflict. That's on me for being too presumptuous :/.

I will try to send videos where changes log so review process will be easier.

Edit: I later realized typos I will solve them

silanus23 added 3 commits May 28, 2026 17:37
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
@silanus23

silanus23 commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

https://drive.google.com/drive/folders/1_9RymXihTLZuSZ7DOTpwUuDvpsBrIR5c
in above time expired, goal updated and distance traveled nodes logging with runid change

https://drive.google.com/drive/folders/1_9RymXihTLZuSZ7DOTpwUuDvpsBrIR5c
in above single trigger node logging with runid change

I didn't add these nodes
goal reached condition: not about runid it's about current place.

battery nodes + is_stopped: live conditions, independent from run

Transfrom available condition: This is latch based so runid would ruin this.

I guess these are only ones in that list.

I will implement on remaining controller decorators too.

silanus23 added 7 commits May 28, 2026 20:21
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
@silanus23

silanus23 commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

OK I have now added controller nodes. I was not sure about the logic of time expired, distance traversed likes. I moved as said in the header. It says it reinits with halts so I reinited them with new runid. I have added initialize to some of those node.

I really wonder what you think about nodes I didn't add. They are diffirent than others even they are asynchronus. I am not sure about goal updated condition too.

About should this be 1 yaml param or unique xml port question: While implementing I have seen runid is effecting some of them in really diff aspects I would use xml port but that's a guess I am not sure if I can come up with a scenario.

Lastly I have tried every node I implemented with log system like I have sent videos above. They all work and robot moves.

@silanus23

Copy link
Copy Markdown
Contributor Author

Hey before going offline I reviewed code again. I had seen some problems.
I am still not sure about goal nodes (goal updated condition, goal updated decorator, goal updater). I will wait for answer I can drop the goal updated's implementation. According to me no need since new goal is restarting every node again.
I am not sure about no runid should throw std::runtime_error or BT::RunTimeError.
I should put e.what() for throws.
there are copy paste left over else blocks. I will delete them too :/

I will try to push these changes tomorrow.

silanus23 added 4 commits June 6, 2026 02:03
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
Signed-off-by: silanus23 <berkantali23@outlook.com>
@silanus23

silanus23 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

dropped goal updated cause a new run already comes with a new goal, so it already returns SUCCESS on its own runid wouldn't add anything, just suppress it. not 100% sure, can add it back if wanted. switched to bt error system as said in the prev msg I now take is global from bt input port so I wrote them to nav2_tree_nodes.xml.

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