Skip to content

Commit

Permalink
allowed delta is 5%
Browse files Browse the repository at this point in the history
  • Loading branch information
OhadMeir committed Apr 19, 2023
1 parent e7ffdee commit eb19f75
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions unit-tests/live/frames/test-fps.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2022 Intel Corporation. All Rights Reserved.

# test:device D400*
# test:device L500*
# test:device each(D400*)
# test:donotrun:!nightly
# test:timeout 250
# timeout = (seconds_till_steady_state + seconds_to_count_frames) * tested_fps.size() * 2 + 10. (2 because depth + color, 10 spare)
Expand All @@ -22,8 +23,8 @@ def measure_fps(sensor, profile):
Wait a few seconds to be sure that frames are at steady state after start
Count number of received frames for seconds_to_count_frames seconds and compare actual fps to requested fps
"""
seconds_till_steady_state = 1
seconds_to_count_frames = 5
seconds_till_steady_state = 4
seconds_to_count_frames = 20

steady_state = False
first_frame_received = False
Expand Down Expand Up @@ -65,40 +66,41 @@ def frame_cb(frame):


delta_Hz = 1
tested_fps = [60]
tested_fps = [6, 15, 30, 60, 90]

dev = test.find_first_device_or_exit()
product_line = dev.get_info(rs.camera_info.product_line)

#####################################################################################################
# test.start("Testing depth fps " + product_line + " device - "+ platform.system() + " OS")

# for requested_fps in tested_fps:
# ds = dev.first_depth_sensor()
# #Set auto-exposure option as it might take precedence over requested FPS
# if product_line == "D400":
# ds.set_option(rs.option.enable_auto_exposure, 1)

# try:
# dp = next(p for p in ds.profiles
# if p.fps() == requested_fps
# and p.stream_type() == rs.stream.depth
# and p.format() == rs.format.z16)
# except StopIteration:
# print("Requested fps: {:.1f} [Hz], not supported".format(requested_fps))
# else:
# fps = measure_fps(ds, dp)
# print("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds))
# test.check(fps <= (requested_fps + delta_Hz) and fps >= (requested_fps - delta_Hz))
# test.finish()
test.start("Testing depth fps " + product_line + " device - "+ platform.system() + " OS")

for requested_fps in tested_fps:
ds = dev.first_depth_sensor()
# Set auto-exposure option as it might take precedence over requested FPS
if product_line == "D400":
ds.set_option(rs.option.enable_auto_exposure, 1)

try:
dp = next(p for p in ds.profiles
if p.fps() == requested_fps
and p.stream_type() == rs.stream.depth
and p.format() == rs.format.z16)
except StopIteration:
print("Requested fps: {:.1f} [Hz], not supported".format(requested_fps))
else:
fps = measure_fps(ds, dp)
print("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds))
delta_Hz = requested_fps * 0.05 # Validation KPI is 5%
test.check(fps <= (requested_fps + delta_Hz) and fps >= (requested_fps - delta_Hz))
test.finish()


#####################################################################################################
test.start("Testing color fps " + product_line + " device - "+ platform.system() + " OS")

for requested_fps in tested_fps:
cs = dev.first_color_sensor()
#Set auto-exposure option as it might take precedence over requested FPS
# Set auto-exposure option as it might take precedence over requested FPS
if product_line == "D400":
cs.set_option(rs.option.enable_auto_exposure, 1)
cs.set_option(rs.option.auto_exposure_priority, 0) # AE priority should be 0 for constant FPS
Expand All @@ -115,6 +117,7 @@ def frame_cb(frame):
else:
fps = measure_fps(cs, cp)
print("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds))
delta_Hz = requested_fps * 0.05 # Validation KPI is 5%
test.check(fps <= (requested_fps + delta_Hz) and fps >= (requested_fps - delta_Hz))

test.finish()
Expand Down

0 comments on commit eb19f75

Please sign in to comment.