-
Notifications
You must be signed in to change notification settings - Fork 1.7k
BT nodes not able to accept parameter values #3988
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
Conversation
|
@maksymdidukh, your PR has failed to build. Please check CI outputs and resolve issues. |
|
This pull request is in conflict. Could you fix it @maksymdidukh? |
|
@maksymdidukh, your PR has failed to build. Please check CI outputs and resolve issues. |
|
I'm happy to review this in detail once you can actually build it 😉 From a quick glance, you're moving input getting from the constructors to the ticks, which I assume is because you're varying some or all of those inputs (eg non-const)? I'm kind of surprised for many of them that you'd actually change them mid-operation, but who am I to argue. The only ones I have somewhat substantial beef with are those that are moving the creation of subscriptions in |
This reverts commit c1cd575.
sure! I'll remove PR from the draft when it's ready for review :) |
|
OK. Much of your linting issues (though I'm sure you have a few of your own) will be fixed by rebasing or pulling in main. Some other things large-number of linting problems were fixed recently. |
|
@maksymdidukh, your PR has failed to build. Please check CI outputs and resolve issues. |
|
This pull request is in conflict. Could you fix it @maksymdidukh? |
|
@maksymdidukh, your PR has failed to build. Please check CI outputs and resolve issues. |
|
@maksymdidukh, your PR has failed to build. Please check CI outputs and resolve issues. |
|
@maksymdidukh, your PR has failed to build. Please check CI outputs and resolve issues. |
|
@maksymdidukh, your PR has failed to build. Please check CI outputs and resolve issues. |
|
@maksymdidukh, your PR has failed to build. Please check CI outputs and resolve issues. |
|
I'm on the fence about the action / service nodes. On one hand it would be nice to actually resolve some subtree issues if we didn't get those ports in the constructor. It also then makes it no different from the other BT nodes. On the other hand, it delays the construction of the action client to give very little time for discovery to occur before calling the action and pushing the I'm leaning towards asking you to revert the changes in those two files, but I could be convinced if someone has a strong outside reason why we should enact that change given the trade off. I'd say for now to revert those two files so that we can merge in all the rest. Then I suppose we could have a follow up PR or discussion about it if someone disagrees. We don't have to have the controversial stuff happen right now to get 80% of the benefit immediately. |
reverted) |
|
When this PR is merged, will we be able to make a backport to iron? |
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.
@maksymdidukh this change breaks ABI so unfortunately it cannot be backported to any existing distributions. I looked into some policy requirements for ABI stability and its pretty clear cut that this could cause issue if you attempted to recompile the C++ files from the old installed headers since the initialize function is new. I tried to think of a way to make this work, but I think this falls on the wrong side of stability policies to be backport-able.
However, Iron is not very different from this, so you should be able to cherry-pick the merge commit here and apply to Iron on your own fork (for the next ~5 months before Jazzy) and you'll get all this included in Jazzy and newer! Or, you could even just use main from Nav2 with Iron and that should also work.
@jwallace42 any additional comments?
Edit: you have a test failure:
/opt/overlay_ws/src/navigation2/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp:153
Expected equality of these values:
tree_->rootNode()->status()
Which is: FAILURE
BT::NodeStatus::SUCCESS
Which is: SUCCESS/opt/overlay_ws/src/navigation2/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp:156
Expected equality of these values:
action_server_->isGoalCancelled()
Which is: false
true
jwallace42
left a comment
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.
LGTM!
|
Thanks for the contribution! This is a really nice one |
* fix simple cases * fix on_tick type in drive_on_heading node * fix linting and fixed other nodes * Revert "fix linting and fixed other nodes" This reverts commit c1cd575. * fix linting * fixes for subscription cases in action nodes * fixes in condition nodes * fix input usage * fix uncrustify * . * fix typo in back_up_action.cpp * fix in drive_on_heading_action * remove unnecessary first_use variables * typo * typo * typo * fixed typos * move initialize() method above tick() * revert changes in truncate_path_action node * revert changes in case of creating subscription in constructor * remove global_frame_ in remove_passed_goals_action node * changes in is_path_valid and rate_controller nodes * change bt_cancel_action node * change bt_action_node * add xml_tag parameter * revert changes in bt_action and bt_cancel_action nodes * pre-commit * . Signed-off-by: gg <josho.wallace@gmail.com>
* fix simple cases * fix on_tick type in drive_on_heading node * fix linting and fixed other nodes * Revert "fix linting and fixed other nodes" This reverts commit c1cd575. * fix linting * fixes for subscription cases in action nodes * fixes in condition nodes * fix input usage * fix uncrustify * . * fix typo in back_up_action.cpp * fix in drive_on_heading_action * remove unnecessary first_use variables * typo * typo * typo * fixed typos * move initialize() method above tick() * revert changes in truncate_path_action node * revert changes in case of creating subscription in constructor * remove global_frame_ in remove_passed_goals_action node * changes in is_path_valid and rate_controller nodes * change bt_cancel_action node * change bt_action_node * add xml_tag parameter * revert changes in bt_action and bt_cancel_action nodes * pre-commit * . Signed-off-by: enricosutera <enricosutera@outlook.com>
* fix simple cases * fix on_tick type in drive_on_heading node * fix linting and fixed other nodes * Revert "fix linting and fixed other nodes" This reverts commit c1cd575. * fix linting * fixes for subscription cases in action nodes * fixes in condition nodes * fix input usage * fix uncrustify * . * fix typo in back_up_action.cpp * fix in drive_on_heading_action * remove unnecessary first_use variables * typo * typo * typo * fixed typos * move initialize() method above tick() * revert changes in truncate_path_action node * revert changes in case of creating subscription in constructor * remove global_frame_ in remove_passed_goals_action node * changes in is_path_valid and rate_controller nodes * change bt_cancel_action node * change bt_action_node * add xml_tag parameter * revert changes in bt_action and bt_cancel_action nodes * pre-commit * .
* fix simple cases * fix on_tick type in drive_on_heading node * fix linting and fixed other nodes * Revert "fix linting and fixed other nodes" This reverts commit c1cd575. * fix linting * fixes for subscription cases in action nodes * fixes in condition nodes * fix input usage * fix uncrustify * . * fix typo in back_up_action.cpp * fix in drive_on_heading_action * remove unnecessary first_use variables * typo * typo * typo * fixed typos * move initialize() method above tick() * revert changes in truncate_path_action node * revert changes in case of creating subscription in constructor * remove global_frame_ in remove_passed_goals_action node * changes in is_path_valid and rate_controller nodes * change bt_cancel_action node * change bt_action_node * add xml_tag parameter * revert changes in bt_action and bt_cancel_action nodes * pre-commit * .
|
A bit late to the party, but I think there's some problems with this solution. I think the proper solution would be to pass the diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp
index 0a89dcfb..40ddfeb9 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp
@@ -194,15 +194,15 @@ public:
{
// first step to be done only at the beginning of the Action
if (status() == BT::NodeStatus::IDLE) {
- // setting the status to RUNNING to notify the BT Loggers (if any)
- setStatus(BT::NodeStatus::RUNNING);
-
// reset the flag to send the goal or not, allowing the user the option to set it in on_tick
should_send_goal_ = true;
// user defined callback, may modify "should_send_goal_".
on_tick();
+ // setting the status to RUNNING to notify the BT Loggers (if any)
+ setStatus(BT::NodeStatus::RUNNING);
+
if (!should_send_goal_) {
return BT::NodeStatus::FAILURE;
} |
|
Hi, sorry for the delay, ROSCon, ROS-I, and a short vacation left me away from my desk to think about complicated technical problems :-) @redvinaa I appreciate the point and agree. Another option: we could set the initialization to We have some examples of doing such things https://github.com/ros-navigation/navigation2/blob/main/nav2_behavior_tree/plugins/decorator/goal_updated_controller.cpp#L35-L45 that we could duplicate here. Is that the right move in conjunction with your suggestion to move the status setting? |
Yes, this is the same solution as what I suggested. As this is a decorator node, and doesn't inherit from Pro for the initialization fix is that it can't break existing nodes. But also it has to be implemented separately in every single bt node. And this quick fix just takes us deeper down into the rabbit hole. |
|
@redvinaa can you file a ticket about this so we can discuss further? I don't want this to get forgotten in the merged PR body.
Don't both solutions involve a bit of repetition for every Action BT Node? I don't think this would break existing nodes either way, both solutions seem backportable to me on the face. I like the use of Is this something you're open to working on? |
…on#3988) * fix simple cases * fix on_tick type in drive_on_heading node * fix linting and fixed other nodes * Revert "fix linting and fixed other nodes" This reverts commit c1cd575. * fix linting * fixes for subscription cases in action nodes * fixes in condition nodes * fix input usage * fix uncrustify * . * fix typo in back_up_action.cpp * fix in drive_on_heading_action * remove unnecessary first_use variables * typo * typo * typo * fixed typos * move initialize() method above tick() * revert changes in truncate_path_action node * revert changes in case of creating subscription in constructor * remove global_frame_ in remove_passed_goals_action node * changes in is_path_valid and rate_controller nodes * change bt_cancel_action node * change bt_action_node * add xml_tag parameter * revert changes in bt_action and bt_cancel_action nodes * pre-commit * .
* BACKPORT - BT nodes not able to accept parameter values (ros-navigation#3988) * fix simple cases * fix on_tick type in drive_on_heading node * fix linting and fixed other nodes * Revert "fix linting and fixed other nodes" This reverts commit c1cd575. * fix linting * fixes for subscription cases in action nodes * fixes in condition nodes * fix input usage * fix uncrustify * . * fix typo in back_up_action.cpp * fix in drive_on_heading_action * remove unnecessary first_use variables * typo * typo * typo * fixed typos * move initialize() method above tick() * revert changes in truncate_path_action node * revert changes in case of creating subscription in constructor * remove global_frame_ in remove_passed_goals_action node * changes in is_path_valid and rate_controller nodes * change bt_cancel_action node * change bt_action_node * add xml_tag parameter * revert changes in bt_action and bt_cancel_action nodes * pre-commit * . * BACKPORTED - Pass IDLE to on_tick, use that for initialize condition Signed-off-by: redvinaa <redvinaa@gmail.com> * Fix battery sub creation bug Signed-off-by: redvinaa <redvinaa@gmail.com> * Fix conflict errors, check idle isntead of isStatusActive --------- Signed-off-by: redvinaa <redvinaa@gmail.com> Co-authored-by: maksymdidukh <142302397+maksymdidukh@users.noreply.github.com>

Basic Info
Reasong for change
There are BT nodes that read the input ports from the constructor. This causes issues when we want to pass the variables as input.
Description of contribution in a few bullet points
getInput()usage from constructor totick()methodDescription of documentation updates required from your changes
Future work that may be required in bullet points
For Maintainers: