6 import pyrealsense2
as rs
17 MAX_TIME_TO_WAIT_FOR_FRAMES = 10
18 NUMBER_OF_FRAMES_BEFORE_CHECK = 50
20 devices = test.find_devices_by_product_line_or_exit(rs.product_line.L500)
22 depth_sensor = device.first_depth_sensor()
24 dp =
next(p
for p
in depth_sensor.profiles
if p.stream_type() == rs.stream.depth
26 irp =
next(p
for p
in depth_sensor.profiles
if p.stream_type() == rs.stream.infrared
34 if frame.get_profile().stream_type() == rs.stream.depth:
37 elif frame.get_profile().stream_type() == rs.stream.infrared:
41 wait_frames_timer =
Timer(MAX_TIME_TO_WAIT_FOR_FRAMES)
44 test.start(
"Ask for depth only - make sure only depth frames arrive")
47 depth_sensor.start(frames_counter)
48 wait_frames_timer.start()
51 while (
not wait_frames_timer.has_expired()
52 and n_depth_frame + n_ir_frame < NUMBER_OF_FRAMES_BEFORE_CHECK):
55 if wait_frames_timer.has_expired():
56 print(
str(NUMBER_OF_FRAMES_BEFORE_CHECK) +
" frames did not arrived at "+
str(MAX_TIME_TO_WAIT_FOR_FRAMES) +
" seconds , abort...")
59 test.check(n_depth_frame >= NUMBER_OF_FRAMES_BEFORE_CHECK)
60 test.check_equal(n_ir_frame, 0)
73 test.start(
"Ask for depth+IR - make sure both frames arrive")
75 depth_sensor.open([dp, irp])
76 depth_sensor.start(frames_counter)
77 wait_frames_timer.start()
80 while (
not wait_frames_timer.has_expired()
81 and (n_depth_frame == 0
or n_ir_frame == 0)):
84 if wait_frames_timer.has_expired():
85 print(
str(NUMBER_OF_FRAMES_BEFORE_CHECK) +
" frames did not arrived at "+
str(MAX_TIME_TO_WAIT_FOR_FRAMES) +
" seconds , abort...")
88 test.check(n_depth_frame != 0)
89 test.check(n_ir_frame != 0)
96 test.print_results_and_exit()
def frames_counter(frame)
static std::string print(const transformation &tf)
virtual frame finish(frame f)
void next(auto_any_t cur, type2type< T, C > *)