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

rosbag play folder with bags using roslauch

asked 2018-05-09 08:15:58 -0500

tanasis gravatar image

updated 2018-05-09 08:21:17 -0500

Hello, how can I use rosbag play in a roslauch file, in order to play a folder that contains all bags. Folder should be and argument to roslauch, e.g:

roslaunch play_data.launch bag_folder:=some_folder

and bag_folder is used inside .launch.

So, in command line this would be just: rosbag play some_folder/*.

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-05-09 08:44:50 -0500

I'm assuming you want to play each bag file in the folder sequentially one after another, not all of them in parallel.

I don't think this is a feature of the rosbag node, you could potentially do this using a bash script. However playing multiple ROS bag files one after another using separate rosbag play commands will cause some problems with the discontinuity of the time stamps.

It would be possible to write your own node using the rosbag Code API to playback a list of bag files in the way that you want. This way you could adjust the timestamps so they were continuous as multiple bags were played back.

edit flag offensive delete link more

Comments

Thanks for the input! Basically concurrently, yes. And rosbag play folder/* seems to be doing this fine. So in that sense I think the rosbag node, can pay all those bags. Currently I am writing a bash script as you also suggested, but I wanted to see if there is a roslauch way. :)

tanasis gravatar image tanasis  ( 2018-05-09 08:49:38 -0500 )edit

can you share this bash script?

Petros ADLATUS gravatar image Petros ADLATUS  ( 2022-03-23 08:06:27 -0500 )edit
1

It has been a while... I tried to find it but no luck, sorry. Basically if I remember the idea is to put the rosbag play folder/*.bag in a bash script. This you can then call from a .lauch file like this.

tanasis gravatar image tanasis  ( 2022-03-23 10:22:32 -0500 )edit

I have a question, do you use folder/*.bag to enumerate every single bag file that is in the folder or is there a way to read a folder without enumerating every file?

Petros ADLATUS gravatar image Petros ADLATUS  ( 2022-03-24 05:26:31 -0500 )edit
1

as far as I know, there is not. You need to specify .bag files to the rosbag play command.

tanasis gravatar image tanasis  ( 2022-03-24 06:21:05 -0500 )edit

thank you Σωτήρα μου :D it works with the listing of each file, but the process does not end afterwards. do you know what the problem could be.

LAUNCH FILE i used:

<launch>

<node pkg="rosbag" type="play" name="bag_files_playback" output="screen" <="" p="">

args="/home/pkatsoulakos/catkin_ws/src/launch/rosbags/Besprechungsraum/_2022-03-23-08-37-50_0.bag /home/pkatsoulakos/catkin_ws/src/launch/rosbags/Besprechungsraum/_2022-03-23-08-39-07_2.bag"/>

</launch>

TERMINAL MESSAGE:

[bag_files_playback-2] process has finished cleanly log file: /home/pkatsoulakos/.ros/log/d083b67e-ab69-11ec-a365-031947a8d74f/bag_files_playback-2*.log

Petros ADLATUS gravatar image Petros ADLATUS  ( 2022-03-24 07:08:39 -0500 )edit
1

haha tpt! What you are trying to do should work. Just pasting it again for you to compare:

<launch>
  <node pkg="rosbag" type="play" name="player" output="screen" args="--clock <full_path_file1>.bag <full_path_file2>.bag etc"/>
</launch>
tanasis gravatar image tanasis  ( 2022-03-25 06:58:22 -0500 )edit

thank you this works for me!

Petros ADLATUS gravatar image Petros ADLATUS  ( 2022-03-25 07:20:51 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-05-09 08:15:58 -0500

Seen: 1,278 times

Last updated: May 09 '18