From 0445515facb005623b2aa34968334ad35b551ccf Mon Sep 17 00:00:00 2001 From: Emanuele Giacomini Date: Tue, 18 Jun 2024 16:21:49 +0200 Subject: [PATCH] Changed timestamp format during KITTI conversion to include nanoseconds. Required for precise data-stamp associations --- python/pyproject.toml | 2 +- python/vbr_devkit/__init__.py | 2 +- python/vbr_devkit/datasets/kitti.py | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index d82effd..700f332 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "vbr-devkit" -version = "0.0.9" +version = "0.1.0" description = "Development kit for VBR SLAM dataset" readme = "README.md" authors = [ diff --git a/python/vbr_devkit/__init__.py b/python/vbr_devkit/__init__.py index 00ec2dc..61fb31c 100644 --- a/python/vbr_devkit/__init__.py +++ b/python/vbr_devkit/__init__.py @@ -1 +1 @@ -__version__ = "0.0.9" +__version__ = "0.10.0" diff --git a/python/vbr_devkit/datasets/kitti.py b/python/vbr_devkit/datasets/kitti.py index eed8198..84885fb 100644 --- a/python/vbr_devkit/datasets/kitti.py +++ b/python/vbr_devkit/datasets/kitti.py @@ -83,8 +83,9 @@ def _save_cloud(self, data: PointCloudXf, timestamp, *args, **kwargs): clip_points = np.stack([data.points["x"], data.points["y"], data.points["z"], data.points["intensity"]], axis=1) clip_points.tofile(dest_path) - else: - data.points.tofile(dest_path) + return + + data.points.tofile(dest_path) def _save_image(self, data: Image, timestamp: float, *args, **kwargs): dest_path = self.data_f / Path(self.format_fn(self.metadata["num_messages"]) + ".png") @@ -117,7 +118,7 @@ def close(self): json.dump(self.metadata, f) with self.timestamps_f.open("w") as f: f.writelines([ - str(datetime.fromtimestamp(float(t) / 1e9)) + "\n" for t in self.timestamps]) + str(np.datetime64(t, "ns")) + "\n" for t in self.timestamps]) class KittiWriter: