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

avoidin circular topic remapping

asked 2013-05-23 08:33:17 -0500

jacky_90 gravatar image

Hello. I've got a problem with topic remapping. I have a node that publishes informations relative to a robot, and listens to the topics of the informations relative to other 3 robot of the same type. Something like:

publish on : /robot1/info listens to: /robot2/info , /robot3/info, /robot4/info.

Now I want all the 4 robots to share the same code.

So, I want, for example, robot2 to publish on /robot2/info and to listen to /robot1/info (and to the other 2 robots of course)

In the launch file a used a classic remap in this way: from="/robot1/info" to="/robot2/info" and from="/robot2/info" to="/robot1/info"

but the result is that nothing changes and I think is due to some kind of circular remapping.

Any idea of how to address the problem? Thank you in advance.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-05-23 16:54:21 -0500

I think you've identified the heart of the problem: you're trying to remap the output of a node to the same name as one of its inputs. Instead, try to leave each node's output alone, and only remap the inputs:

  - publishes: infoOut
  - subscribes: infoIn1, infoIn2, infoIn3

<node name="node1" pkg="my_pkg" type="my_node" ns="robot1">
  <remap from="infoIn1" to="robot2/infoOut"/>
  <remap from="infoIn2" to="robot3/infoOut"/>
  <remap from="infoIn3" to="robot4/infoOut"/>

<node name="node2" pkg="my_pkg" type="my_node" ns="robot2">
  <remap from="infoIn1" to="robot1/infoOut"/>
  <remap from="infoIn2" to="robot3/infoOut"/>
  <remap from="infoIn3" to="robot4/infoOut"/>


Alternatively, if you don't want to put each node in a separate namespace, you can use the same approach as above, but remap each node's output into a node-specific name:

<remap from="infoOut" to="infoOut1"/>
edit flag offensive delete link more

answered 2013-05-23 21:54:37 -0500

jacky_90 gravatar image

Thank you very much!

edit flag offensive delete link more

Question Tools


Asked: 2013-05-23 08:33:17 -0500

Seen: 178 times

Last updated: May 23 '13