-
Notifications
You must be signed in to change notification settings - Fork 435
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
Expose --params-file option to composable nodes #1216
Conversation
Fixes ros2#1215 Signed-off-by: Dereck Wonnacott <[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.
What if the node container is in a different machine that the node that's sending the loading request?
How would the file be found?
Except the file exist in the target machine (where the node container is being run), this doesn't make much sense.
IMO, what makes more sense is to load the file in the machine that's sending the request, and generate the request appropriately.
@dawonn-haval what do you think?
@@ -179,6 +179,17 @@ ComponentManager::OnLoadNode( | |||
} | |||
options.use_intra_process_comms(extra_argument.get_value<bool>()); | |||
} | |||
|
|||
// --params-file support | |||
if (extra_argument.get_name() == "--params-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.
Why this argument is prefixed with --
and the one above (use_intra_process_comms
) isn't.
That sounds weird to me.
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 didn't notice and it worked fine. I'll try to remove the '--' and see if it still works.
Regardless, I suppose I should move it to a const since it's referenced more than once... :)
I think both use cases are valid; The existing functionality reads a parameter file locally at the launch file host, and this function reads them at the runtime host. Honestly, I think the fact that launch_ros uses a different parameter file format than rclcpp should be considered a bug and should be resolved. Perhaps supporting both file formats should be supported since this logic has now been released and might already be in use by somebody? In any case, exposing this flag enables developers to use the exact same code for parsing parameter files as when using ros2 run <...> and via component composition, which is advantageous for QA. |
I'm not sure if both should be valid, I don't see much value on loading a parameter file on the "runtime host".
I agree that having two different file formats is weird.
We could use exactly the same parsing code if we would want. |
I find that brittle and surprising.
The reason why file formats are slightly different is because their recipients are different. Any given executable may contain one or more nodes. Therefore, when passing parameters in a file on execution, which parameter goes with which node must be specified. In contrast, when dynamically loading a composable node, it is clear that any parameters belong to said node and thus further specification is not required.
If that's the use case, perhaps passing a parameters' file to the container executable or having a |
@hidmic maybe the launch For that to work, the node name and namespace are needed at launch time, so it won't work in all cases (it will only work when both are passed in the Does that make sense? |
Yeah, that's one option. It'd have to be applied to other use facing APIs too, such as |
Yeah, it doesn't sound like we can distinguish between both formats, as the parameters files for components already accept a nested dictionary. @dawonn-haval I'm closing this one, as supporting to load a file from the "runtime host" machine sounds like a fragile idea. |
Fixes #1215