Skip to content

Commit

Permalink
Merge pull request #1767 from knorth55/jsk-rosbag-tools-timestamp-none
Browse files Browse the repository at this point in the history
catch StopIteration when all images do not have stamp
  • Loading branch information
k-okada committed Dec 8, 2022
2 parents f680d3f + f540abc commit 7697952
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions jsk_rosbag_tools/python/jsk_rosbag_tools/bag_to_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,15 @@ def bag_to_video(input_bagfile,

# remove 0 time stamp
stamp = 0.0
while stamp == 0.0:
stamp, _, img, _ = next(images)
if show_progress_bar:
progress.update(1)
try:
while stamp == 0.0:
stamp, _, img, _ = next(images)
if show_progress_bar:
progress.update(1)
except StopIteration:
print('[bag_to_video] No timestamp found in all images')
print('[bag_to_video] Skipping {}'.format(image_topic))
break
start_stamp = stamp
width, height = img.shape[1], img.shape[0]

Expand Down

0 comments on commit 7697952

Please sign in to comment.