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

question about ros2 bag play

asked 2019-07-16 21:40:46 -0600

RachelRen gravatar image

I am tried to use ros2 bag record to save the information of camera topic, but how to use ros2 bag play to loop play the package.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2019-07-17 05:21:13 -0600

alsora gravatar image

updated 2019-07-17 05:22:02 -0600

In ROS1 you could loop play using the -l command.

However, it appears that this has not been implemented yet in ROS2.

You can follow the development of rosbag for ROS2 here

edit flag offensive delete link more


I can't mark your answer as correct even though it is :) rosbag2 doesn't have capabilities yet to play the data in a loop.

Karsten gravatar image Karsten  ( 2019-07-17 10:56:31 -0600 )edit

answered 2020-11-19 11:36:00 -0600

Ruthven gravatar image

The option has been implemented in April 2020 (

Use the -l (or --loop) option:

ros2 bag play <bagfile.db3> --loop
edit flag offensive delete link more


This one works, thanks!

leochien gravatar image leochien  ( 2023-05-19 01:41:34 -0600 )edit

answered 2020-11-11 04:05:55 -0600

NY gravatar image

I simply use loop in batch file:

FOR /L %%A IN (1,1,10) DO ( ECHO %%A ros2 bag play <path to rosbag> )

edit flag offensive delete link more

Question Tools



Asked: 2019-07-16 21:40:46 -0600

Seen: 2,909 times

Last updated: Nov 19 '20