-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathconvert_kitti_to_rosbag.py
48 lines (38 loc) · 1.55 KB
/
convert_kitti_to_rosbag.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# Copyright 2021 by Julian Nubert, Robotic Systems Lab, ETH Zurich.
# All rights reserved.
# This file is released under the "BSD-3-Clause License".
# Please see the LICENSE file that has been included as part of this package.
import numpy as np
import torch
import yaml
import ros_utils.convert_to_rosbag
def config():
f = open('config/deployment_options.yaml')
config = yaml.load(f, Loader=yaml.FullLoader)
f = open('config/config_datasets.yaml')
dataset_config = yaml.load(f, Loader=yaml.FullLoader)
config.update(dataset_config)
# Device to be used
if config["device"] == "cuda":
config["device"] = torch.device("cuda")
else:
config["device"] = torch.device("cpu")
for dataset in config["datasets"]:
config[dataset]["data_identifiers"] = config[dataset]["training_identifiers"] + config[dataset][
"testing_identifiers"]
# Convert angles to radians
for dataset in config["datasets"]:
config[dataset]["vertical_field_of_view"][0] *= (np.pi / 180.0)
config[dataset]["vertical_field_of_view"][1] *= (np.pi / 180.0)
config["horizontal_field_of_view"][0] *= (np.pi / 180.0)
config["horizontal_field_of_view"][1] *= (np.pi / 180.0)
print("----------------------------------")
print("Configuration for this run: ")
print(config)
print("----------------------------------")
return config
if __name__ == "__main__":
config = config()
converter = ros_utils.convert_to_rosbag.RosbagConverter(config=config)
converter.convert()