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

namespace renaming

asked 2012-02-21 06:59:10 -0500

cassander gravatar image

updated 2012-02-21 07:02:45 -0500

I have the turtlesim node running at /ajsim/turtle1 It is subscribing to the topic /ajsim/turtle1/command_velocity

I started another node called turtle_teleop_key which publishes the topic /turtle1/command_velocity

The problem is that the node in /ajsim/turtle1 cannot subscribe to the topic at /turtle1/command_velocity

I tried the command, [code] rosrun turtlesim turtle_teleop_key command_velocity:=ajsim/turtle1/command_velocity [/code]

but it doesn't work and the wiki is a little unclear about how the change the namespace. Could someone please tell me how I can make sure they are in the same namespace?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
9

answered 2012-02-21 07:48:13 -0500

DimitriProsser gravatar image

updated 2012-02-22 06:53:24 -0500

Have a look at this tutorial.

You could also use:

export ROS_NAMESPACE=/ajsim
rosrun turtlesim turtle_teleop_key

This would run the teleop node under the ajsim namespace, and would allow you to subscribe to the topic.

EDIT:

I do not know of a way to change a node's namespace while it's running. If you don't want to use the ROS_NAMESPACE variable, then you would want to use roslaunch.

edit flag offensive delete link more

Comments

thank you. That worked. I was wondering if there is a way to change the namespace of a node while it is executing... so that it can continue publishing the messages in the new namespace?

cassander gravatar image cassander  ( 2012-02-21 12:09:34 -0500 )edit

To change the namespace while a node is running?

DimitriProsser gravatar image DimitriProsser  ( 2012-02-22 02:51:10 -0500 )edit

Yes.. is it possible to change the namespace of a node while it is running? If that is not possible, then is it possible to change the namespace of a node while it is being launched on the command line using rosrun without having the export the ROS_NAMESPACE variable?

cassander gravatar image cassander  ( 2012-02-22 05:16:32 -0500 )edit
2

answered 2020-05-04 19:15:46 -0500

AA A gravatar image

you can use the following: rosrun turtlesim turtle_teleop_key __ns:=ajsim to start the teleop node using the namespace ajsim

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-02-21 06:59:10 -0500

Seen: 10,654 times

Last updated: May 04 '20