Skip to content

Commit

Permalink
add emitter frequency option skelton
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed Oct 2, 2022
1 parent 9776a8e commit 014ca23
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 4 deletions.
10 changes: 10 additions & 0 deletions include/librealsense2/h/rs_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/realsense.def
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 18 additions & 2 deletions src/to-string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ); }
1 change: 1 addition & 0 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)


////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion wrappers/matlab/option.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
transmitter_frequency (88)
vertical_binning (89)
receiver_sensitivity (90)
count (91)
emitter_frequency (93)
count (94)
end
end
1 change: 1 addition & 0 deletions wrappers/nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
5 changes: 5 additions & 0 deletions wrappers/nodejs/src/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4856,6 +4856,7 @@ void InitModule(v8::Local<v8::Object> 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
Expand Down Expand Up @@ -5047,6 +5048,10 @@ void InitModule(v8::Local<v8::Object> 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)
Expand Down
1 change: 1 addition & 0 deletions wrappers/python/pybackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_<platform::power_state> power_state(m, "power_state");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 014ca23

Please sign in to comment.