-
Notifications
You must be signed in to change notification settings - Fork 170
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
Add rosparam verb load #590
Conversation
Signed-off-by: Victor Lopez <[email protected]>
@clalancette could you please give this a look? I've got some other PR's that depend on this functionality. |
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.
This looks like a useful feature, thanks for the PR.
A few thoughts:
- I'd like to see tests for the load verb.
- I don't think that the wildcard behavior should be a part of this PR. There is some (currently stalled) discussion on parameter files and presidence - see Clarify ros2 arguments precedence design#289 and Describe wildcard usage in parameter files design#303 - that I think we should wait on. The main reason for this is that I think that we should keep the wildcard behavior of
ros2param
,ros2launch
, andros2run
similar.
Signed-off-by: Victor Lopez <[email protected]>
3e2bb2f
to
6e06195
Compare
@audrow Added tests and removed wildcard behavior. I'm not sure why those unrelated tests are failing. |
Signed-off-by: Victor Lopez <[email protected]>
Thanks, I pushed fixes for the linter. I apologise for that, but I cannot get those errors to show up on my machine. I'm running latest foxy and same flake8 version and never get the bad quotes errors. |
It works for me when I use Also, if the other tests are passing but you're fixing linter warnings, the colcon test mixin |
It would be nice to make a PR to document this new feature in the ROS2 documentation on parameters. I believe it makes sense to add to the "Load parameter file" section of the Understanding ROS2 parameters tutorial. If you make a PR there, I can review it. |
I will add the documentation, probably on Friday as well. |
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.
Looks good to me. I'll run CI.
Signed-off-by: Victor Lopez <[email protected]>
@v-lopez, I'm not sure why but I wasn't able to push changes fixing the linter errors to your branch. Anyway, I've made a commit to fix the linter errors: https://github.com/audrow/ros2cli/commit/812a5be8b4a5f099a51d611fc0d6e7d9c213468c. Once you apply these changes, I'll run CI and, if it's green, we can merge in the two PRs. |
Signed-off-by: Audrow Nash <[email protected]>
Fixes applied! |
I've merged both PRs, thanks for the contribution @v-lopez! |
Thanks to you! Should I make a PR for the |
* Add rosparam verb load Signed-off-by: Victor Lopez <[email protected]> * Move load_parameter_file implementation to api, add test_verb_load Signed-off-by: Victor Lopez <[email protected]> * Apply fixes for linter Signed-off-by: Victor Lopez <[email protected]> * Remove TODO comment Signed-off-by: Victor Lopez <[email protected]> * Fix linter errors Signed-off-by: Audrow Nash <[email protected]> Co-authored-by: Audrow Nash <[email protected]>
internal_node_name = node_name.split('/')[-1] | ||
with open(parameter_file, 'r') as f: | ||
param_file = yaml.safe_load(f) | ||
if internal_node_name not in param_file: |
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.
what about /**
?
I don't see how that is being handled
Thanks for pointing those cases out, @ivanpauno. @v-lopez, can you make another PR addressing @ivanpauno's comments, since this has already been merged? By the way, I checked with the foxy ROS Boss and you can make a PR for a foxy backport. This probably makes sense to do after the new comments are addressed. Feel free to @ me for both PRs. |
I'll work on a PR tomorrow to address this. @ivanpauno I will check for both with and without namespace. Regarding /** it was in there originally but I removed it on 6e06195 as discussed in this PR. I'd like to have this or a similar behavior added, but I guess we are waiting for unique criteria on: ros2/design#289 and ros2/design#303 |
You should only check for the fully qualified name. you should check for
Can you link the discussion? I wasn't able to find it.
IIRC the current behavior is that parameter overrides specific to a node will override the ones passed using the |
Well not a big discussion, just this comment #590 (review)
@audrow Should I put the wildcard behavior back in then? |
@v-lopez, yes, I think it would make sense to support wildcard behavior. Sorry for the misdirection. My intention in #590 (review) was that this new CLI verb doesn't get ahead of the discussion I mentioned on presidence in parameter files, by adding the ability to prioritize for parameters defined with a wildcard. I didn't mean to eliminate handling the wildcard case, which I missed in my review. It would also be great to update the tests to show that wildcards (and namespaces) are handled :) |
@ivanpauno Is this right? Didn't you mean to check for As far as I see, the param files do not have the namespace. Only the node name, which could be with or without leading slash.
|
Well,
and in that case it will look for e.g.: rclcpp code here |
Yikes, good call. It does seem to be broken. Do you mind opening an issue? |
Leaving aside the implications of the changes, I believe it might be interesting to be able to load params for a node, regardless of the namespace. Say I have navigation parameters for a robot, and I want to launch a simulation with multiple robots of the same type. Would I have to create multiple identical files, each with its own namespace? Do some magic at launch time to rename them? |
I'm working on a PR for it.
That's a good question. For the moment, I would focus on consistency and not in that particular use case (which I agree is useful). |
That would make sense to us. And I understand this is not the place to discuss this, could we move the discussion elsewhere? I think it's going to be important in the near future. |
See #600. |
Sounds good, maybe you can open an issue with the proposal in |
I will, but I'd love to have some backing from you guys, otherwise this things get lost in a huge todo pile. I'll ping you when I've opened it. |
I finally solved this issue in #600, as the tests for
That one is still pending. |
Sounds good, I understand that pushing new features/enhancements is demanding.
👍 feel free to tag me. |
@ivanpauno Please see #602 for the wildcard support. |
And the issue about node parameters regardless of namespaces: ros2/ros2#1092 |
* Add rosparam verb load Signed-off-by: Victor Lopez <[email protected]> * Move load_parameter_file implementation to api, add test_verb_load Signed-off-by: Victor Lopez <[email protected]> * Apply fixes for linter Signed-off-by: Victor Lopez <[email protected]> * Remove TODO comment Signed-off-by: Victor Lopez <[email protected]> * Fix linter errors Signed-off-by: Audrow Nash <[email protected]> Co-authored-by: Audrow Nash <[email protected]>
Example execution:
Using the following file:
The parameters in the wildcard namespace are only used if
--use-wildcard
is provided, and are loaded before the node parameters, as I assume that should be the logical behavior.fixes #589