4 #include "../../test.h" 9 #include "../send-hw-monitor-command.h" 18 std::map< rs2_option, float > >
21 typedef std::map< std::pair< rs2_digital_gain, rs2_sensor_mode >, std::map< rs2_option, float > >
52 const std::map< rs2_l500_visual_preset, std::pair< rs2_digital_gain, presets_useful_laser_values > >
108 std::map< rs2_option, float > option_to_defaults;
132 float digital_gain_val;
136 auto val = *
reinterpret_cast< int32_t *
>( (
void *)res.data() );
138 option_to_defaults[op.first] = float( val );
141 return option_to_defaults;
151 (
float)preset_to_gain_and_laser[preset_mode.first].first );
165 preset_to_expected_defaults_values[preset_mode]
169 return preset_to_expected_defaults_values;
175 std::map< rs2_option, float > & expected_values,
176 std::map< rs2_option, float > & expected_defs )
181 auto preset = preset_mode.first;
182 auto mode = preset_mode.second;
199 = preset_to_gain_and_laser[preset].second ==
default_laser ? laser_range.def
213 expected_values[preset_mode],
214 expected_defs[preset_mode] );
220 std::map< rs2_option, float > option_to_defaults;
227 option_to_defaults[op.first] = range.def;
229 return option_to_defaults;
246 return gain_to_expected_defaults_values;
266 std::map< rs2_option, float > option_to_currents;
273 option_to_currents[op.first] = curr;
275 return option_to_currents;
279 const std::map< rs2_option, float > & second )
283 REQUIRE( first.size() == second.size() );
286 for(
auto it_first = first.begin(), it_second = second.begin(); it_first != first.end();
287 it_first++, it_second++ )
289 REQUIRE( it_first->first == it_second->first );
290 REQUIRE( it_first->second == it_second->second );
299 std::ofstream csv(
"presets.csv" );
303 = preset_to_expected_values[preset_mode];
305 csv <<
"-----" << preset_mode.first <<
" " << preset_mode.second <<
"-----" 308 for(
auto i : expected_values )
310 csv <<
i.first <<
"," <<
i.second <<
"\n";
318 const std::map< rs2_option, float > & option_values )
320 for(
auto option_value : option_values )
325 REQUIRE( value == option_value.second );
330 const std::map< rs2_option, float > & expected_values )
332 for(
auto &
i : expected_values )
340 const std::map< rs2_option, float > & expected_defaults )
342 for(
auto &
i : expected_defaults )
350 const std::map< rs2_option, float > & expected_values,
351 const std::map< rs2_option, float > & expected_defaults )
360 const std::map< rs2_option, float > & expected_values,
361 const std::map< rs2_option, float > & expected_defaults )
380 for (
auto& preset : presets_to_check)
387 do_before_check(preset_mode);
392 preset_to_expected_values[preset_mode],
393 preset_to_expected_defaults[preset_mode]);
396 do_after_check(preset_mode);
431 std::vector<rs2_l500_visual_preset> presets_to_check,
443 preset_to_expected_values,
444 preset_to_expected_defaults,
446 if( do_before_stream_start )
447 do_before_stream_start(preset_mode);
451 if( do_after_stream_start )
452 do_after_stream_start(preset_mode);
463 if( curr_preset != preset )
470 == preset_to_gain_and_laser[curr_preset].
first );
void check_presets_values(std::vector< rs2_l500_visual_preset > presets_to_check, const rs2::sensor &sens, preset_values_map &preset_to_expected_values, preset_values_map &preset_to_expected_defaults, std::function< void(preset_mode_pair) > do_before_check=nullptr, std::function< void(preset_mode_pair) > do_after_check=nullptr)
std::map< rs2_option, float > build_preset_to_expected_defaults_map(rs2::device &dev, rs2::depth_sensor &depth_sens, preset_mode_pair preset_mode)
void compare_expected_currents_to_actual(const rs2::sensor &sens, const std::map< rs2_option, float > &expected_values)
const librealsense::firmware_version MIN_GET_DEFAULT_FW_VERSION("1.5.4.0")
void compare_to_actual(const rs2::sensor &sens, const std::map< rs2_option, float > &expected_values, const std::map< rs2_option, float > &expected_defaults)
void check_preset_is_equal_to(rs2::depth_sensor &depth_sens, rs2_l500_visual_preset preset)
std::pair< rs2_l500_visual_preset, rs2_sensor_mode > preset_mode_pair
std::map< rs2_option, float > get_defaults_from_lrs(rs2::depth_sensor &depth_sens)
std::map< preset_mode_pair, std::map< rs2_option, float > > preset_values_map
void check_presets_values_while_streaming(std::vector< rs2_l500_visual_preset > presets_to_check, const rs2::sensor &sens, preset_values_map &preset_to_expected_values, preset_values_map &preset_to_expected_defaults, std::function< void(preset_mode_pair) > do_before_stream_start=nullptr, std::function< void(preset_mode_pair) > do_after_stream_start=nullptr)
std::vector< uint8_t > send_command_and_check(rs2::debug_protocol dp, hw_monitor_command command, uint32_t expected_size_return=0)
void compare_expected_defaults_to_actual(const rs2::sensor &sens, const std::map< rs2_option, float > &expected_defaults)
GLint GLint GLsizei GLsizei GLsizei depth
void set_option_values(const rs2::sensor &sens, const std::map< rs2_option, float > &option_values)
presets_useful_laser_values
std::map< rs2_option, float > get_currents_from_lrs(rs2::depth_sensor &depth_sens)
void check_preset_values(const rs2::sensor &sens, rs2_l500_visual_preset preset, rs2_sensor_mode mode, const std::map< rs2_option, float > &expected_values, const std::map< rs2_option, float > &expected_defaults)
const std::map< rs2_l500_visual_preset, std::pair< rs2_digital_gain, presets_useful_laser_values > > preset_to_gain_and_laser_map
const std::vector< rs2_option > preset_dependent_options
gain_values_map build_gain_to_expected_defaults_map(rs2::device &dev, rs2::depth_sensor &depth_sens)
std::map< std::pair< rs2_digital_gain, rs2_sensor_mode >, std::map< rs2_option, float > > gain_values_map
rs2::device_list find_devices_by_product_line_or_exit(int product)
void print_presets_to_csv(rs2::depth_sensor &depth_sens, preset_values_map &preset_to_expected_values)
void build_new_device_and_do(std::function< void(rs2::depth_sensor &depth_sens) > action)
#define RS2_PRODUCT_LINE_L500
void compare(const std::map< rs2_option, float > &first, const std::map< rs2_option, float > &second)
bool supports(rs2_camera_info info) const
void reset_hw_controls(rs2::device &dev)
rs2_sensor_mode
For setting the camera_mode option.
void stop_depth(const rs2::sensor &sens)
GLdouble GLdouble GLdouble q
std::map< rs2_option, librealsense::l500_control > option_to_code
void open(const stream_profile &profile) const
rs2_digital_gain
digital gain for RS2_OPTION_DIGITAL_GAIN option.
void for_each_gain_mode_combination(std::function< void(rs2_digital_gain, rs2_sensor_mode) > action)
REQUIRE_NOTHROW(rs2_log(RS2_LOG_SEVERITY_INFO,"Log message using rs2_log()", nullptr))
void build_preset_to_expected_values_map(rs2::device &dev, rs2::depth_sensor &depth_sens, preset_mode_pair preset_mode, std::map< rs2_option, float > &expected_values, std::map< rs2_option, float > &expected_defs)
void reset_camera_preset_mode_to_defaults(const rs2::sensor &sens)
void build_presets_to_expected_values_defs_map(rs2::device &dev, rs2::depth_sensor &depth_sens, preset_values_map &expected_values, preset_values_map &expected_defs)
option_range get_option_range(rs2_option option) const
void for_each_preset_mode_combination(std::function< void(preset_mode_pair) > action)
void set_mode_preset(const rs2::sensor &sens, preset_mode_pair preset_mode)
preset_values_map build_presets_to_expected_defaults_map(rs2::device &dev, rs2::depth_sensor &depth_sens)
stream_profile find_profile(rs2::depth_sensor depth_sens, rs2_stream stream, rs2_sensor_mode mode)
void set_option(rs2_option option, float value) const
float get_option(rs2_option option) const
GeneratorWrapper< T > map(Func &&function, GeneratorWrapper< U > &&generator)
void start(T callback) const
preset_mode_pair get_camera_preset_mode_defaults(const rs2::sensor &sens)
void start_depth_ir_confidence(const rs2::sensor &sens, rs2_sensor_mode mode=RS2_SENSOR_MODE_VGA)
std::map< rs2_option, float > get_defaults_from_fw(rs2::device &dev)
rs2_l500_visual_preset
For L500 devices: provides optimized settings (presets) for specific types of usage.