ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Changing default namespace in ROS2

asked 2021-08-20 02:00:42 -0500

Raposa gravatar image

Hi everyone,

Does anybody know if there is an easy way to set a namespace for all the nodes started by a launch file, and by all the other launch files started from there?

In ROS 1 there was the possibility to change the default namespace by setting the environment variable ROS_NAMESPACE, but from a quick test I found that this is not the case anymore in ROS 2 foxy.

For large systems distributed among many launch files it is quite bothersome to go and set the namespace argument for each node in each of the launch files. And namespace remapping works only with ros run, but not with ros launch.

To give you a concrete example: imagine having several machines all running the same software. They should all communicate their data and accept commands under separate topics, so it would be great to have a simple way to configure a different namespace for each of them.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-08-20 14:42:16 -0500

shonigmann gravatar image

Using GroupAction's may be able to do what you're looking for, per the comments here. At minimum, it would provide you with a way to scope the launch configuration of your different machines and provide a single namespace to each node in the group. I believe this would still require some manual instrumentation of your launch files to accept a namespace argument, but I have yet to try it myself.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-08-20 02:00:42 -0500

Seen: 927 times

Last updated: Aug 20 '21