Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(perception_replayer): order rosbags by starting_time #43

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from rosbag2_py import StorageFilter
from rosidl_runtime_py.utilities import get_message
from sensor_msgs.msg import PointCloud2
from utils import get_starting_time
from utils import open_reader


Expand Down Expand Up @@ -82,9 +83,13 @@ def __init__(self, args, name):
# load rosbag
print("Stared loading rosbag")
if os.path.isdir(args.bag):
for bag_file in sorted(os.listdir(args.bag)):
if bag_file.endswith(self.args.rosbag_format):
self.load_rosbag(args.bag + "/" + bag_file)
bags = [
os.path.join(args.bag, base_name)
for base_name in os.listdir(args.bag)
if base_name.endswith(args.rosbag_format)
]
for bag_file in sorted(bags, key=get_starting_time):
self.load_rosbag(bag_file)
else:
self.load_rosbag(args.bag)
print("Ended loading rosbag")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
from tf_transformations import quaternion_from_euler


def get_starting_time(uri: str):
info = rosbag2_py.Info().read_metadata(uri, "sqlite3")
return info.starting_time


def get_rosbag_options(path, serialization_format="cdr"):
storage_options = rosbag2_py.StorageOptions(uri=path, storage_id="sqlite3")

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading