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

Add timestamps - KITTI, Rosbag #120

Merged
merged 9 commits into from
Apr 5, 2023
10 changes: 10 additions & 0 deletions python/kiss_icp/datasets/kitti.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, data_dir, sequence: int, *_, **__):

self.scan_files = sorted(glob.glob(self.velodyne_dir + "*.bin"))
self.calibration = self.read_calib_file(os.path.join(self.kitti_sequence_dir, "calib.txt"))
self.timestamps = self.read_timestamps(os.path.join(self.kitti_sequence_dir, "times.txt"))
nachovizzo marked this conversation as resolved.
Show resolved Hide resolved

# Load GT Poses (if available)
if sequence < 11:
Expand Down Expand Up @@ -85,6 +86,14 @@ def _lidar_pose_gt(poses_gt):
poses = poses.reshape((n, 4, 4)) # [N, 4, 4]
return _lidar_pose_gt(poses)

def get_frames_timestamps(self) -> np.ndarray:
return self.timestamps

@staticmethod
def read_timestamps(file_path: str) -> np.ndarray:
timestamps = np.loadtxt(file_path).reshape(-1, 1)
return timestamps

@staticmethod
def read_calib_file(file_path: str) -> dict:
calib_dict = {}
Expand All @@ -102,3 +111,4 @@ def read_calib_file(file_path: str) -> dict:
key = tokens[0][:-1]
calib_dict[key] = values
return calib_dict
nachovizzo marked this conversation as resolved.
Show resolved Hide resolved