From 014ca23de56a15be4225537a993703334cc6a0a6 Mon Sep 17 00:00:00 2001 From: Nir-Az Date: Mon, 19 Sep 2022 16:55:04 +0300 Subject: [PATCH] add emitter frequency option skelton --- include/librealsense2/h/rs_option.h | 10 ++++++++++ src/realsense.def | 1 + src/to-string.cpp | 20 +++++++++++++++++-- src/types.h | 1 + .../intel/realsense/librealsense/Option.java | 4 +++- wrappers/matlab/option.m | 3 ++- wrappers/nodejs/index.js | 1 + wrappers/nodejs/src/addon.cpp | 5 +++++ wrappers/python/pybackend.cpp | 1 + .../Source/RealSense/Public/RealSenseTypes.h | 1 + 10 files changed, 43 insertions(+), 4 deletions(-) diff --git a/include/librealsense2/h/rs_option.h b/include/librealsense2/h/rs_option.h index e88b257455..ffe8bf1704 100644 --- a/include/librealsense2/h/rs_option.h +++ b/include/librealsense2/h/rs_option.h @@ -115,6 +115,7 @@ extern "C" { RS2_OPTION_RECEIVER_SENSITIVITY, /**< Control receiver sensitivity to incoming light, both projected and ambient (same as APD on L515). */ RS2_OPTION_AUTO_EXPOSURE_LIMIT_TOGGLE, /**< Enable / disable color image auto-exposure*/ RS2_OPTION_AUTO_GAIN_LIMIT_TOGGLE, /**< Enable / disable color image auto-gain*/ + RS2_OPTION_EMITTER_FREQUENCY, /**< Select emitter (laser) frequency, see rs2_emitter_frequency for values */ RS2_OPTION_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */ } rs2_option; @@ -204,6 +205,15 @@ extern "C" { } rs2_host_perf_mode; const char* rs2_host_perf_mode_to_string( rs2_host_perf_mode perf ); + /** \brief values for RS2_EMITTER_FREQUENCY option. */ + typedef enum rs2_emitter_frequency_mode + { + RS2_EMITTER_FREQUENCY_57_KHZ = 0, /**< Emitter frequency shall be 57 [KHZ] */ + RS2_EMITTER_FREQUENCY_91_KHZ = 1, /**< Emitter frequency shall be 91 [KHZ] */ + RS2_EMITTER_FREQUENCY_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */ + } rs2_emitter_frequency_mode; + const char* rs2_emitter_frequency_mode_to_string( rs2_emitter_frequency_mode mode ); + /** * check if an option is read-only * \param[in] options the options container diff --git a/src/realsense.def b/src/realsense.def index 3819780f0c..d976362ce9 100644 --- a/src/realsense.def +++ b/src/realsense.def @@ -254,6 +254,7 @@ EXPORTS rs2_toggle_advanced_mode rs2_load_json rs2_serialize_json + rs2_emitter_frequency_mode_to_string rs2_create_record_device rs2_create_record_device_ex diff --git a/src/to-string.cpp b/src/to-string.cpp index 9a2e3c43d4..1740b7bc8c 100644 --- a/src/to-string.cpp +++ b/src/to-string.cpp @@ -171,6 +171,20 @@ const char * get_string( rs2_host_perf_mode value ) #undef CASE } +const char * get_string( rs2_emitter_frequency_mode mode ) +{ +#define CASE( X ) STRCASE( EMITTER_FREQUENCY, X ) + switch( mode ) + { + CASE( 57_KHZ ) + CASE( 91_KHZ ) + default: + assert( ! is_valid( mode ) ); + return UNKNOWN_VALUE; + } +#undef CASE +} + const char * get_string( rs2_extension value ) { #define CASE( X ) STRCASE( EXTENSION, X ) @@ -370,8 +384,9 @@ const char * get_string( rs2_option value ) CASE( TRANSMITTER_FREQUENCY ) CASE( VERTICAL_BINNING ) CASE( RECEIVER_SENSITIVITY ) - CASE(AUTO_EXPOSURE_LIMIT_TOGGLE) - CASE(AUTO_GAIN_LIMIT_TOGGLE) + CASE( AUTO_EXPOSURE_LIMIT_TOGGLE ) + CASE( AUTO_GAIN_LIMIT_TOGGLE ) + CASE( EMITTER_FREQUENCY ) default: assert( ! is_valid( value ) ); return UNKNOWN_VALUE; @@ -641,3 +656,4 @@ const char * rs2_cah_trigger_to_string( int mode ) { return "DEPRECATED as of 2. const char * rs2_calibration_type_to_string( rs2_calibration_type type ) { return librealsense::get_string( type ); } const char * rs2_calibration_status_to_string( rs2_calibration_status status ) { return librealsense::get_string( status ); } const char * rs2_host_perf_mode_to_string( rs2_host_perf_mode mode ) { return librealsense::get_string( mode ); } +const char * rs2_emitter_frequency_mode_to_string( rs2_emitter_frequency_mode mode ) { return librealsense::get_string( mode ); } diff --git a/src/types.h b/src/types.h index f22ede481a..c027fd0bf3 100644 --- a/src/types.h +++ b/src/types.h @@ -398,6 +398,7 @@ namespace librealsense RS2_ENUM_HELPERS_CUSTOMIZED(rs2_ambient_light, RS2_AMBIENT_LIGHT_NO_AMBIENT, RS2_AMBIENT_LIGHT_LOW_AMBIENT) RS2_ENUM_HELPERS_CUSTOMIZED(rs2_digital_gain, RS2_DIGITAL_GAIN_HIGH, RS2_DIGITAL_GAIN_LOW) RS2_ENUM_HELPERS(rs2_host_perf_mode, HOST_PERF) + RS2_ENUM_HELPERS(rs2_emitter_frequency_mode, EMITTER_FREQUENCY) //////////////////////////////////////////// diff --git a/wrappers/android/librealsense/src/main/java/com/intel/realsense/librealsense/Option.java b/wrappers/android/librealsense/src/main/java/com/intel/realsense/librealsense/Option.java index 28c25c2f15..9d41cb7001 100644 --- a/wrappers/android/librealsense/src/main/java/com/intel/realsense/librealsense/Option.java +++ b/wrappers/android/librealsense/src/main/java/com/intel/realsense/librealsense/Option.java @@ -94,7 +94,9 @@ public enum Option { OPTION_VERTICAL_BINNING(89), OPTION_RECEIVER_SENSITIVITY(90), OPTION_AUTO_EXPOSURE_LIMIT_TOGGLE(91), - OPTION_AUTO_GAIN_LIMIT_TOGGLE(92); + OPTION_AUTO_GAIN_LIMIT_TOGGLE(92), + OPTION_EMITTER_FREQUENCY(93); + private final int mValue; diff --git a/wrappers/matlab/option.m b/wrappers/matlab/option.m index 06141b5375..efd06e1e3b 100644 --- a/wrappers/matlab/option.m +++ b/wrappers/matlab/option.m @@ -92,6 +92,7 @@ transmitter_frequency (88) vertical_binning (89) receiver_sensitivity (90) - count (91) + emitter_frequency (93) + count (94) end end diff --git a/wrappers/nodejs/index.js b/wrappers/nodejs/index.js index a8b3c22acf..3260e4e802 100644 --- a/wrappers/nodejs/index.js +++ b/wrappers/nodejs/index.js @@ -5016,6 +5016,7 @@ const option = { OPTION_ALTERNATE_IR: RS2.RS2_OPTION_ALTERNATE_IR, OPTION_NOISE_ESTIMATION: RS2.RS2_OPTION_NOISE_ESTIMATION, OPTION_ENABLE_IR_REFLECTIVITY: RS2.RS2_OPTION_ENABLE_IR_REFLECTIVITY, + OPTION_EMITTER_FREQUENCY: RS2.RS2_OPTION_EMITTER_FREQUENCY, /** * Set or get auto exposure limit in microsecond. * @type {Integer} diff --git a/wrappers/nodejs/src/addon.cpp b/wrappers/nodejs/src/addon.cpp index 78b698a138..22334ef372 100644 --- a/wrappers/nodejs/src/addon.cpp +++ b/wrappers/nodejs/src/addon.cpp @@ -4856,6 +4856,7 @@ void InitModule(v8::Local exports) { _FORCE_SET_ENUM(RS2_OPTION_RECEIVER_SENSITIVITY); _FORCE_SET_ENUM(RS2_OPTION_AUTO_EXPOSURE_LIMIT_TOGGLE); _FORCE_SET_ENUM(RS2_OPTION_AUTO_GAIN_LIMIT_TOGGLE); + _FORCE_SET_ENUM(RS2_OPTION_EMITTER_FREQUENCY); _FORCE_SET_ENUM(RS2_OPTION_COUNT); // rs2_camera_info @@ -5047,6 +5048,10 @@ void InitModule(v8::Local exports) { _FORCE_SET_ENUM(RS2_HOST_PERF_HIGH) _FORCE_SET_ENUM(RS2_HOST_PERF_COUNT) + // rs2_emitter_frequency + _FORCE_SET_ENUM(RS2_EMITTER_FREQUENCY_57_KHZ) + _FORCE_SET_ENUM(RS2_EMITTER_FREQUENCY_91_KHZ) + _FORCE_SET_ENUM(RS2_EMITTER_FREQUENCY_COUNT) // rs2_l500_visual_preset _FORCE_SET_ENUM(RS2_L500_VISUAL_PRESET_CUSTOM) diff --git a/wrappers/python/pybackend.cpp b/wrappers/python/pybackend.cpp index 551482b3f4..c4d822d3b4 100644 --- a/wrappers/python/pybackend.cpp +++ b/wrappers/python/pybackend.cpp @@ -191,6 +191,7 @@ PYBIND11_MODULE(NAME, m) { .value("receiver sensitivity", RS2_OPTION_RECEIVER_SENSITIVITY) .value("exposure limit toggle", RS2_OPTION_AUTO_EXPOSURE_LIMIT_TOGGLE) .value("gain limit toggle", RS2_OPTION_AUTO_GAIN_LIMIT_TOGGLE) + .value("emitter frequency", RS2_OPTION_EMITTER_FREQUENCY) .value("count", RS2_OPTION_COUNT); py::enum_ power_state(m, "power_state"); diff --git a/wrappers/unrealengine4/Plugins/RealSense/Source/RealSense/Public/RealSenseTypes.h b/wrappers/unrealengine4/Plugins/RealSense/Source/RealSense/Public/RealSenseTypes.h index 9a36d140c5..a480216ae5 100755 --- a/wrappers/unrealengine4/Plugins/RealSense/Source/RealSense/Public/RealSenseTypes.h +++ b/wrappers/unrealengine4/Plugins/RealSense/Source/RealSense/Public/RealSenseTypes.h @@ -145,6 +145,7 @@ enum class ERealSenseOptionType : uint8 TRANSMITTER_FREQUENCY , /**< Change transmitter frequency, increasing effective range over sharpness. */ VERTICAL_BINNING , /**< Enables vertical binning which increases the maximal sensed distance. */ RECEIVER_SENSITIVITY , /**< Control the receiver sensitivity to incoming light, both projected and ambient. */ + EMITTER_FREQUENCY , /**< Select emitter (laser) frequency: 0 --> 57[KHZ], 1 --> 97[KHZ] */ }; UENUM(Blueprintable)