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

jade - rosbag play with remap

asked 2016-07-14 08:13:51 -0500

Balint Tahi gravatar image

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

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2016-08-05 07:21:30 -0500

gerkey gravatar image

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 .

edit flag offensive delete link more

Comments

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.

Balint Tahi gravatar image Balint Tahi  ( 2016-08-05 08:20:28 -0500 )edit

Did you modify the launch file for the topics in your bag file?

tfoote gravatar image tfoote  ( 2016-08-08 01:59:04 -0500 )edit

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.

Balint Tahi gravatar image Balint Tahi  ( 2016-08-08 02:32:48 -0500 )edit
1

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.

tfoote gravatar image tfoote  ( 2016-08-08 12:31:54 -0500 )edit

You can download everything you asked from here: https://www.dropbox.com/s/z750vmdzbj1...

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!

Balint Tahi gravatar image Balint Tahi  ( 2016-08-08 13:23:39 -0500 )edit

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?

Balint Tahi gravatar image Balint Tahi  ( 2016-08-08 14:35:28 -0500 )edit
1

answered 2018-09-20 14:49:01 -0500

130s gravatar image

updated 2018-09-20 14:53:01 -0500

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>
edit flag offensive delete link more

Question Tools

Stats

Asked: 2016-07-14 08:13:51 -0500

Seen: 3,246 times

Last updated: Sep 20 '18