-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add runid #5553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add runid #5553
Conversation
|
@adivardi could you give this a review? I just wondered if I comprehend the idea correctly. |
There was a problem hiding this 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())) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); ?
|
Thank you. |
nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp
Outdated
Show resolved
Hide resolved
|
@silanus23 any update? |
|
@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. |
Signed-off-by: silanus23 <[email protected]>
Signed-off-by: silanus23 <[email protected]>
Signed-off-by: silanus23 <[email protected]>
Signed-off-by: silanus23 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Signed-off-by: silanus23 <[email protected]>
|
@adivardi can you review / close any resolved comments from your review? |
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include <boost/uuid/uuid.hpp> |
There was a problem hiding this comment.
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_; |
There was a problem hiding this comment.
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_()); |
There was a problem hiding this comment.
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_); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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.
Basic Info
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_globalfor 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 = truefor every nodeAs the final making this a default.
For Maintainers:
backport-*.