| 27 | MAX_AXIS_RANGE = 50 # HARD CODED: remove far away points |
| 28 | |
| 29 | class DynamicMapData: |
| 30 | def __init__(self, directory): |
| 31 | self.scene_id = directory.split("/")[-1] |
| 32 | self.directory = Path(directory) / "pcd" |
| 33 | self.pcd_files = [os.path.join(self.directory, f) for f in sorted(os.listdir(self.directory)) if f.endswith('.pcd')] |
| 34 | |
| 35 | def __len__(self): |
| 36 | return len(self.pcd_files) |
| 37 | |
| 38 | def __getitem__(self, index_): |
| 39 | res_dict = { |
| 40 | 'scene_id': self.scene_id, |
| 41 | 'timestamp': self.pcd_files[index_].split("/")[-1].split(".")[0], |
| 42 | } |
| 43 | pcd_ = pcdpy3.PointCloud.from_path(self.pcd_files[index_]) |
| 44 | pc0 = pcd_.np_data[:,:3] |
| 45 | res_dict['pc'] = pc0.astype(np.float32) |
| 46 | res_dict['pose'] = list(pcd_.viewpoint) |
| 47 | return res_dict |
| 48 | |
| 49 | def main_vis( |
| 50 | data_dir: str = "/home/kin/data/00", |