Ask Your Question

How to change/remap ros node name in launch file?

asked 2014-12-04 02:53:12 -0500

arp gravatar image

updated 2014-12-04 02:54:26 -0500

Hi, I would like to rename a node from a launch file which includes other launch file. Is it possible?? If yes then how is it done.

Here is a launch file I am using. The included launch file names the node as turtlebot_teleop_keyboard. I want to rename the node launched in the included launch file. The following launch file does not rename the node.

     <include file="$(find turtlebot_teleop)/launch/keyboard_teleop.launch"/>
     <remap from="turtlebot_teleop_keyboard" to="teleop"/>
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-12-04 12:12:47 -0500

Dirk Thomas gravatar image

updated 2014-12-17 13:36:17 -0500

According to the docs ( ) remap affects all subsequent nodes.

Therefore you might want to try:

   <remap from="turtlebot_teleop_keyboard" to="teleop"/>
   <include file="$(find turtlebot_teleop)/launch/keyboard_teleop.launch"/>


I have tried it with a simple example and having the remap tag before the node tag is the correct way:

    <remap from="chatter" to="foobar"/>
    <node pkg="rospy_tutorials" type="talker" name="talker"/>

Are you sure your teleop node actually has that topic? It looks the launch file you are using might already perform some kind of remapping internally:

Update 2: this only describes how to remap a topic. Remapping a node name is not possible using roslaunch. If you have control over the launch file you can use an argument to allow passing in a different name for the node name.

edit flag offensive delete link more


It still does not work. I am using hydro on Ubuntu 12.04. The output of rosnode list is

arp gravatar image arp  ( 2014-12-05 01:31:31 -0500 )edit

I commented the remapping so file looks like:

  <node pkg="turtlebot_teleop" type="turtlebot_teleop_key" name="turltebot_teleop_keyboard"/>

I includeed this launch file and tried your answer and it does not rename the node. Does that mean I can't rename nodes?

arp gravatar image arp  ( 2014-12-15 01:32:38 -0500 )edit

Just to clarify. I am trying to rename a node after launching not the topics.

arp gravatar image arp  ( 2014-12-15 01:35:50 -0500 )edit

What do you mean when you say "rename a node after launching"?

Dirk Thomas gravatar image Dirk Thomas  ( 2014-12-15 12:09:09 -0500 )edit

In the example where you remap the topic from chatter to foobar, the node is of type talker and it's name is "talker". Can I change the node-name "talker" to "speaker"??

arp gravatar image arp  ( 2014-12-17 04:52:58 -0500 )edit

answered 2014-12-04 03:41:53 -0500

Bhargav gravatar image

I think you need to specify the node name under which this topic is published. The structure i have been using is:

<node name="alpha" pkg="beta" type= "gama">
<remap from="old_topic_name" to="new_topic"/>

Or else in this case you can copy the contents of .launch file in another file and remap it there itself.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2014-12-04 02:53:12 -0500

Seen: 14,429 times

Last updated: Dec 17 '14