-
Notifications
You must be signed in to change notification settings - Fork 74
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
Rename node-related parameters #122
Conversation
The 'node-' prefix seems redundant since the attribute is part of a <node> tag. Add a deprecation warning in case the old name is used. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
I also just noticed that the migration guide uses the attribute "name", which is currently inconsistent with the implementation. |
You're absolutely right, good catch. |
…teProcess Instead, intercept the 'name' attribute and don't forward to ExecuteProcess. Add a new attribute 'exec-name' that can be used to set the name of the process. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
del kwargs['name'] | ||
exec_name = entity.get_attr('exec-name', optional=True) | ||
if exec_name is not None: | ||
kwargs['name'] = parser.parse_substitution(exec_name) |
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.
@jacobperron hmm, while this is a fine patch, it grows the gap between Python and markup-based launch files. This is something we've discussed with @ivanpauno several times, how detrimental to standardization is the fact that launch frontend parsing support allows one to depart from the original action "signature". IMHO, we should apply this exact same change to the Node
action constructor itself and the parsing function should just use that. WDYT?
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.
The problem with changing the Node
signature is that it breaks API in a confusing way:
if somebody was using name
to specify the executable name, they will have a surprise when that's now used as node name.
I think will should keep XML
attributes as close as possible to Python
constructor arguments.
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.
That is also true. But doing so in XML/YAML only but not in Python makes it worst IMO.
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 agree that this change should happen in the Node constructor, keeping the signature the same as the front-end. I'll do this if there's a consensus to go ahead with this change.
The problem with changing the Node signature is that it breaks API in a confusing way:
if somebody was using name to specify the executable name, they will have a surprise when that's now used as node name.
Yeah, this is a problem. IMO, it seems like a good thing to change long term. In the short-term, we can document the behavior change in the release notes and on whatever documentation exists for launch_ros (note, besides the API docstrings, I only found mention of the "name" attribute in the migration guide and it is already assuming the behavior I expect).
I also understand if there's consensus to leave the implementation as-is in order to avoid breaking the existing behavior.
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 that the API break is reasonable.
To avoid breaking user launch files, node_name
can be deprecated with a warning.
The users that were using name
will have to check the release notes to understand the problem (though I expect not much users using it).
We should also merge the argument name change together with a PR updating the release notes. If not, we will forget later.
If @wjwwood and @hidmic are also ok with breaking API, I think it's fine.
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.
👍 to breaking API to make it make sense, and 👍 for updating the documentation and release notes simultaneously.
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.
Thanks for the input, all. I'm on it 😎
…by ExecuteProcess" This reverts commit 61503c9. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Deprecate 'node_name' and 'node_namespace'. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Add test for deprecated parameters. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
The parameter is named 'exec_name' and forwarded to ExecuteProcess. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
8010e61
to
e7e1325
Compare
@hidmic @ivanpauno I've reverted the 'name' overriding in the parser (45d4992) and added new Node parameters for |
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.
Left some minimal comments.
It would be good to check if something has to be updated in demos/examples/tutorials.
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Good idea, I'll open up PRs connecting to this for instances I find. |
node_name and node_namespace parameters have been deprecated in ros2/launch_ros#122 Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
|
Adding to Foxy release notes: ros2/ros2_documentation#522 |
I think that if we're going to do the change, it makes sense to rename all the def __init__(self, *, name: Optional[Text] = None, node_name: Optional[Text] = None, **kwargs) -> None: If In another release, |
Also, if both are I can do this. |
Deprecate the node_name parameter. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
I've also deprecated the node_name parameter for LifecycleNode (09aa4c5) and updated the connected demos PR. |
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.
Specifically, I've made updates that reflect the change made in ros2/launch_ros#122 Signed-off-by: Jacob Perron <jacob@openrobotics.org>
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!
BTW I figure you chose not to add an Optional
type annotation for some constructor arguments where a None
default is used to convey that argument it's mandatory, but I'd expect mypy
to complain.
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
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.
Overall LGTM, pending green CI
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron is this ready to be merged? |
I was hesitating due to the CI failures. I've retriggered CI. |
@jacobperron I haven't completed the first CI test but in local research ros2/ci#399 is a workaround for the installation paths which should allow the tests to run. |
Specifically, I've made updates that reflect the change made in ros2/launch_ros#122 Signed-off-by: Jacob Perron <jacob@openrobotics.org>
* Update launch_ros Node action usage node_name and node_namespace parameters have been deprecated in ros2/launch_ros#122 * Update LifecycleNode action usage The parameter 'node_name' is deprecated, replaced by 'name'. * Update ComposableNode action usage Signed-off-by: Jacob Perron <jacob@openrobotics.org>
This is a follow-up to #122. If 'node_executable' is used then a deprecation warning is issued. If 'node_executable' is used at the same time as 'executable', then a runtime error is raised. This is similar behaviour to the other parameters deprecated in #122. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
…140) This is a follow-up to #122. If 'node_executable' is used then a deprecation warning is issued. If 'node_executable' is used at the same time as 'executable', then a runtime error is raised. This is similar behaviour to the other parameters deprecated in #122. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Specifically, I've made updates that reflect the change made in ros2/launch_ros#122 Signed-off-by: Jacob Perron <jacob@openrobotics.org>
The 'node-' prefix seems redundant since the attribute is part of a "node" tag.
Add a deprecation warning in case the old name is used.
I couldn't find a reason why 'node-name' was preferred in #73.
I'm suggesting in this PR that we change it 'name', which seems more intuitive for me, especially coming from ROS 1.