-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Select behavior Tree in NavigateToPoseAction #1784
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1784 +/- ##
==========================================
- Coverage 66.79% 66.56% -0.24%
==========================================
Files 200 200
Lines 10532 10543 +11
==========================================
- Hits 7035 7018 -17
- Misses 3497 3525 +28
Continue to review full report at Codecov.
|
Wouldn't it be more easier to implement to do this behavior through a parameter server? You could also have like multiple input vectors..:
I dislike the idea to have it in the action, as I would personally like to have them clean. In the end you could argue to include nearly all params through the action request. I think that is exactly why we have parameter server in ROS2. Speaking of parameter servers ( I only saw them in design docs and really liked the concept. I did not test them so far and I don't know if nav2 already utilizes them) Besides that I still like your implementation. You could easily shuffle the internals of the nav2 BT around with a single different param (wherever it might come from.. 🙂 ) |
Hi @gramss @gavanderhoorn, a ROS2 developer that I respect, gave me an explanation last week, in the context of our project MROS, that convinced me about the usage in ROS2 what was called parameter server in ROS1. Actually, I worked here in a way to change Nav2 BT during navigation using parameter server. The explanation was:
This reasoning makes me think that it is not good to change the behavior of Nav2 during the execution of navigation actions using parameters. I don't like the idea of including every setting in the action request. Many of them are very related to the characteristics of the robot and shouldn't be specified in every call. But BTs in Nav2 are designed to adapt navigation behavior to the Nav2 user (who call the action) needs. Why should this behavior be the same in every navigation action execution? You can face applications as described in #1780. Using this approach, you have a default behavior for a particular navigation action, and a way to specify another "special" behavior if needed. |
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.
See questions in ticket, we still should cover those open questions first, and I dont think it would be wise to fix this up until we have answers we can all agree upon.
A bit of my concern is around parameterization and configuration management. E.g. if we even have parameters for behavior trees mapped or the requester gives a file path and there's no mapped names.
Hi all, I have changed the code to specify the full path to the behavior tree to use in the navigation. The default behavior tree is specified by the @SteveMacenski, after 11 executions specifying different BT files, including default, the time spent to change the BT is 24,56 milliseconds, with a standard deviation of 7,67 ms. I think it is assumable. Of course, nothing is spent if the BT is the same as the last navigation action execution. Best |
Wait!! I did a rebase and I am including commits not related to my PR... I will try to fix it |
Signed-off-by: Francisco Martin Rico <[email protected]>
Now it's fixed. I have force-pushed only with my commits. You can now review Francisco |
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.
A couple of logic updates but I think its on the right track. I would spend a little more time seeing if you can get it to work without the shared / smart pointer. That will contribute to the latency of creating the tree and I want to absolutely avoid that if possible.
Signed-off-by: Francisco Martin Rico <[email protected]>
Signed-off-by: Francisco Martin Rico <[email protected]>
Signed-off-by: Francisco Martin Rico <[email protected]>
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 you test to show that this does what you think it should?
@fmrico what's the latency for tree creation now that its not a shared pointer? |
Also you're changing parameter names. Please update https://github.com/ros-planning/navigation2/blob/master/doc/parameters/param_list.md and https://github.com/ros-planning/navigation.ros.org/blob/master/configuration/packages/configuring-the-bt.rst params that you added/subtracted and new description |
PRs to docs done. After 14 executions with different BTs, the |
Thank you for your in-depth explanation about the usage of parameter server. I strongly share your opinion about not changing the behavior during the execution of the action / behavior. I was only pitching the idea of using the parameter server for delivering the path for the „next“ BT. So every time the action would be called, the parameter server gets checked like your initial action message. And only here it has the power to change the BT before the BT gets build (like in your approach) So while changing this parameter while executing a BT action, this would have no affect to the current BT. I would only check it right after the action goal is received and before the BT is rebuild anyway. But my point might be already to late in the discussion. Would love to hear your standpoint about that. I think it shifts a little bit the usage of a parameter server that you first thought of. |
@gramss can you be concise in what your suggested change or approval is for? I don't see a clear reference to something you either want changed in this PR or something you like. @fmrico only blocker is the updating to failing if BT isn't valid & testing that this works as intended with your application. |
Hey @SteveMacenski , yes sorry. I should have quote replied. This is answering this comment: #1784 (comment) It seems to have been collapsed after i posted my comment. My idea was to not set the BT to execute via an additional field in the action request to Nav2 but rather use a parameter server entry. (You can jump to TL;DR here..) Potential benefit: this could make this additional feature of changing the BT more inclusive? Thinking this through: TL;DR: |
Signed-off-by: Francisco Martin Rico <[email protected]>
Hi @gramss I don't quite understand your proposal. I think we agree that using parameter servers in lifecycle nodes is not convenient because they have just been designed so that the configuration should be done in the I understand that you propose that if a node (the one which defines the robot behavior) wants to specify the BT used to navigate, it must first change the parameter in
I propose to continue with this PR, which is practically finished, and wait for another PR with your proposal so that we can see the answers to these questions. I think we could create a new issue (or use #1780 ) to see the pros and cons. Thank you for your contribution to this discussion. |
Signed-off-by: Francisco Martin Rico <[email protected]>
Great new feature, thanks Francisco! |
Thanks, @SteveMacenski !! 😊 |
Hi, as a result of this PR, would it not make sense for the navigate_to_pose_action.cpp (BT action node) to have the option to set the behavior tree? |
I don't understand the comment |
The NavigateToPose Action server accepts a behavior tree as input but its corresponding BT action node does not have a behavior_tree option. My question is whether we should add it. I hope it's clearer? |
I see, looks like an oversight. I'd be more than happy to merge a PR implementing the full API on the BT node |
* Select BT in NavigateToPose action Signed-off-by: Francisco Martin Rico <[email protected]> * Change to unique_ptr. Default bt_xml to a valid file Signed-off-by: Francisco Martin Rico <[email protected]> * Return tree to stack Signed-off-by: Francisco Martin Rico <[email protected]> * Removed default_bt_xml_filename default value Signed-off-by: Francisco Martin Rico <[email protected]> * Failing fast, early and loud when BT is not valid Signed-off-by: Francisco Martin Rico <[email protected]> * Return inmediately after terminate Signed-off-by: Francisco Martin Rico <[email protected]>
Basic Info
Description of contribution in a few bullet points
Changes in NavigateToPose.action to include a field
string behavior_tree
with the ID of the BT to use. If it is void (""), the use the first BT in params. This change solves backward compatibility.Use a list of BTs, in the similar way as plugins (the first could is the BT by default):
In
bt_navigator
tree_ is changed tostd::shared_ptr<BT::Tree>
to ensure a clean BT when it is changed. Measured BT recreating time. It is inexpensive.Remove
bt_xml_file
param in launchers, as it is selected in by params. Specifying this from two places (innav2_params.yaml
also) could be confusing.Description of documentation updates required from your changes
NavigateToPose.action
. Field behavior_tree in the request should be describedFuture work that may be required in bullet points