MCPcopy Create free account
hub / github.com/KTH-RPL/dufomap / main_vis

Function main_vis

main.py:49–77  ·  view source on GitHub ↗
(
    data_dir: str = "/home/kin/data/00",
    voxel_map: bool = True, # output voxel-level map or raw point-level.
)

Source from the content-addressed store, hash-verified

47 return res_dict
48
49def main_vis(
50 data_dir: str = "/home/kin/data/00",
51 voxel_map: bool = True, # output voxel-level map or raw point-level.
52):
53 dataset = DynamicMapData(data_dir)
54
55 # STEP 0: initialize
56 mydufo = dufomap(0.1, 0.2, 2, num_threads=12) # resolution, d_s, d_p same with paper.
57 cloud_acc = np.zeros((0, 3), dtype=np.float32)
58 for data_id in (pbar := tqdm(range(0, len(dataset)),ncols=100)):
59 data = dataset[data_id]
60 now_scene_id = data['scene_id']
61 pbar.set_description(f"id: {data_id}, scene_id: {now_scene_id}, timestamp: {data['timestamp']}")
62 norm_pc0 = np.linalg.norm(data['pc'][:, :3] - data['pose'][:3], axis=1)
63 range_mask = (
64 (norm_pc0>MIN_AXIS_RANGE) &
65 (norm_pc0<MAX_AXIS_RANGE)
66 )
67 # STEP 1: integrate point cloud into dufomap
68 mydufo.run(data['pc'][range_mask], data['pose'], cloud_transform = False)
69 # STEP 1: integrate point cloud into dufomap
70 cloud_acc = np.concatenate((cloud_acc, data['pc']), axis=0)
71
72 # STEP 2: propagate
73 mydufo.oncePropagateCluster(if_propagate=True, if_cluster=False)
74 # STEP 3: Map results; You can save the voxel map directly based on the resolution we set before:
75 mydufo.outputMap(cloud_acc, voxel_map=voxel_map)
76
77 mydufo.printDetailTiming()
78
79if __name__ == "__main__":
80 start_time = time.time()

Callers

nothing calls this directly

Calls 1

DynamicMapDataClass · 0.85

Tested by

no test coverage detected