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

Add namespace override #145

Draft
wants to merge 1 commit into
base: humble
Choose a base branch
from
Draft

Conversation

pablogs9
Copy link
Member

Signed-off-by: Pablo Garrido [email protected]

Signed-off-by: Pablo Garrido <[email protected]>
@cmraaron
Copy link
Contributor

cmraaron commented Jul 6, 2022

Hey, I have this a go. Looks like it prefixes the dds topic, eg rt/imu_data and becomes remapped_ns/rt/imu_data, but should be rt/remapped_ns/imu_data.
Also add_datareader needs to be remapped for Subscriber support I believe

@pablogs9
Copy link
Member Author

pablogs9 commented Jul 6, 2022

In which version of ROS 2 did you test?

@cmraaron
Copy link
Contributor

cmraaron commented Jul 6, 2022

ah, yes, I should have said, sorry. I applied your commit to galactic branch

@pablogs9
Copy link
Member Author

pablogs9 commented Jul 6, 2022

Can you test it on humble? I remember that when I tested it it was working properly... But probably it needs a rework.

@cmraaron
Copy link
Contributor

cmraaron commented Jul 6, 2022

Can you test it on humble? I remember that when I tested it it was working properly... But probably it needs a rework.

ok, I just built on humble. same behaviour. It places nodes nicely in namespaces, but not the topics. Publishers, seemingly because of the rt/ prefix, and Subscribers remain un-namespaced

@bjsowa
Copy link

bjsowa commented Jul 25, 2022

I just tested it on humble. The node name is properly prefixed, but all the topics and services remain without a namespace.
When I try to do ros2 node info /ns/firmware, it crashes:

Traceback (most recent call last):
  File "/opt/ros/humble/bin/ros2", line 33, in <module>
    sys.exit(load_entry_point('ros2cli==0.18.3', 'console_scripts', 'ros2')())
  File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py", line 89, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/humble/lib/python3.10/site-packages/ros2node/command/node.py", line 37, in main
    return extension.main(args=args)
  File "/opt/ros/humble/lib/python3.10/site-packages/ros2node/verb/info.py", line 59, in main
    subscribers = get_subscriber_info(
  File "/opt/ros/humble/lib/python3.10/site-packages/ros2node/api/__init__.py", line 85, in get_subscriber_info
    return get_topics(
  File "/opt/ros/humble/lib/python3.10/site-packages/ros2node/api/__init__.py", line 76, in get_topics
    names_and_types = func(node.name, node.namespace)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1464, in __request
    response = self.__transport.request(
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1182, in single_request
    return self.parse_response(resp)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1354, in parse_response
    return u.close()
  File "/usr/lib/python3.10/xmlrpc/client.py", line 668, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 1: "<class 'rclpy._rclpy_pybind11.NodeNameNonExistentError'>:cannot get subscriber names and types for nonexistent node: error not set">

@cmraaron
Copy link
Contributor

hmm, even with the /rt/ prefix the topic still appears as original. Looks like this is coming from the running xrce_dds_agent_instance_ as even with all callbacks turned off ros2 topic list still shows this topic.
Probably I dont understand enough about the the dds to ros mapping and the roles of each component in the agent.

I'm happy to look further into it if someone wants to point me in the right direction.
The code I was using is here https://github.com/cmraaron/micro-ROS-Agent/tree/namespaces


auto remapped_topic_name = namespace_remapping_ + "/" + topic_name;

this->add_datawriter(datawriter_guid, remapped_topic_name, type_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a mistake here? the remapping should only be in the overload of add_datawriter below? This will double namespace it?

Copy link
Contributor

Choose a reason for hiding this comment

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

probably it was intended for add_datareader? Which neither overload has a remapping

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