9 import pyrealsense2
as rs
12 opts, args = getopt.getopt(argv,
"i:", [
"ifile="])
17 json_file = opts[0][1]
18 file_object = open(json_file)
19 jcnt = file_object.read()
28 pipeline = rs.pipeline()
32 pipeline_wrapper = rs.pipeline_wrapper(pipeline)
33 pipeline_profile = config.resolve(pipeline_wrapper)
34 device = pipeline_profile.get_device()
36 auto_calibrated_device = rs.auto_calibrated_device(device)
38 if not auto_calibrated_device:
39 print(
"The connected device does not support auto calibration")
43 config.enable_stream(rs.stream.depth, 256, 144, rs.format.z16, 90)
44 conf = pipeline.start(config)
45 calib_dev = rs.auto_calibrated_device(conf.get_device())
47 def on_chip_calib_cb(progress):
52 operation = input(
"Please select what the operation you want to do\nc - on chip calibration\nt - tare calibration\ng - get the active calibration\nw - write new calibration\ne - exit\n")
55 print(
"Starting on chip calibration")
56 new_calib, health = calib_dev.run_on_chip_calibration(file_cnt, on_chip_calib_cb, 5000)
57 print(
"Calibration completed")
58 print(
"health factor = ", health)
61 print(
"Starting tare calibration")
62 ground_truth = float(input(
"Please enter ground truth in mm\n"))
63 new_calib, health = calib_dev.run_tare_calibration(ground_truth, file_cnt, on_chip_calib_cb, 5000)
64 print(
"Calibration completed")
65 print(
"health factor = ", health)
68 calib = calib_dev.get_calibration_table()
69 print(
"Calibration", calib)
72 print(
"Writing the new calibration")
73 calib_dev.set_calibration_table(new_calib)
74 calib_dev.write_calibration()
81 except Exception
as e:
84 print(
"A different Error")
89 if __name__ ==
"__main__":
def read_parameters(argv)
static std::string print(const transformation &tf)