0
$\begingroup$

Rosanswers logo

Hi,

I would like to play a bag file with rosbag and remap the topics (e.g.: /myTopic:=/playback/myTopic). I tried with launch file:

<launch> <remap from="myTopic" to="/playback/myTopic"/> <arg name="file"/> <node pkg="rosbag" type="play" name="playback" ns="myNamespace" args="—clock $(arg file)" /> </launch>

and from command line also ( rosbag play mybag.bag /myTopic:=/playback/myTopic )

The play starts without any error with both ways, I can see a new topic: myNamespace/clock (or /clock if I start it from command line), but all of the recorded topics are replayed on their original name (e.g. /myTopic) (and the replay is working, I can see it changes the values), so I guess, the remap is not really working or am I missing something?

According to the documentation I saw, this should be possible, but I am not sure it is still working in the jade release.

Thanks in advance! Balint


Originally posted by Balint Tahi on ROS Answers with karma: 21 on 2016-07-14

Post score: 2

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

I don't have a Jade setup to test with, but I was able to remap playback on Indigo.

You want to use the remap tag inside the node tag. E.g.:

<launch>
  <arg name="file"/>
  <node pkg="rosbag" type="play" name="playback" ns="myNamespace" args="—clock $(arg file)">
     <remap from="/myTopic" to="/playback/myTopic"/>
  </node>
</launch>

That should result in the recorded topic /MyTopic being published as /playback/myTopic. To be honest, I'm not certain exactly how the remap interacts with the namespace specification (my initial testing suggests that the namespace into which you put rosbag play doesn't affect the scoping of its published topics).

At the command-line, I was able to remap topics in the usual way, using the same syntax that you suggested.

If these techniques aren't working for you on Jade, then please open an issue: https://github.com/ros/ros_comm/issues.


Originally posted by gerkey with karma: 1981 on 2016-08-05

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Balint Tahi on 2016-08-05:
I tried with your launch file as well, but it is still not working. I have the some services (I guess the default ones) under /playback, but no topics at all.

Comment by tfoote on 2016-08-08:
Did you modify the launch file for the topics in your bag file?

Comment by Balint Tahi on 2016-08-08:
Sure, I did. I tried several ways... I tried to remap everything in the bag (according to the documentation it is possible with from="/" to="/playback"), but it has no effect either, neither remapping /something to /playback/something.

Comment by tfoote on 2016-08-08:
Please update your question to include the actual commands and console outputs, and if possible share a bag file that can reproduce the problem you're seeing. Otherwise we're just guessing.

Comment by Balint Tahi on 2016-08-08:
You can download everything you asked from here: https://www.dropbox.com/s/z750vmdzbj10x3k/rosbag.zip?dl=0

I included a screenshot, the left one is the output of rosbag, the right one is the "rostopic list" before and after rosbag run.

I hope this will help. Thanks in advance!

Comment by Balint Tahi on 2016-08-08:
I tried with /ivar/testAccel:=/playback/ivar/testAccel from command line. It remapped that topic. Maybe I misunderstood how it works, becuase as I can see, the name of a topic is like a path. /a/b and /a/c ha some kind of relationshop... and I wanted to move /a -> /playback/a. Isn't it possible?

$\endgroup$
0
$\begingroup$

Rosanswers logo

Although it's not clear from the statement what remap the OP is asking for specically, from the given bag file that contains /ivar/testAccel, /ivar/testPoint, /ivar/testTopic, I assume that OP wants to remap multiple topics by a single remap operation.

Although I'm not entirely sure (because I have a trouble understinding the English statement and the example table in Remapping Arguments wiki page), I don't think that is possible. My understanding is that remap in launch file works for the full exact name.

Using the example OP provides (with a little modifition done by me), the following worked on my Ubuntu 14.04 - Indigo computer.

<launch>
  <arg name="file" default="$(find foobar)/myRecord.bag" />
  <node pkg="rosbag" type="play" name="playback" ns="myNamespace" args="-l --clock $(arg file)">
    <remap from="/ivar" to="/playback/ivar"/>                      <!-- This does NOT remap. -->
    <remap from="/ivar/testPoint" to="/playback/ivar/testPoint"/>  <!-- This DOES remap. -->
  </node>
</launch>

Originally posted by 130s with karma: 10937 on 2018-09-20

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.