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

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

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

arp gravatar image

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

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.

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

3 Answers

Sort by ยป oldest newest most voted
7

answered 2014-12-04 12:12:47 -0600

Dirk Thomas gravatar image

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

According to the docs ( http://wiki.ros.org/roslaunch/XML/remap ) remap affects all subsequent nodes.

Therefore you might want to try:

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

Update:

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

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

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: https://github.com/turtlebot/turtlebo...

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

Comments

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

/rosout
/turtlebot_teleop_keyboard
arp gravatar image arp  ( 2014-12-05 01:31:31 -0600 )edit

I commented the remapping so file looks like:

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

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 -0600 )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 -0600 )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 -0600 )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 -0600 )edit
0

answered 2022-09-23 17:46:55 -0600

stf gravatar image

I know this is an old topic but I had a similar question today. So I found you can rename the node with remap, like this:

<launch>
  <node name="mma" pkg="mma_ros" type="mma_node.py" output="log">
    <remap from="/mma/result" to="/mma2/result" />
  </node>
</launch>

and the output of rostopic list is:

/camera/rgb/image_raw
/mma/visualization
/mma2/result
/rosout
/rosout_agg

For the record, just remapping the node name does not work, i.e. the following does not change it:

<launch>
  <node name="mma" pkg="mma_ros" type="mma_node.py" output="log">
    <remap from="/mma" to="/mma2" />
  </node>
</launch>
edit flag offensive delete link more
0

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

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"/>
</node>

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

Question Tools

3 followers

Stats

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

Seen: 16,951 times

Last updated: Dec 17 '14