Go to the documentation of this file.
19 _preset_opt = std::make_shared<advanced_mode_preset_option>(*
this,
37 _color_sensor(nullptr)
42 return results[4] > 0;
52 for(
size_t i = 0;
i <
dev.get_sensors_count(); ++
i )
97 if (configuration.empty())
100 res =
get_res_type(configuration.front().width, configuration.front().height);
132 <<
"apply_preset(...) failed! Given device doesn't support Default Preset (pid=0x"
152 <<
"apply_preset(...) failed! Given device doesn't support Default Preset (pid=0x"
161 p.depth_table.depthUnits = 100;
175 throw invalid_value_exception(
"apply_preset(...) failed! The device does not support remove IR pattern feature" );
190 <<
"apply_preset(...) failed! Given device doesn't support Remove IR Pattern Preset (pid=0x"
191 << std::hex << device_pid <<
")" );
198 <<
"apply_preset(...) failed! Invalid preset! (" <<
preset <<
")" );
271 return sensor.supports_option(opt);
713 <<
"serialize_json() failed! Device is not in Advanced-Mode." );
723 <<
"load_json(...) failed! Device is not in Advanced-Mode." );
794 if (
p.laser_state.was_set &&
p.laser_state.laser_state == 1)
798 if (
p.depth_auto_exposure.was_set &&
p.depth_auto_exposure.auto_exposure == 0)
814 if (
p.color_auto_exposure.was_set &&
p.color_auto_exposure.auto_exposure == 0)
829 if (
p.color_auto_white_balance.was_set &&
p.color_auto_white_balance.auto_white_balance == 0)
848 throw std::runtime_error(
"Advanced mode write failed!");
855 return (c0 << 24) | (
c1 << 16) | (
c2 << 8) | c3;
860 if (results.size() <
sizeof(
uint32_t))
throw std::runtime_error(
"Incomplete operation result!");
861 auto opCodeAsUint32 =
pack(results[3], results[2], results[1], results[0]);
864 std::stringstream
ss;
865 ss <<
"Operation failed with error code=" <<
static_cast<int>(opCodeAsUint32);
866 throw std::runtime_error(
ss.str());
868 std::vector<uint8_t>
result;
870 std::copy(results.data() +
sizeof(
uint32_t),
871 results.data() + results.size(),
result.data());
880 std::vector<uint8_t>
data)
const
882 std::vector<uint8_t> raw_data;
885 const uint16_t pre_header_data = 0xcdab;
887 auto write_ptr = raw_data.data();
888 auto header_size = 4;
890 size_t cur_index = 2;
891 *
reinterpret_cast<uint16_t *
>(write_ptr + cur_index) = pre_header_data;
893 *
reinterpret_cast<unsigned int *
>(write_ptr + cur_index) = cmd_op_code;
894 cur_index +=
sizeof(
unsigned int);
897 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) =
p1;
898 cur_index +=
sizeof(unsigned);
899 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) =
p2;
900 cur_index +=
sizeof(unsigned);
901 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p3;
902 cur_index +=
sizeof(unsigned);
903 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p4;
904 cur_index +=
sizeof(unsigned);
907 std::copy(
data.begin(),
data.end(),
reinterpret_cast<uint8_t*
>(write_ptr + cur_index));
908 cur_index +=
data.size();
910 *
reinterpret_cast<uint16_t*
>(raw_data.data()) =
static_cast<uint16_t>(cur_index - header_size);
911 raw_data.resize(cur_index);
923 std::lock_guard<std::mutex>
lock(
_mtx);
937 std::lock_guard<std::mutex>
lock(
_mtx);
940 <<
"set(advanced_mode_preset_option) failed! Given value " <<
value
941 <<
" is out of range." );
946 <<
"set(advanced_mode_preset_option) failed! Device is not in Advanced-Mode." );
956 auto configurations = uvc_sen->get_configuration();
974 return "Advanced-Mode Preset";
982 catch (std::out_of_range)
986 <<
"advanced_mode_preset: get_value_description(...) failed! Description of value " <<
val
987 <<
" is not found." );
995 std::stringstream
ss;
996 ss << std::hex << str_pid;
void get_depth_gain(gain_control *ptr) const
void toggle_advanced_mode(bool enable) override
void set_auto_exposure(synthetic_sensor &sensor, const auto_exposure_control &val)
bool is_enabled() const override
virtual void unregister_option(rs2_option id)
int backlight_compensation
virtual const std::string & get_info(rs2_camera_info info) const =0
static const feature_id ID
void set_all_rgb(const preset &p)
device_interface & get_device() override
void get_color_contrast(contrast_control *ptr) const
bool is_enabled() const override
@ RS2_OPTION_ENABLE_AUTO_EXPOSURE
void set_rau_support_vector_control(const STRauSupportVectorControl &val) override
void set_ae_control(const STAEControl &val) override
std::shared_ptr< hw_monitor > _hw_monitor
@ RS2_RS400_VISUAL_PRESET_CUSTOM
synthetic_sensor & _depth_sensor
const std::shared_ptr< raw_sensor_base > & get_raw_sensor() const
void get_color_auto_exposure(auto_exposure_control *ptr) const
void get_depth_table_control(STDepthTableControl *ptr, int mode=0) const override
rsutils::lazy< bool > _enabled
void get_depth_auto_exposure(auto_exposure_control *ptr) const
const char * get_description() const override
void set_color_contrast(const contrast_control &val)
@ RS2_RS400_VISUAL_PRESET_HIGH_DENSITY
std::function< void(const option &)> _recording_function
void high_density(preset &p)
std::shared_ptr< advanced_mode_preset_option > _preset_opt
void default_400(preset &p)
std::string _block_message
void default_420(preset &p)
@ RS2_OPTION_BACKLIGHT_COMPENSATION
rs2_rs400_visual_preset _last_preset
void set_color_power_line_frequency(const power_line_frequency_control &val)
GLsizei const GLchar *const * string
void hand_gesture(preset &p)
void set_slo_color_thresholds_control(const STSloColorThresholdsControl &val) override
void get_rau_color_thresholds_control(STRauColorThresholdsControl *ptr, int mode=0) const override
rsutils::lazy< synthetic_sensor * > _color_sensor
void register_to_visual_preset_option()
void set_depth_table_control(const STDepthTableControl &val) override
void get_color_brightness(brightness_control *ptr) const
void get_color_backlight_compensation(backlight_compensation_control *ptr) const
void unregister_from_visual_preset_option()
virtual void register_option(rs2_option id, std::shared_ptr< option > option)
@ RS2_OPTION_WHITE_BALANCE
void get_color_power_line_frequency(power_line_frequency_control *ptr) const
void set_color_exposure(const exposure_control &val)
@ RS2_CAMERA_INFO_PRODUCT_ID
virtual float get_preset_max_value() const
@ RS2_RS400_VISUAL_PRESET_REMOVE_IR_PATTERN
@ RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY
void set_color_backlight_compensation(const backlight_compensation_control &val)
void set_color_hue(const hue_control &val)
void get_color_hue(hue_control *ptr) const
void get_color_exposure(exposure_control *ptr) const
std::vector< uint8_t > send_receive(const std::vector< uint8_t > &input) const
const char * get_value_description(float val) const override
void set_all(const preset &p)
void get_ae_control(STAEControl *ptr, int mode=0) const override
void get_color_sharpness(sharpness_control *ptr) const
void default_450_high_res(preset &p)
const char * rs2_rs400_visual_preset_to_string(rs2_rs400_visual_preset preset)
@ RS2_RS400_VISUAL_PRESET_HAND
void get_laser_state(laser_state_control *ptr) const
ds_advanced_mode_base & _advanced
std::vector< uint8_t > serialize_json() const override
bool is_valid(float value) const
void get_slo_color_thresholds_control(STSloColorThresholdsControl *ptr, int mode=0) const override
@ RS2_CAMERA_INFO_FIRMWARE_VERSION
void set_depth_exposure(const exposure_control &val)
void get_color_gamma(gamma_control *ptr) const
void block(const std::string &exception_message)
void get_color_white_balance(white_balance_control *ptr) const
void get_color_correction(STColorCorrection *ptr, int mode=0) const override
void high_accuracy(preset &p)
void set_color_gain(const gain_control &val)
void get_slo_penalty_control(STSloPenaltyControl *ptr, int mode=0) const override
void set_rau_color_thresholds_control(const STRauColorThresholdsControl &val) override
const uint16_t RS435_RGB_PID
void get_laser_power(laser_power_control *ptr) const
uint16_t get_device_pid(const uvc_sensor &sensor) const
void register_on_open(on_open callback)
void get_depth_control_group(STDepthControlGroup *ptr, int mode=0) const override
void set_census_radius(const STCensusRadius &val) override
static uint32_t pack(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3)
void set_color_white_balance(const white_balance_control &val)
std::vector< uint8_t > generate_json(const device_interface &dev, const preset &in_preset)
void set_depth_gain(const gain_control &val)
bool supports_option(const synthetic_sensor &sensor, rs2_option opt) const
void default_405u(preset &p)
void get_color_control(STColorControl *ptr, int mode=0) const override
void set_rsm(const STRsm &val) override
void default_405(preset &p)
void get_census_radius(STCensusRadius *ptr, int mode=0) const override
rsutils::version firmware_version
void get_auto_exposure(synthetic_sensor &sensor, auto_exposure_control *ptr) const
const uint16_t RS435I_PID
const uint16_t RS405U_PID
void get_rau_support_vector_control(STRauSupportVectorControl *ptr, int mode=0) const override
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls,...
option & get_option(rs2_option id) override
void get_color_auto_white_balance(auto_white_balance_control *ptr) const
void get_color_gain(gain_control *ptr) const
static rs2_rs400_visual_preset to_preset(float x)
void set_laser_state(const laser_state_control &val)
void get_depth_exposure(exposure_control *ptr) const
std::vector< uint8_t > encode_command(ds::fw_cmd opcode, uint32_t p1=0, uint32_t p2=0, uint32_t p3=0, uint32_t p4=0, std::vector< uint8_t > data=std::vector< uint8_t >()) const
virtual bool supports_feature(feature_id id, std::shared_ptr< feature_interface > *=nullptr)
void get_amp_factor(STAFactor *ptr, int mode=0) const override
void set_color_auto_white_balance(const auto_white_balance_control &val)
void set(float value) override
bool should_set_rgb_preset() const
void set_exposure(synthetic_sensor &sensor, const exposure_control &val)
void set_laser_power(const laser_power_control &val)
void set_amp_factor(const STAFactor &val) override
void set_color_control(const STColorControl &val) override
@ RS2_OPTION_POWER_LINE_FREQUENCY
void set(const T &strct, EtAdvancedModeRegGroup cmd) const
void d460_remove_ir(preset &p)
void set_color_correction(const STColorCorrection &val) override
void get_depth_auto_white_balance(auto_white_balance_control *ptr) const
ds_advanced_mode_base(std::shared_ptr< hw_monitor > hwm, synthetic_sensor &depth_sensor)
void set_color_brightness(const brightness_control &val)
@ RS2_RS400_VISUAL_PRESET_DEFAULT
rs2_rs400_visual_preset
For RS400 devices: provides optimized settings (presets) for specific types of usage.
void set_depth_control_group(const STDepthControlGroup &val) override
virtual void set(float value)=0
void set_hdad(const STHdad &val) override
rsutils::lazy< bool > _amplitude_factor_support
@ RS2_OPTION_VISUAL_PRESET
@ RS2_OPTION_EMITTER_ENABLED
void load_json(const std::string &json_content) override
const std::string & get_info(rs2_camera_info info) const override
void d415_remove_ir(preset &p)
void get_hdad(STHdad *ptr, int mode=0) const override
void set_color_auto_exposure(const auto_exposure_control &val)
static const uint16_t HW_MONITOR_BUFFER_SIZE
void default_450_mid_low_res(preset &p)
firmware_version get_firmware_version(const uvc_sensor &sensor) const
void set_depth_auto_exposure(const auto_exposure_control &val)
void get_exposure(synthetic_sensor &sensor, exposure_control *ptr) const
static const textual_icon lock
static std::vector< uint8_t > assert_no_error(ds::fw_cmd opcode, const std::vector< uint8_t > &results)
float query() const override
void default_430(preset &p)
void set_color_gamma(const gamma_control &val)
void set_all_depth(const preset &p)
void set_color_saturation(const saturation_control &val)
virtual float query() const =0
static const feature_id ID
@ RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY
const uint16_t RS430I_PID
void mid_density(preset &p)
res_type get_res_type(uint32_t width, uint32_t height)
void apply_preset(const std::vector< platform::stream_profile > &configuration, rs2_rs400_visual_preset preset, uint16_t device_pid, const firmware_version &fw_version) override
@ RS2_CAMERA_INFO_PRODUCT_LINE
void get_color_saturation(saturation_control *ptr) const
void set_color_sharpness(const sharpness_control &val)
void set_slo_penalty_control(const STSloPenaltyControl &val) override
advanced_mode_preset_option(ds_advanced_mode_base &advanced, synthetic_sensor &ep, const option_range &opt_range)
void set_depth_auto_white_balance(const auto_white_balance_control &val)
void default_410(preset &p)
void update_structs(const device_interface &dev, const std::string &content, preset &in_preset)
void get_rsm(STRsm *ptr, int mode=0) const override
@ RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE
librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:00