-
Notifications
You must be signed in to change notification settings - Fork 194
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
Update remapping order of __ns and __node to not affect each other #299
Update remapping order of __ns and __node to not affect each other #299
Conversation
Signed-off-by: Chen Lihui <[email protected]>
I have no idea if we should apply for using the FQN prefix and remapping order. To push this commit is mainly for discussion. |
articles/141_static_remapping.md
Outdated
- A user gives the rules `talker:__ns:=/my_namespace` then `/talker:__node:=foo` | ||
- The final node name is the default `talker` because the namespace remap is applied before the node name remap |
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 user wants to remap talker
into namespace A
and B
? I believe this is really common use case. I am not so convinced to change order. I think Node name -> Namespace
would be understandable and usable for user.
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 your response. @fujitatomoya
what if user wants to remap talker into namespace A and B?
Sorry, I don't catch it. How can we remap one node talker
into two different namespaces A
and B
?
Node name -> Namespace would be understandable
It has a limitation.
Imageing there are two nodes publisher_node
and subscriber_node
in an application.
/publisher_node
/subscriber_node
I want to remap these two nodes as following (ros2/rcl#806),
/publisher_node
-----> '/ns1/aaa'
/subscriber_node
-----> '/ns2/aaa'
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.
Maybe this case is suited for the real world.
/left_camera -----> /left/camera
/right_camera -----> /right/camera
It seems we can not remap them with current remapping order.
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.
How can we remap one node talker into two different namespaces A and B?
bad example, ignore it... sorry😢
It seems we can not remap them with current remapping order.
/left_camera -----> /left/camera
/right_camera -----> /right/camera
I don't see this is because of remapping order, but implementation. I think we should have some kinda justification to change order to support two nodes with the same name but in different namespaces.
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 don't see this is because of remapping order, but implementation.
That's right, users can set two nodes with Node("camera", "/left") and Node("camera", "/right") in implementation.
but we can't ask users to do this, if somebody just wants to use remapping, there is a limitation.
some kinda justification
Actually, the sample about the 'camera' above is the reason why I open this issue.
I found no discussion about why ros2 use this kind of remapping order(node name -> namespace), after checking ros2/rcl#217 and #181, it seems that ros2 follow the same implementation order to ros1. (If I remember correctly, ros1 doesn't have the remapping order for __name and __ns because it just use one node in an application. )
@sloretz Since you wrote the original design document here, could you maybe weigh in on this design change? |
With this proposal, how can the following example be solved: remap ? This isn't currently possible, but it wasn't uncommon in ROS 1 I think. |
That's interesting. I think this case should be also supported.
and
after using the original value for prefix, it also breaks the backward compatibility.
Edit: If you agree with the above information, I'll update the design, otherwise I think it's time to close this issue. |
I think that a proposal that handle both cases above correctly would be acceptable. |
Signed-off-by: Chen Lihui <[email protected]>
In this PR, I would not add the FQN prefix in it because it's different from the remapping order. If it's necessary, I'll create a new PR for it. @ivanpauno |
@iuhilnehc-ynos I think the proposal is reasonable. It would be great if you can edit the post description and include a motivation of the changes and examples of what the change enables (so future reviewers can understand the rationale of the change).
Combined with allowing FQN in prefixes, this allow even more use cases. |
articles/141_static_remapping.md
Outdated
@@ -340,7 +339,7 @@ Within each category, the rules are applied in the order in which the user gave | |||
|
|||
- A node has name `talker` | |||
- A user gives the rules `talker:__ns:=/my_namespace` then `talker:__node:=foo` | |||
- The final namespace is the default `/` because the node name remap is applied before the namespace remap | |||
- The final node name is `foo` because the namespace and node name remap are applied without affecting each other |
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's the final fully qualified name? Current design says it would be /foo
because the node name remapping happened first. Is this PR proposing the final output would be /my_namespace/foo
?
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's the final fully qualified name?
It's /my_namespace/foo
which you had already answered. I should make the document clear, I'll update it.
Thanks for your understanding. I have updated the description. |
Signed-off-by: Chen Lihui <[email protected]>
@@ -324,8 +324,7 @@ The replacement must be a single token which will become the node's new name. | |||
|
|||
Remapping rules are applied in the following order: | |||
|
|||
1. Node name remapping | |||
1. Namespace remapping | |||
1. Namespace or Node name remapping |
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.
so now name are namespace rules are applied in the order they appear, right?
It would be great to make that clear here
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.
order they appear
This is not the case, they order doesn't matter.
Their prefix is always the node name before remapping, maybe that can be made more clear.
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 is not the case, they order doesn't matter.
They're still ordered within a rule, right? If I give talker:__node:=foo
and talker:__node:=bar
, then is the final name is foo
?
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.
name and namespace rules are applied in the order they appear, right?
they order doesn't matter
the order of name and namespace rules doesn't matter.
I think users like to understand some rules by referring to an example description.
- A user gives the rules
talker:__ns:=/my_namespace
thentalker:__node:=foo
, or vice versa
They're still ordered within a rule, right?
I supposed you mean the order of multiple items about __node or __ns, the answer is yes.
If I give talker:__node:=foo and talker:__node:=bar, then is the final name is foo?
Yes.
Actually, the example description already showed messages,
- talker's namespace is
/foo
because that rule was given first
though the above example usestalker:__ns:=/foo
and__ns:=/bar
About this kind of information, I'll not update it in this PR.
articles/141_static_remapping.md
Outdated
- A user gives the rules `talker:__ns:=/my_namespace` then `talker:__node:=foo` | ||
- The final namespace is the default `/` because the node name remap is applied before the namespace remap | ||
- A user gives the rules `talker:__ns:=/my_namespace` then `talker:__node:=foo`, or vice versa | ||
- The final fully qualified name is `/my_namespace/foo` because the namespace and node name remap are applied without affecting each other |
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 namespace and node name remap are applied without affecting each other
I would change this wording to: the namespace and node name remap rules both match against the orignal node name before remappings are applied
.
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.
Thank you. I'll update it later.
Implementation considerations - it seems possible to implement this by passing the original |
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 idea itself seems good to me. I couldn't think of any use cases it breaks (doesn't seem to break any in the design doc), and it seems to enable a new use case of remapping nodes to have the same name but different FQN.
It looks a bit weird when swapping node names,
-r alice:__node:=bob
-r bob:__node:=alice
-r alice:__ns:=/land
-r bob:__ns:=/wonder
Before this change results in /wonder/bob
and /land/alice
while with this proposal it results in /wonder/alice
and /land/bob
.
But then it doesn't look so weird if I order them this way
-r alice:__node:=bob
-r alice:__ns:=/land
-r bob:__node:=alice
-r bob:__ns:=/wonder
I think it should be made clearer in the Match Part of a Rule
section that whether nodename:
refers to the pre-remaping name or the post-remapping name depends on the rule. For __ns
and __node
it's the pre-remapping node name that gets matched against, while for topic and service rules it's the post-remapping node name that matters.
Thanks for your example.
But there already exist information about this pre-remapping and post-remapping in |
Co-Authored-By: Shane Loretz <[email protected]> Signed-off-by: Chen Lihui <[email protected]>
If not the match rule section, how about another example showing node name remapping and topic name remapping together? I think it'd be helpful because this case looks a little confusing:
|
Signed-off-by: Chen Lihui <[email protected]>
Hi @iuhilnehc-ynos, here some feedback from the ros2 team meeting:
In that way, we avoid breaking previous code (this use case seems to be not too common, so making it more verbose wouldn't be a big issue). Bikeshedding: |
No. These cases can be avoided in users' applications.
Yes, adding this option can avoid the breaking change, but it seems not kindly for users because there are two kinds of rules. If you don't mind, I want to close this issue. |
@iuhilnehc-ynos
I do not have any strong justification to push this design either. |
Agreed, but "silent breakage" (the one that doesn't make your build fail and makes your program behave different than before) is a big issue for existing users.
Sounds good to me. If you have any other alternatives to avoid breaking pre-existing code, that also would be acceptable. Thanks for the proposal @iuhilnehc-ynos ! |
Based on the previous comments, I'm going to close this. |
I encountered an issue about remapping two nodes that originally have a different name to the same new name but with a different namespace.
ex.
there are two nodes in
examples_rclcpp_minimal_composition
, and we want to remap node namespublisher_node
->/publisher_different_ns/test_same_node
subscriber_node
->/subscriber_different_ns/test_same_node
we want to do remapping names like the following way,
rather than using
, since the existing remapping order that parsing
__node
before__ns
causes the latter command to use the samenode_name prefix of __ns
parameter for two nodes.Related to ros2/rcl#806
Signed-off-by: Chen Lihui [email protected]