7 test.set_env_vars({
"RS2_AC_DISABLE_CONDITIONS":
"1",
8 "RS2_AC_DISABLE_RETRIES":
"1",
9 "RS2_AC_FORCE_BAD_RESULT":
"1",
10 "RS2_AC_LOG_TO_STDOUT":
"1" 14 import pyrealsense2
as rs
19 dev = test.find_first_device_or_exit()
20 depth_sensor = dev.first_depth_sensor()
21 color_sensor = dev.first_color_sensor()
24 dcs = rs.calibrated_sensor(depth_sensor)
25 dcs.reset_calibration()
27 ccs = rs.calibrated_sensor(color_sensor)
28 ccs.reset_calibration()
30 d2r = rs.device_calibration(dev)
31 d2r.register_calibration_change_callback( ac.status_list_callback )
33 cp =
next(p
for p
in color_sensor.profiles
if p.fps() == 30
34 and p.stream_type() == rs.stream.color
35 and p.format() == rs.format.yuyv
36 and p.as_video_stream_profile().width() == 1280
37 and p.as_video_stream_profile().height() == 720)
40 depth_sensor.profiles
if p.fps() == 30
41 and p.stream_type() == rs.stream.depth
42 and p.format() == rs.format.z16
43 and p.as_video_stream_profile().width() == 1024
44 and p.as_video_stream_profile().height() == 768)
47 successful_calibration_status_list = [rs.calibration_status.triggered,
48 rs.calibration_status.special_frame,
49 rs.calibration_status.started,
50 rs.calibration_status.successful]
53 irrelevant_statuses = [rs.calibration_status.retry,
54 rs.calibration_status.scene_invalid,
55 rs.calibration_status.bad_result]
59 Removes consecutive special frame statuses from the status list since we have a built-in 60 retry mechanism and more than one request can be made. 61 E.g., [triggered, special_frame, special_frame, started, successful] 65 if list[i - 1] == list[i] == rs.calibration_status.special_frame:
72 test.start(
"Depth sensor is off, should get an error")
74 d2r.trigger_device_calibration( rs.calibration_type.manual_depth_to_rgb )
75 ac.wait_for_calibration()
76 except Exception
as e:
77 test.check_exception(e, RuntimeError,
"not streaming")
79 test.unexpected_exception()
80 test.check(ac.status_list_is_empty())
85 test.start(
"Color sensor is off, calibration should succeed")
86 ac.reset_status_list()
87 depth_sensor.open( dp )
88 depth_sensor.start(
lambda f:
None )
90 d2r.trigger_device_calibration( rs.calibration_type.manual_depth_to_rgb )
91 ac.wait_for_calibration()
92 ac.trim_irrelevant_statuses(irrelevant_statuses)
94 test.check_equal_lists(ac.status_list, successful_calibration_status_list)
96 test.unexpected_exception()
101 except Exception
as e:
102 test.check_exception(e, RuntimeError,
"tried to stop sensor without starting it")
104 test.unexpected_exception()
110 test.start(
"Color sensor is on")
111 ac.reset_status_list()
112 dcs.reset_calibration()
113 ccs.reset_calibration()
114 color_sensor.open( cp )
115 color_sensor.start(
lambda f:
None )
117 d2r.trigger_device_calibration( rs.calibration_type.manual_depth_to_rgb )
118 ac.wait_for_calibration()
119 ac.trim_irrelevant_statuses(irrelevant_statuses)
121 test.check_equal_lists(ac.status_list, successful_calibration_status_list)
123 test.unexpected_exception()
128 test.unexpected_exception()
134 test.start(
"2 AC triggers in a row")
135 ac.reset_status_list()
136 dcs.reset_calibration()
137 ccs.reset_calibration()
138 color_sensor.start(
lambda f:
None )
140 d2r.trigger_device_calibration( rs.calibration_type.manual_depth_to_rgb )
142 d2r.trigger_device_calibration( rs.calibration_type.manual_depth_to_rgb )
143 ac.wait_for_calibration()
144 except Exception
as e:
145 test.check_exception(e, RuntimeError,
"Camera Accuracy Health is already active")
147 test.unexpected_exception()
148 ac.wait_for_calibration()
149 ac.trim_irrelevant_statuses(irrelevant_statuses)
151 test.check_equal_lists(ac.status_list, successful_calibration_status_list)
153 test.unexpected_exception()
161 test.print_results_and_exit()
def filter_special_frames(list)
virtual frame finish(frame f)
void next(auto_any_t cur, type2type< T, C > *)