From 28e13b875ade2d89d0fbfc08869aca0c97e98fbc Mon Sep 17 00:00:00 2001 From: simone-ferrari Date: Wed, 18 Sep 2024 14:25:29 +0200 Subject: [PATCH] reading mcap from folder --- mad_icp/apps/mad_icp.py | 2 +- mad_icp/apps/utils/mcap_reader.py | 5 +++-- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mad_icp/apps/mad_icp.py b/mad_icp/apps/mad_icp.py index 6916dc9..d11f473 100755 --- a/mad_icp/apps/mad_icp.py +++ b/mad_icp/apps/mad_icp.py @@ -104,7 +104,7 @@ def main(data_path: Annotated[ elif len(list(data_path.glob("*.db3"))) != 0: console.print("[yellow] The dataset is in ros2 db3 format") reader_type = InputDataInterface.ros2 - elif os.path.isfile(data_path) and data_path.suffix == ".mcap": + elif len(list(data_path.glob("*.mcap"))) != 0: console.print("[yellow] The dataset is in ros2 mcap format") reader_type = InputDataInterface.mcap else: diff --git a/mad_icp/apps/utils/mcap_reader.py b/mad_icp/apps/utils/mcap_reader.py index 7d3b64d..6f19454 100644 --- a/mad_icp/apps/utils/mcap_reader.py +++ b/mad_icp/apps/utils/mcap_reader.py @@ -63,8 +63,9 @@ def __init__(self, data_dir: Path, min_range=0, self.min_range = min_range self.max_range = max_range - assert os.path.isfile(data_dir), "mcap dataloader expects an existing MCAP file" - mcap_file = str(data_dir) + mcap_file_path = next(data_dir.glob("*.mcap"), None) + assert os.path.isfile(mcap_file_path), "mcap dataloader expects an existing MCAP file" + mcap_file = str(mcap_file_path) self.bag = make_reader(open(mcap_file, "rb")) self.summary = self.bag.get_summary() diff --git a/pyproject.toml b/pyproject.toml index eefb5b2..32bcdf8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build" [project] name = "mad-icp" -version = "0.0.5" +version = "0.0.6" description = "It Is All About Matching Data -- Robust and Informed LiDAR Odometry" readme = "README.md" authors = [