Skip to content

Commit

Permalink
update unit-tests; add option-value test
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Feb 11, 2024
1 parent aae16d8 commit 7d75b55
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 175 deletions.
67 changes: 31 additions & 36 deletions unit-tests/dds/d405.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2023 Intel Corporation. All Rights Reserved.
# Copyright(c) 2024 Intel Corporation. All Rights Reserved.

import pyrealdds as dds
from rspy import log, test
Expand Down Expand Up @@ -204,67 +204,62 @@ def color_stream():
def stereo_module_options():
options = []

option = dds.option( "Backlight Compensation", dds.option_range( 0, 1, 1, 0 ), "Enable / disable backlight compensation" )
option = dds.option.from_json( ["Backlight Compensation", 0, 0, 1, 1, 0, "Enable / disable backlight compensation"] )
options.append( option )
option = dds.option( "Brightness", dds.option_range( -64, 64, 1, 0 ), "UVC image brightness" )
option = dds.option.from_json( ["Brightness", 0, -64, 64, 1, 0, "UVC image brightness"] )
options.append( option )
option = dds.option( "Contrast", dds.option_range( 0, 100, 1, 50 ), "UVC image contrast" )
option = dds.option.from_json( ["Contrast", 50, 0, 100, 1, 50, "UVC image contrast"] )
options.append( option )
option = dds.option( "Exposure", dds.option_range( 1, 165000, 1, 33000 ), "Depth Exposure (usec)" )
option = dds.option.from_json( ["Exposure", 33000, 1, 165000, 1, 33000, "Depth Exposure (usec)"] )
options.append( option )
option = dds.option( "Gain", dds.option_range( 16, 248, 1, 16 ), "UVC image gain" )
option = dds.option.from_json( ["Gain", 16, 16, 248, 1, 16, "UVC image gain"] )
options.append( option )
option = dds.option( "Gamma", dds.option_range( 100, 500, 1, 300 ), "UVC image gamma setting" )
option = dds.option.from_json( ["Gamma", 300, 100, 500, 1, 300, "UVC image gamma setting"] )
options.append( option )
option = dds.option( "Hue", dds.option_range( -180, 180, 1, 0 ), "UVC image hue" )
option = dds.option.from_json( ["Hue", 0, -180, 180, 1, 0, "UVC image hue"] )
options.append( option )
option = dds.option( "Saturation", dds.option_range( 0, 100, 1, 64 ), "UVC image saturation setting" )
option = dds.option.from_json( ["Saturation", 64, 0, 100, 1, 64, "UVC image saturation setting"] )
options.append( option )
option = dds.option( "Sharpness", dds.option_range( 0, 100, 1, 50 ), "UVC image sharpness setting" )
option = dds.option.from_json( ["Sharpness", 50, 0, 100, 1, 50, "UVC image sharpness setting"] )
options.append( option )
option = dds.option( "White Balance", dds.option_range( 2800, 6500, 10, 4600 ),
"Controls white balance of color image. Setting any value will disable auto white balance" )
option = dds.option.from_json( ["White Balance", 4600, 2800, 6500, 10, 4600,
"Controls white balance of color image. Setting any value will disable auto white balance"] )
options.append( option )
option = dds.option( "Enable Auto Exposure", dds.option_range( 0, 1, 1, 1 ), "Enable Auto Exposure" )
option = dds.option.from_json( ["Enable Auto Exposure", 1, 0, 1, 1, 1, "Enable Auto Exposure"] )
options.append( option )
option = dds.option( "Enable Auto White Balance", dds.option_range( 0, 1, 1, 1 ), "Enable / disable auto-white-balance" )
option = dds.option.from_json( ["Enable Auto White Balance", 1, 0, 1, 1, 1, "Enable / disable auto-white-balance"] )
options.append( option )
option = dds.option( "Visual Preset", dds.option_range( 0, 5, 1, 0 ), "Advanced-Mode Preset" )
option = dds.option.from_json( ["Visual Preset", 0, 0, 5, 1, 0, "Advanced-Mode Preset"] )
options.append( option )
option = dds.option( "Power Line Frequency", dds.option_range( 0, 3, 1, 3 ), "Power Line Frequency" )
option = dds.option.from_json( ["Power Line Frequency", 3, 0, 3, 1, 3, "Power Line Frequency"] )
options.append( option )
option = dds.option( "Error Polling Enabled", dds.option_range( 0, 1, 1, 0 ), "Enable / disable polling of camera internal errors" )
option.set_value( 1 )
option = dds.option.from_json( ["Error Polling Enabled", 1, 0, 1, 1, 0, "Enable / disable polling of camera internal errors"] )
options.append( option )
option = dds.option( "Output Trigger Enabled", dds.option_range( 0, 1, 1, 0 ), "Generate trigger from the camera to external device once per frame" )
option = dds.option.from_json( ["Output Trigger Enabled", 0, 0, 1, 1, 0, "Generate trigger from the camera to external device once per frame"] )
options.append( option )
option = dds.option( "Depth Units", dds.option_range( 1e-06, 0.01, 1e-06, 0.001 ), "Number of meters represented by a single depth unit" )
option.set_value( 0.0001 )
option = dds.option.from_json( ["Depth Units", 0.0001, 1e-06, 0.01, 1e-06, 0.001, "Number of meters represented by a single depth unit"] )
options.append( option )
option = dds.option( "Stereo Baseline", dds.option_range( 17.9998, 17.9998, 0, 17.9998 ), "Distance in mm between the stereo imagers" )
option = dds.option.from_json( ["Stereo Baseline", 17.9998, 17.9998, 17.9998, 0, 17.9998, "Distance in mm between the stereo imagers"] )
options.append( option )
option = dds.option( "Global Time Enabled", dds.option_range( 0, 1, 1, 1 ), "Enable/Disable global timestamp" )
option = dds.option.from_json( ["Global Time Enabled", 1, 0, 1, 1, 1, "Enable/Disable global timestamp"] )
options.append( option )
option = dds.option( "Hdr Enabled", dds.option_range( 0, 1, 1, 0 ), "HDR Option" )
option = dds.option.from_json( ["Hdr Enabled", 0, 0, 1, 1, 0, "HDR Option"] )
options.append( option )
option = dds.option( "Sequence Name", dds.option_range( 0, 3, 1, 1 ), "HDR Option" )
option.set_value( 0 )
option = dds.option.from_json( ["Sequence Name", 0, 0, 3, 1, 1, "HDR Option"] )
options.append( option )
option = dds.option( "Sequence Size", dds.option_range( 2, 2, 1, 2 ), "HDR Option" )
option = dds.option.from_json( ["Sequence Size", 2, 2, 2, 1, 2, "HDR Option"] )
options.append( option )
option = dds.option( "Sequence Id", dds.option_range( 0, 2, 1, 0 ), "HDR Option" )
option = dds.option.from_json( ["Sequence Id", 0, 0, 2, 1, 0, "HDR Option"] )
options.append( option )
option = dds.option( "Auto Exposure Limit", dds.option_range( 1, 165000, 1, 33000 ),
"Exposure limit is in microseconds. If the requested exposure limit is greater than frame time, it will be set to frame time at runtime. Setting will not take effect until next streaming session." )
option.set_value( 165000 )
option = dds.option.from_json( ["Auto Exposure Limit", 165000, 1, 165000, 1, 33000,
"Exposure limit is in microseconds. If the requested exposure limit is greater than frame time, it will be set to frame time at runtime. Setting will not take effect until next streaming session."] )
options.append( option )
option = dds.option( "Auto Gain Limit", dds.option_range( 16, 248, 1, 16 ),
"Gain limits ranges from 16 to 248. If the requested gain limit is less than 16, it will be set to 16. If the requested gain limit is greater than 248, it will be set to 248. Setting will not take effect until next streaming session." )
option.set_value( 248 )
option = dds.option.from_json( ["Auto Gain Limit", 248, 16, 248, 1, 16,
"Gain limits ranges from 16 to 248. If the requested gain limit is less than 16, it will be set to 16. If the requested gain limit is greater than 248, it will be set to 248. Setting will not take effect until next streaming session."] )
options.append( option )
option = dds.option( "Auto Exposure Limit Toggle", dds.option_range( 0, 1, 1, 0 ), "Toggle Auto-Exposure Limit" )
option = dds.option.from_json( ["Auto Exposure Limit Toggle", 0, 0, 1, 1, 0, "Toggle Auto-Exposure Limit"] )
options.append( option )
option = dds.option( "Auto Gain Limit Toggle", dds.option_range( 0, 1, 1, 0 ), "Toggle Auto-Gain Limit" )
option = dds.option.from_json( ["Auto Gain Limit Toggle", 0, 0, 1, 1, 0, "Toggle Auto-Gain Limit"] )
options.append( option )

return options
Expand Down
Loading

0 comments on commit 7d75b55

Please sign in to comment.