-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# License: Apache 2.0. See LICENSE file in root directory. | ||
# Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
|
||
# test:device D400* | ||
# This test checks streaming y16 profile | ||
|
||
import time | ||
import pyrealsense2 as rs | ||
from rspy import test, log | ||
from rspy.timer import Timer | ||
|
||
|
||
y16_streamed = False | ||
|
||
|
||
def close_resources(sensor): | ||
""" | ||
Stop and Close sensor. | ||
:sensor: sensor of device | ||
""" | ||
if len(sensor.get_active_streams()) > 0: | ||
sensor.stop() | ||
sensor.close() | ||
|
||
|
||
def frame_callback(frame): | ||
global y16_streamed | ||
y16_streamed = True | ||
|
||
|
||
timer = Timer(5) | ||
|
||
device = test.find_first_device_or_exit() | ||
depth_sensor = device.first_depth_sensor() | ||
|
||
test.start('Check that y16 is streaming:') | ||
|
||
profile_y16 = next(p for p in depth_sensor.profiles if p.format() == rs.format.y16) | ||
test.check(profile_y16) | ||
log.d(str(profile_y16)) | ||
|
||
if profile_y16: | ||
depth_sensor.open(profile_y16) | ||
depth_sensor.start(frame_callback) | ||
|
||
timer.start() | ||
while not timer.has_expired(): | ||
if y16_streamed: | ||
break | ||
time.sleep(0.1) | ||
|
||
test.check(not timer.has_expired()) | ||
|
||
|
||
close_resources(depth_sensor) | ||
test.finish() | ||
test.print_results_and_exit() |
This file was deleted.
Oops, something went wrong.