-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add Pause and SequenceWithBlackboardMemory BT nodes #5247
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?
Conversation
Codecov ReportAttention: Patch coverage is
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
So this is missing tests coverage - but you know that :-) Also make sure to fix DCO
@@ -0,0 +1,98 @@ | |||
// Copyright (c) 2019 Intel Corporation |
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 think all of these should be updated :-)
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.
@redvinaa I meant updated with your company since you wrote these :-)
nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/pause.hpp
Outdated
Show resolved
Hide resolved
nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/pause.hpp
Outdated
Show resolved
Hide resolved
@@ -390,6 +390,15 @@ | |||
|
|||
<Control ID="RoundRobin"/> | |||
|
|||
<Control ID="Pause"> |
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.
Note: Add to the docs.nav2.org for new pages for these 2 nodes + migration guide update for the nodes and how to use them for pause / resume navigation behavior within the BT
nav2_behavior_tree/plugins/control/sequence_with_blackboard_memory.cpp
Outdated
Show resolved
Hide resolved
BT::NodeStatus Pause::tick() | ||
{ | ||
unsigned int children_count = children_nodes_.size(); | ||
if (children_count < 1 || children_count > 4) { |
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.
Docs on the < 1 || > 4
is important. I'd add it both in the header doxygen, the BT walkthrough or tutorial, and the configuration guide page.
Signed-off-by: redvinaa <redvinaa@gmail.com>
Signed-off-by: redvinaa <redvinaa@gmail.com>
@redvinaa, your PR has failed to build. Please check CI outputs and resolve issues. |
Woah, this suddenly became more serious than I expected :D |
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.
Woah, this suddenly became more serious than I expected :D
I think this is really great work! Definitely happy to have it contributed! 🥇
I still have to write the tests and make this work with my jazzy stack, so it might take some time.
OK! Only really nitpicks, tests, and doc updates left in my book
|
||
void switchState(const state_t new_state); | ||
|
||
rclcpp::Node::SharedPtr node_; |
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.
Store the logger not the node please
} | ||
|
||
if (state_ != PAUSED) { | ||
RCLCPP_INFO(node_->get_logger(), "PAUSE_REQUESTED"); |
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 think this log can be a little more than this 😉
} | ||
|
||
if (state_ == PAUSED) { | ||
RCLCPP_INFO(node_->get_logger(), "RESUME_REQUESTED"); |
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 think this log can be a little more than this 😉
* - resume_service_name: name of the service to resume | ||
* | ||
* Usage: | ||
* <Pause pause_service_name="/pause" resume_service_name="/resume"> |
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.
Can we work a little on the naming here: Unpaused --> Active? Resume? Processing?
Unpaused gave me a bit of back and forth to understand & the ON_RESUME
branch is using the word "resume" on "unpaused".
Also, Pause
should now be PauseResumeController
BT::NodeStatus PauseResumeController::tickChildAndTransition() | ||
{ | ||
// Return RUNNING and do nothing if specific child is not used | ||
const uint child_idx = child_indices.at(state_); |
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.
Type out (here and anywhere else) unsigned int
. This helps with windows compatibility
BT::NodeStatus PauseResumeController::tickChildAndTransition() | ||
{ | ||
// Return RUNNING and do nothing if specific child is not used | ||
const uint child_idx = child_indices.at(state_); |
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.
Can we do this logic in the switchState
function? Switch to the correct state if not implemented so that when tickChildAndTransition
is called we do useful work.
Basic Info
Description of contribution in a few bullet points
Description of documentation updates required from your changes
Description of how this change was tested
Future work that may be required in bullet points
For Maintainers: