Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix zero depth for SR300 + add UT for depth units from metadata #9497

Merged
merged 7 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/buildsCI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ jobs:
continue-on-error: true
run: |
export LRS_LOG_LEVEL="DEBUG";
cd build
cd build
./unit-tests/live-test -d yes -i [software-device]
for i in ./records/single_cam/*; do ./unit-tests/live-test -d yes -i ~[multicam] from "$i"; done
for i in ./records/multi_cam/*; do ./unit-tests/live-test -d yes -i [multicam] from "$i"; done
# for i in ./records/single_cam/*; do ./unit-tests/live-test -d yes -i ~[multicam] from "$i"; done
# for i in ./records/multi_cam/*; do ./unit-tests/live-test -d yes -i [multicam] from "$i"; done


- name: Upload RS log artifact
Expand Down
16 changes: 16 additions & 0 deletions src/ivcam/sr300.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,22 @@ namespace librealsense
return std::make_shared<timestamp_composite_matcher>(matchers);
}

void sr3xx_camera::sr300_depth_sensor::open(const stream_profiles& requests)
{
auto depth_units = get_option( RS2_OPTION_DEPTH_UNITS ).query();
set_frame_metadata_modifier( [&, depth_units]( frame_additional_data & data ) { data.depth_units = depth_units; } );
synthetic_sensor::open( requests );
}

void sr3xx_camera::sr300_depth_sensor::set_frame_metadata_modifier( on_frame_md callback )
{
_metadata_modifier = callback;
auto s = get_raw_sensor().get();
auto uvc = As< librealsense::uvc_sensor >( s );
if( uvc )
uvc->set_frame_metadata_modifier( callback );
}

processing_blocks sr300_camera::sr300_depth_sensor::get_sr300_depth_recommended_proccesing_blocks()
{
auto res = get_depth_recommended_proccesing_blocks();
Expand Down
4 changes: 4 additions & 0 deletions src/ivcam/sr300.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ namespace librealsense
: synthetic_sensor("Coded-Light Depth Sensor", uvc_sensor, owner, sr300_depth_fourcc_to_rs2_format, sr300_depth_fourcc_to_rs2_stream), _owner(owner)
{}

void open(const stream_profiles& requests) override;

void set_frame_metadata_modifier(on_frame_md callback) override;

rs2_intrinsics get_intrinsics(const stream_profile& profile) const override
{
return make_depth_intrinsics(*_owner->_camer_calib_params, { int(profile.width), int(profile.height) });
Expand Down
42 changes: 42 additions & 0 deletions unit-tests/live/metadata/test-depth-unit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.

#test:device L500*
#test:device D400*
#test:device SR300*

import pyrealsense2 as rs
from rspy import test

#############################################################################################
# get metadata depth units value and make sure it's non zero and equal to the depth sensor matching option value
test.start("checking depth units on metadata")

dev = test.find_first_device_or_exit()
depth_sensor = dev.first_depth_sensor()

try:
cfg = pipeline = None
pipeline = rs.pipeline()
cfg = rs.config()
pipeline_profile = pipeline.start(cfg)

# Check that depth units on meta data is non zero
frame_set = pipeline.wait_for_frames()
depth_frame = frame_set.get_depth_frame()
depth_units_from_metadata = depth_frame.get_units()
test.check(depth_units_from_metadata > 0)

# Check metadata depth unit value match option value
dev = pipeline_profile.get_device()
ds = dev.first_depth_sensor()
test.check(ds.supports(rs.option.depth_units))
test.check_equal(ds.get_option(rs.option.depth_units), depth_units_from_metadata)

pipeline.stop()

except Exception:
test.unexpected_exception()

test.finish()
test.print_results_and_exit()