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

rosbag playing data while recording data

asked 2012-10-21 20:25:14 -0500

Brioche gravatar image

updated 2012-10-21 20:26:08 -0500

Hi all,

I would like to create a 3D model of my environment. I downsampled a point cloud from my kinect. In order to build a 3D model of my environment easily, I thought to record and then to play this point cloud with rosbag (I don't have time to try to use a complex package to set up), but I realized that when I play the rosbag, it's the exact same topic so if I'm still recording it, and trying to show it in Rviz, it doesn't work.

I was thinking to record data every second and then play each rosbag in loop (maybe hard for my RAM) but still it looks like it's doesn't work when I'm playing it in my roslaunch:

<node pkg="rosbag" type="record" name="record_rosbag" args="record --split=2 -O /rosbag/voxel_throttle.bag /voxel_grid/output_throttle" />
<node pkg="rosbag" type="play" name="play_rosbag" args="play -d 20 /rosbag/voxel_throttle_*.bag" />

I thought it should be a good idea, but since I can't make it work, I realize I was naive...

Is there anyone understood what I tried to do? ;) and if there is, is there a way to make it work?


edit retag flag offensive close merge delete



So why do you need to record and play back at the same time? Why not using the original data from the kinect or first record a bag and then play it back?

Lorenz gravatar image Lorenz  ( 2012-10-21 22:34:50 -0500 )edit

Because I'm only able to show the live point cloud and I would like to have my point cloud constantly. For example if I'm going left to right I would like to have the point cloud for all the way, from left to right. That's why I thought to split my record and then to play each bag in a loop.

Brioche gravatar image Brioche  ( 2012-10-22 13:50:11 -0500 )edit

I'm still not sure what exactly you want to do but using rosbag doesn't seem to be a really good solution. It is just not designed for something like that. Did you have a look at octomap?

Lorenz gravatar image Lorenz  ( 2012-10-22 21:07:56 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-10-21 22:51:18 -0500

niosus gravatar image

You normally cannot record and play bag file simultaneously as the bag file that is played publishes the same topic you already have via kinect driver. That is something ROS doesn't know how do deal with. I believe you should first record the topic you need and then split/play it as you need, maybe using some parameters to rename "camera" to avoid publishing two similar topics.

edit flag offensive delete link more



Actually, the topics are not really the problem. You could always use topic remapping to control who subscribes to which node. The actual problem is that you cannot play back the same bag you are recording to because it lacks information e.g. an index that is written when recording finishes.

Lorenz gravatar image Lorenz  ( 2012-10-21 23:19:45 -0500 )edit

Yes, of course, my mistake. That should be named as the first reason.

niosus gravatar image niosus  ( 2012-10-21 23:23:27 -0500 )edit

Don't I avoid this problem by splitting the rosbag?

Brioche gravatar image Brioche  ( 2012-10-22 17:49:11 -0500 )edit

Yes. Partly. But the wildcard you are using won't work. I even don't know if roslaunch expands wildcards at all and even if, they are only expanded only once.

Lorenz gravatar image Lorenz  ( 2012-10-22 21:05:40 -0500 )edit

Question Tools


Asked: 2012-10-21 20:25:14 -0500

Seen: 1,281 times

Last updated: Oct 21 '12