Ros2 subscriber stops receiving message published from bags after replay several times
System info: ubuntu 20.04 with
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_LOCALHOST_ONLY=0
ROS_DISTRO=foxy
I have a ros2 bag that contains some point cloud data under /raw_points
, and I get data from it through a subscriber. I also need to replay data in a loop.
The following works fine:
In the first terminal - play the bag and use -l
to play data in a loop
ros2 bag play -l -r 3 rosbag2_2021_06_17-13_37_49
In the second terminal, echo the topic
ros2 topic echo /raw_points --no-arr
and I can see the time stamp changes.
However, the following is having trouble:
In the first terminal - play the bag but use a while loop to play data in a loop (without using -l
)
while true; do ros2 bag play -r 3 rosbag2_2021_06_17-13_37_49; done
In the second terminal, echo the topic
ros2 topic echo /raw_points --no-arr
In my case, after less than 10 iterations the subscriber in the second terminal stops receiving data, but the data are still published, which can be verified by creating another subscriber. See the attached demo video.
ros bag link: https://drive.google.com/file/d/13xHl...
demo video: https://drive.google.com/file/d/1J7U1...
I am wondering why behavior in the first and second cases can be different (more publishers created?) and how to keep getting data in the second case.
Thanks.