Robotics StackExchange | Archived questions

ROS_NAMESPACE environment variable in ROS 2?

I couldn't find this anywhere online, so I'm asking here: is there an equivalent to the ROS_NAMESPACE environment variable in ROS 2? I'm developing a course that relies on using said environment variable because all students access ROS through a shared server, and this set-and-forget (in bashrc) approach was very useful for students.

Asked by aprotyas on 2022-02-27 04:05:24 UTC

Comments

Not sure about the environment variable, but there is a "PushRosNamespace" method when using launch files

Asked by WarTurtle on 2022-04-11 08:15:03 UTC

I also believe that there is not such thing. Perhaps you can define that namespace globally yourself and then apply it in launch files. Launch files are in Python, so getting the namespace shouldn't be an issue, and then as @WarTurtle pointed out - use PushRosNamespace to apply namespaces to your Nodes.

Asked by sejego on 2022-04-22 01:35:48 UTC

Answers