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

Play ordered multiple bags from a launch file

asked 2016-10-03 04:15:58 -0500

Kailegh gravatar image

updated 2016-10-04 06:32:26 -0500

Hi, I have a question that might be a bit silly, but i do not really find a answer that satisfy me. I have recorded a sequence of 15 minutes splitted in 1 minute rosbag. I want to reproduce them 1 by 1. Can I do that from a roslaunch just by indicating the path to the folder?

I intened to automatize the process, so the idea is not to have to write by hand the paths to the rosbags, because they will be different every time, just to have to indicate the folder as a paramenter or something like that. Can I do that from a launch file or from a c++ file?

I think that by doing:

rosbag play *.bag

The rosbags should be played according to their timestamps. However I do not know if that is the best way of doing it because the rosbags will be very large (more tan 15GB) and I have tried that but it takes a looooot of time to load all the rosbags files, that is why I ask if there is any other option.

Thanks a lot

UPDATED:

I intend to use at first the rosbag play *.bag and later try to implement a new methow using the rosbag API. However when I try to use it from a roslaunch I obtain this error.

[ INFO] [1475569615.047917389]: Opening /home/kailegh/Descargas/Custom/20Jul16/*.bag
[FATAL] [1475569615.048150633]: Error opening file: /home/kailegh/Descargas/Custom/20Jul16/*.bag

The roslaunch I use looks like this:

<arg name="path" default="/home/lsi2/Descargas/Custom/20Jul16/" />   
<node pkg="rosbag" type="play" name="player" output="screen" args="--clock  $(arg path)*.bag">
</node>

Could you tell me how to use the * in a launch file? Because I think the problem is something related to that, because using the complete name of the bag the launch works well.

Since the topic of the question has changed quite a little I have post the *.bag problem in a new one: http://answers.ros.org/question/24496...

edit retag flag offensive close merge delete

Comments

I think I am going to post a new question since the updated part has little to do with the topic of the question

Kailegh gravatar image Kailegh  ( 2016-10-04 04:49:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-10-03 14:28:31 -0500

lucasw gravatar image

It would be great if rosbag play had an option or it was possible to write a custom node to play the earliest message loaded into memory as soon as it loads: assuming rosbags are internally sorted chronologically rosbag play *.bag could scan just the timestamp of the first message of each bag and not have to parse the entire thing into memory (or even load the raw file into memory? Which part of loading is taking so long?), and then whichever bag has the earlier message it would continue to load it and publish messages out.

It could still handle interleaved messages across multiple bags with a little extra code.

It's worth trying out the code api http://wiki.ros.org/rosbag/Code%20API and seeing if the bag.open("test.bag", rosbag::bagmode::Read); takes a long time, if it does then more invasive surgery is required to only load in initial chunks of a bag and attempting to parse those.

Maybe short of that dramatically different api loading code the solution would be to reprocess all the bags into much smaller files (10-100MB?) that are guaranteed in order by file name, and have a custom rosbag api using node that only loads one at a time and plays it immediately while queuing up the next in the background. If the disk is slow then there might be a few hiccups in playback, but that is better than the super long load times. `

edit flag offensive delete link more

Comments

I tried it agains and it does take some time to load all the bags files but I think it can be assumible. I intend to use at first the rosbag play *.bag from a lauch file, but I am getting this error [FATAL] [145615.04833]: Error opening file: /home/kailegh/Descargas/Custom/20Jul16/*.bag I edited

Kailegh gravatar image Kailegh  ( 2016-10-04 03:34:56 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2016-10-03 04:15:58 -0500

Seen: 2,549 times

Last updated: Oct 04 '16