6 import pyrealsense2
as rs
7 from rspy
import test, ac
9 test.set_env_vars({
"RS2_AC_DISABLE_CONDITIONS":
"1",
10 "RS2_AC_DISABLE_RETRIES":
"1",
11 "RS2_AC_FORCE_BAD_RESULT":
"1",
12 "RS2_AC_LOG_TO_STDOUT":
"1" 17 dev = test.find_first_device_or_exit()
18 depth_sensor = dev.first_depth_sensor()
19 color_sensor = dev.first_color_sensor()
22 dcs = rs.calibrated_sensor(depth_sensor)
24 ccs = rs.calibrated_sensor(color_sensor)
26 d2r = rs.device_calibration(dev)
27 d2r.register_calibration_change_callback( ac.status_list_callback )
29 cp =
next(p
for p
in color_sensor.profiles
if p.fps() == 30
30 and p.stream_type() == rs.stream.color
31 and p.format() == rs.format.yuyv
32 and p.as_video_stream_profile().width() == 1280
33 and p.as_video_stream_profile().height() == 720)
36 depth_sensor.profiles
if p.fps() == 30
37 and p.stream_type() == rs.stream.depth
38 and p.format() == rs.format.z16
39 and p.as_video_stream_profile().width() == 1024
40 and p.as_video_stream_profile().height() == 768)
45 previous_color_frame_number = -1
46 previous_depth_frame_number = -1
50 global previous_color_frame_number
51 test.check_frame_drops(frame, previous_color_frame_number)
52 previous_color_frame_number = frame.get_frame_number()
55 global previous_depth_frame_number
56 test.check_frame_drops(frame, previous_depth_frame_number)
57 previous_depth_frame_number = frame.get_frame_number()
59 depth_sensor.open( dp )
60 depth_sensor.start( depth_frame_call_back )
61 color_sensor.open( cp )
62 color_sensor.start( color_frame_call_back )
66 test.start(
"Checking for frame drops in", n_cal,
"calibrations")
67 for i
in range(n_cal):
69 dcs.reset_calibration()
70 ccs.reset_calibration()
71 d2r.trigger_device_calibration( rs.calibration_type.manual_depth_to_rgb )
72 ac.wait_for_calibration()
74 test.unexpected_exception()
79 test.start(
"Checking for frame drops in a failed calibration")
80 ac.reset_status_list()
82 d2r.trigger_device_calibration( rs.calibration_type.manual_depth_to_rgb )
84 d2r.trigger_device_calibration( rs.calibration_type.manual_depth_to_rgb )
85 ac.wait_for_calibration()
86 except Exception
as e:
87 test.check_exception(e, RuntimeError,
"Camera Accuracy Health is already active")
89 test.unexpected_exception()
90 ac.wait_for_calibration()
92 test.unexpected_exception()
102 test.print_results_and_exit()
def depth_frame_call_back(frame)
def color_frame_call_back(frame)
virtual frame finish(frame f)
void next(auto_any_t cur, type2type< T, C > *)