remapping already remapped topics

asked 2019-05-21 10:31:59 -0500

antibus gravatar image

updated 2019-05-21 11:58:58 -0500

Like the title says, is it possible to remap already remapped topics? So suppose you include another launch file in your main launch file and you want to remap some topics from the included launch file, but those topics have already been remapped in the include, which you don't want to change/cannot change. Is this possible and if so how? I tried a couple of different cases and nothing did work.

Example

talker.launch (with first remap)

<launch>
  <node pkg="node_example" type="talker" name="talker">
    <param name="a" value="1"/>
    <param name="b" value="2)"/>
    <param name="message" value="Hello World"/>
    <param name="rate" value="2.0"/>
    <remap from="example" to="chatter"/>
  </node>
</launch>

main.launch (with remap of remapped chatter) <- does not work

<launch>
  <remap from="/chatter" to="/foo"/>
  <include file="$(find node_example)/launch/talker.launch">
  </include>
</launch>

or main.launch <- does not work

<launch>
  <group>
    <remap from="/chatter" to="/foo"/>
    <include file="$(find node_example)/launch/talker.launch"/>
  </group>
</launch>

or main.launch <- does not work

<launch>
    <include file="$(find node_example)/launch/talker.launch"/>
    <remap from="/chatter" to="/foo"/>
</launch>

Still the topic is /chatter and not /foo.

edit retag flag offensive close merge delete

Comments

Can you describe in more detail what you tried, including the launch files themselves. This should be possible but we can't help you unless you show us exactly what you've tried.

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2019-05-21 10:38:20 -0500 )edit

Added example to question.

antibus gravatar imageantibus ( 2019-05-21 11:38:38 -0500 )edit

And if you spec: from="/chatter" to="/foo"?

gvdhoorn gravatar imagegvdhoorn ( 2019-05-21 11:40:43 -0500 )edit

Does not help.

antibus gravatar imageantibus ( 2019-05-21 11:42:58 -0500 )edit

The wiki says:

The <remap> tag applies to all subsequent declarations in its scope (<launch>, <node> or <group>).

So this should in theory be possible, I'd say. It depends probably on the order of the evaluation (parameters, e.g. are "are set in order (after includes are processed)").

Maybe you have to use the original name, i.e. /example in the from= field?

mgruhler gravatar imagemgruhler ( 2019-05-22 00:55:54 -0500 )edit

Nope, still /chatter even if with <remap from="/example" to="/foo"/> in main.launch

antibus gravatar imageantibus ( 2019-05-22 01:53:00 -0500 )edit

Just out of curiostiy, have you tried removing the remap from the included launch file (I know, this is not what you want to do in the end) and see if the remap is working with any of the ways you tried above?

mgruhler gravatar imagemgruhler ( 2019-05-22 02:39:10 -0500 )edit

Haven't tried it so far. Good point. Tried it now and it worked. The topic has been correctly remapped to /foo.

antibus gravatar imageantibus ( 2019-05-22 02:42:33 -0500 )edit