Ask Your Question
0

Remapping topic name on different client while using launch file

asked 2013-03-15 06:15:00 -0500

Tariq gravatar image

updated 2019-04-12 03:50:19 -0500

130s gravatar image

I am using ROS Electric. I have three ROS station, one is master and other two are client machines. Each client machine has its own Kinect. Master's IP is configured as ROS_MASTER_URI on both clients.

I am using this following launch file to launch the skeletal tracker on both clients.

<launch> 
<arg name="fixed_frame" value="openni_depth_frame"/>

<include file="$(find skeleton_markers)/launch/skeleton.launch"> </include>

 <node pkg="skeleton_markers" name="skeleton_markers" type="skeleton_markers.py" output="screen">
    <rosparam file="$(find skeleton_markers)/params/marker_params.yaml" command="load"/>
 </node>
</launch>

Now the problem is, this launch file publishes two topics /skeleton and /skeleton_markers. I tried to change the "name" parameters here, but it did not work. This file is also launched on those two clients, and need separate topic name. How can I remap these topics? Thanks in advance for your help.

Best regards, Tariq

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2013-03-18 03:30:03 -0500

updated 2013-03-24 13:59:47 -0500

I think the "cleaner" answer is to launch the nodes within a separate namespace. You can specify a namespace for each node as shown here. Depending on how the node is set up, all "local" topics should then be published under this separate namespace.

<node pkg="skeleton_markers" name="skeleton_markers" type="skeleton_markers.py" ns="system1"/>

I think the issue you're seeing above is that when you run rostopic list on a running system, it shows both the published and subscribed topic names. My guess is that when you modify the published topic names as shown above, you forget to also remap the topic that a different node is subscribing to. If you run rostopic info on a particular topic name (as shown by rostopic list), it will list out exactly which nodes are publishing/subscribing to each topic. This may help you troubleshoot.

I have not used skeleton_markers before, but it's possible that you may need to also tell the nodes to publish the markers in different rviz namespaces. Note that these namespaces are distinct from normal ROS namespaces. RViz requires that all markers have unique names, as a combination of their id and namespace values. It looks like the skeleton_markers node supports this through the use of the ~ns parameter. You can specify this parameter in your launch file also:

<node pkg="skeleton_markers" name="skeleton_markers" type="skeleton_markers.py" ns="system1">
  <param name="ns" value="skeleton1"/>
</node>

Edit:
According to your comments, it looks like the <include> file is pulling in additional topics in the root namespace, not your sub-namespaces. I suggest you read up on the roslaunch XML syntax.

When you review that documentation, you'll see that the <include> tag has an optional namespace parameter just like we used for the <node> tag: ns="system1". You can add this to the <include> tag to force it to publish its nodes in a sub-namespace as well.

At this point, though, there's a better way to set the namespace for multiple different roslaunch tags. Use the <group> tag. If you use this in combination with an <arg> tag, you can use the same launch file for both client machines and pass in the desired namespace on the command line when you call roslaunch:

<arg name="skel_ns"/>
<group ns="$(arg skel_ns)">
  <include file="$(find skeleton_markers)/launch/skeleton.launch"/>
  <node pkg="skeleton_markers" name="skeleton_markers" type="skeleton_markers.py" output="screen">
    <rosparam file="$(find skeleton_markers)/params/marker_params.yaml" command="load"/>
    <param name="ns" value=$(arg skel_ns)"/>
  </node>
</group>

roslaunch skel_client.launch skel_ns:="system1"

Good luck!

edit flag offensive delete link more

Comments

Thanks a lot Jeremy for you answer. This is really helpful for me to understand the architecture. The namespace renaming thing works for the 'skeleton_makers', so now the topics are published as /system1/skeleton and /system1/skeleton_markers.for space limitation, i'll finish my question in next cmn

Tariq gravatar imageTariq ( 2013-03-23 18:46:19 -0500 )edit

But, the topic /skeleton is still exits. after 'rostopic info /skeleton', it says 'Publishers:/skeleton_tracker'. So I guess, this is published by the line '<include file="$(find skeleton_markers)/launch/skeleton.launch"> </include>'. How can I set a new name space name for 'skeleton.launch' file?

Tariq gravatar imageTariq ( 2013-03-23 18:48:19 -0500 )edit

And, I am really sorry for the late reply. I was out of town, and didn't have access to the system.

Tariq gravatar imageTariq ( 2013-03-23 18:55:55 -0500 )edit

Thanks a lot Jeremy for your valuable help. It works.

Tariq gravatar imageTariq ( 2013-03-24 17:45:47 -0500 )edit
1

answered 2013-03-15 06:25:59 -0500

Hi again,

You could do this :

<launch> <arg name="fixed_frame" value="openni_depth_frame"/>

<include file="$(find skeleton_markers)/launch/skeleton.launch"> </include>

<node pkg="skeleton_markers" name="skeleton_markers" type="skeleton_markers.py" output="screen" args="/skeleton:=/skeleton_1 /skeleton_markers:=/skeleton_markers_1"> <rosparam file="$(find skeleton_markers)/params/marker_params.yaml" command="load"/> </node> </launch>

And do the equivalent on the second machine (by changing number 1 to 2).

Let me know :-)

For future reference on remapping, see here

Bests,

Steph

edit flag offensive delete link more

Comments

Thanks Steph Again:). It works. It start publishes /skeleton_1 and /skeleton_markers_1 topic, the only problem is, it still publishes the /skeleton topic as well. But, not the /skeleton_markers topic.

Tariq gravatar imageTariq ( 2013-03-15 06:34:27 -0500 )edit

Hum, that's weird, are you sure ? Try stopping all you running nodes, and try again. Because it should not publish the /skeleton anymore....

Stephane.M gravatar imageStephane.M ( 2013-03-15 06:35:29 -0500 )edit

I guess, yes. I stopped all other running nodes. Then do 'rostopic list', there was not /skeleton topic. After launching, it is showing three topic '/skeleton /skeleton_1 and /skeleton_markers_1'. :(

Tariq gravatar imageTariq ( 2013-03-15 06:42:20 -0500 )edit

hum. Instead of /skeleton:=/skeleton_1, try skeleton:=skeleton_1

Stephane.M gravatar imageStephane.M ( 2013-03-15 06:46:11 -0500 )edit

No luck :( I've just tried, but the same result.

Tariq gravatar imageTariq ( 2013-03-15 06:52:31 -0500 )edit

And the data is still published in /skeleton ? Or is it in /skeleton_1 ? Or in both ? (try to save with a rosbag, and do a rosbag info to see where is the information).

Stephane.M gravatar imageStephane.M ( 2013-03-16 11:32:12 -0500 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2013-03-15 06:15:00 -0500

Seen: 2,566 times

Last updated: Apr 12