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

Should spawn_model set namespace to rospy.get_namespace() by default?

asked 2011-09-07 03:56:26 -0500


I've been working with multi-robot scenarios using gazebo. I use nested (included) launch files to launch individual robots, and I want each robot to be in its own namespace. Unfortunately, using <group> tags isn't enough to accomplish this. In order for relevant gazebo topics to appear in the appropriate namespace, I have to pass the "-namespace" argument to spawn_model. Without this everything always ends up in the "/" namespace (despite the fact that the namespace member in the spawn_model utility is initialised to "").

The problem is that using the "-namespace" argument in this case is inconvenient, since a launch file which simply launches a robot shouldn't need to know in which namespace it resides. For complex scenarios, which use nested launch files and namespaces, this is extremely problematic.

Currently I address this by passing in a parameter to the launch file, which contains the desired namespace. This works, but in a chain of included launch files, this parameter will have to be passed around and modified several times, which is still problematic.

One option would be to allow launch files to know in which namespace they reside (e.g. $(arg roslaunch_namespace)). This would probably be useful in general. But this seems to be going around the real problem, which in this case is with spawn_model, in particular.

My suggestion is that spawn_model initialise its namespace member to "rospy.get_namespace()" instead of "". This works great for me, and I assume most people would agree with the resulting behaviour. Spawned models live in the same namespace as the spawn_model executable.

However, since I'm relatively new to ROS, I thought I'd ask if anyone sees any problem with this before I create a ticket.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-09-07 12:42:05 -0500

joq gravatar image

Seems reasonable to me.

If you open an enhancement ticket for simulator_gazebo the developers will see your request and respond to it.

edit flag offensive delete link more


Thanks, I will!
leblanc_kevin gravatar image leblanc_kevin  ( 2011-09-12 01:44:59 -0500 )edit

Question Tools

1 follower


Asked: 2011-09-07 03:56:26 -0500

Seen: 548 times

Last updated: Sep 07 '11