-
Notifications
You must be signed in to change notification settings - Fork 163
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
Keep domain id if ROS_DOMAIN_ID is invalid. #689
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 a
else {*domain_id = 0u;}
be added instead of all the PRs addressing rmw implementations?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 they don't want to use
0
as the default?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.
We used to force that in the past, and a lot of the rmw implementations aren't handling the default correctly (thus the other PRs are needed).
I don't mind if we want to change this.
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.
After this PR, rcl_node_get_domain_id started to return SIZE_MAX when the environment variable is unset.
The purpose of that API was to return the actual domain id that the node was using (see here), but the "actual" domain id is now erroneous.
IMO, the behavior before this PR was correct, i.e. using 0 as the default domain id if the environment variable is not set.
I really don't see any value in letting the rmw implementation define the actual domain id, and adding a layer in rmw to query the default domain id actually used seems unnecessary.
@hidmic @wjwwood what do you think?
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.
As I've stated elsewhere (here?) I disagree.
I wonder what's the use case for
rcl_get_node_domain_id
.Hmm, how's that possible? I would expect it to be
RCL_DEFAULT_DOMAIN_ID
w/o further changes.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.
For this point:
I think it must use
RMW_DEFAULT_DOMAIN_ID
. When the domain id is in the init options, that is just a default value, the user may override it. If the user wants the middleware to select the domain id, thenRMW_DEFAULT_DOMAIN_ID
should be used.The purpose of
rmw_init_options_init()
was not to allow the middleware to specify a custom default domain id. Though it could have been that or still could be, though I don't think that makes sense... The user needs to be able to explicitly ask the middleware to pick a domain ID regardless of what is in the init options initially, and that is what theRMW_DEFAULT_DOMAIN_ID
is about, from my perspective.I think that we should remove the domain id from the node (node options,
actual_domain_id
, etc) and move it into the rmw context object. I think we should keep theRMW_DEFAULT_DOMAIN_ID
sentinel value, and it can be set in the rmw init options (we could require middlewares initialize it to that value) and then it will always be resolved in the resulting rmw context object.The reason for keeping the
RMW_DEFAULT_DOMAIN_ID
, in my opinion, is to let the domain id being used be configured in the middleware, maybe based on some middleware specific configuration file (similar to our_DEFAULT
QoS settings we have) or as @hidmic said based on some dynamic heuristic like a pool of domain id's.I do not think we need a function to query what the default domain ID would be if we initialized with
RMW_DEFAULT_DOMAIN_ID
(e.g.rmw_get_default_domain_id()
), but I could be convinced otherwise. I think it would be sufficient to say you need to initialize the system in order to find out what the default is.In
rcl
, if the environment variableROS_DOMAIN_ID
is set, then it should be honored, always. The only time the middleware would choose a domain id, is if theROS_DOMAIN_ID
is not set and theRMW_DEFAULT_DOMAIN_ID
value is used, or ifROS_DOMAIN_ID
is somehow set to theRMW_DEFAULT_DOMAIN_ID
value.I think
rcl_get_default_domain_id()
should be renamed probably, since it does not get the default, instead it gets the value from the environment variable if it is set otherwise it does nothing to the givensize_t *
.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.
👍
👍
We currently don't have any way to introspect the
domain_id
that the rmw implementation set, we would need either:the first one makes more sense.
We can call that function after initing the
rmw_context
inrcl
, and store it in the correspondingrcl_context_t
structure.Does that make sense?
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 do we need a function in rmw to get that field? Could it not just be a public member of the
rmw_context_t
object? I mean either would work, I'm just wondering if there's a reason to hide this member internally or not.Otherwise, lgtm.
One lingering doubt in my mind, should we leave the domain id in the node just so middlewares that choose to do it that way can still map domain id to nodes rather than contexts? I'm not sure it makes sense to do that, but I'm just asking if anyone thinks we'll need that at some point?
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.
Yeah, a member variable also sounds good.
My mental idea is that you have to create two contexts if you need different domain ids, regardless if the implementation can have a different domain id for each node or not.
Multi domain id applications are strange (mainly domain bridges?), and support for setting the domain id with node granularity doesn't seem to add much value.
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.
It's settled then!
I agree. I had my doubts about this at some point in time, but I see now those were unfounded.