Skip to content
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

Fix hardcoded services names in ROSAPI #992

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

FlorianLebecque
Copy link
Contributor

@FlorianLebecque FlorianLebecque commented Jan 14, 2025

Public API Changes
services name now have the namespace and node name as a prefix. If no namespace is defined, no change happens to the services

/rosapi/subscribers -> /namespace/nodename/subscribers
/rosapi/topic_type  -> /namespace/nodename/topic_type
/rosapi/topics      -> /namespace/nodename/topics

Description
Add missing namespace support for services in rosapi. Allowing more than one node running on the same network. This makes it easier to work with multi robot environment.

@bjsowa
Copy link
Collaborator

bjsowa commented Jan 14, 2025

Wouldn't it basically work the same if we just used topics in a private namespace? (e.g. ~/topics or ~/interfaces)

@FlorianLebecque
Copy link
Contributor Author

The services also need to be in a namespaces as we would have services collision if we run multiple node of rosapi

@bjsowa
Copy link
Collaborator

bjsowa commented Jan 14, 2025

The services also need to be in a namespaces as we would have services collision if we run multiple node of rosapi

IIRC putting the name of the service in private namespace should prepend the node's name as well as it namespace. For example, ~/subscribers should resolve to /namespace/rosapi/subscribers.

@FlorianLebecque
Copy link
Contributor Author

FlorianLebecque commented Jan 14, 2025

I've changed the modification, the rosapi services names were hardcoded. Now it should take into account the node name and namespace

@FlorianLebecque FlorianLebecque changed the title Add namespace to services names Fix hardcoded services names in ROSAPI Jan 14, 2025
@bjsowa
Copy link
Collaborator

bjsowa commented Jan 14, 2025

@FlorianLebecque This is not what I meant, just add ~ (tilde) character before topic name. For example, replace full_name + "/topics" with ~/topics. Tilde is a special character that will be resolved by client libraries to node's private namespace.

@FlorianLebecque
Copy link
Contributor Author

Ok, yeah, I misunderstood. It should be ok now :)

Copy link
Collaborator

@bjsowa bjsowa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and seems to work as expected. This breaks the current API though (if using a namespace) so if we want to backport it to Humble or Noetic this should be implemented as an opt-in feature. Jazzy is relatively new so we should be good with some breaking changes for a little while. @sea-bass What do you think?

@sea-bass
Copy link
Contributor

I tested it and seems to work as expected. This breaks the current API though (if using a namespace) so if we want to backport it to Humble or Noetic this should be implemented as an opt-in feature. Jazzy is relatively new so we should be good with some breaking changes for a little while. @sea-bass What do you think?

I agree -- I think it's OK to have this go into Jazzy as is.

@bjsowa bjsowa merged commit 0af768d into RobotWebTools:ros2 Jan 20, 2025
3 checks passed
bjsowa added a commit that referenced this pull request Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants