Skip to content

Commit

Permalink
PR IntelRealSense#11037 from remibettan: merge development work
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az authored Oct 27, 2022
2 parents dee61e5 + 9c1c3ab commit c00e630
Show file tree
Hide file tree
Showing 22 changed files with 22,004 additions and 9,464 deletions.
84 changes: 70 additions & 14 deletions common/on-chip-calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,6 @@ namespace rs2
bool frame_arrived = false;
try
{
if (_sub->s->supports(RS2_OPTION_EMITTER_ENABLED))
{
laser_status_prev = _sub->s->get_option(RS2_OPTION_EMITTER_ENABLED);
_sub->s->set_option(RS2_OPTION_EMITTER_ENABLED, 0.0f);
}
if (_sub->s->supports(RS2_OPTION_THERMAL_COMPENSATION))
{
thermal_loop_prev = _sub->s->get_option(RS2_OPTION_THERMAL_COMPENSATION);
_sub->s->set_option(RS2_OPTION_THERMAL_COMPENSATION, 0.f);
}

bool run_fl_calib = ( (action == RS2_CALIB_ACTION_FL_CALIB) && (w == 1280) && (h == 720));
if (action == RS2_CALIB_ACTION_TARE_GROUND_TRUTH)
{
Expand All @@ -428,7 +417,6 @@ namespace rs2
break;
}
}

}
else if (action == RS2_CALIB_ACTION_UVMAPPING_CALIB)
{
Expand Down Expand Up @@ -1422,12 +1410,46 @@ namespace rs2
try_start_viewer(256, 144, 90, invoke);
}

if (action == RS2_CALIB_ACTION_TARE_GROUND_TRUTH)
if ( action == RS2_CALIB_ACTION_TARE_GROUND_TRUTH )
{
//Laser should be turned off during ground truth calculation
//Use options_model::set_option to update GUI after change
std::string ignored_error_message { "" };
auto it = _sub->options_metadata.find( RS2_OPTION_EMITTER_ENABLED );
if ( it != _sub->options_metadata.end() ) //Option supported
{
laser_status_prev = _sub->s->get_option( RS2_OPTION_EMITTER_ENABLED );
it->second.set_option( RS2_OPTION_EMITTER_ENABLED, 0.0f, ignored_error_message );
}

get_ground_truth();

//Restore laser
if ( it != _sub->options_metadata.end() ) //Option supported
{
it->second.set_option( RS2_OPTION_EMITTER_ENABLED, laser_status_prev, ignored_error_message );
}
}
else
{
try
{
//Save options that are going to change during the calibration
//Use options_model::set_option to update GUI after change
std::string ignored_error_message { "" };
auto it = _sub->options_metadata.find( RS2_OPTION_EMITTER_ENABLED );
if ( it != _sub->options_metadata.end() ) //Option supported
{
laser_status_prev = _sub->s->get_option( RS2_OPTION_EMITTER_ENABLED );
it->second.set_option( RS2_OPTION_EMITTER_ENABLED, 1.0f, ignored_error_message );
}
it = _sub->options_metadata.find( RS2_OPTION_THERMAL_COMPENSATION );
if ( it != _sub->options_metadata.end() ) //Option supported
{
thermal_loop_prev = _sub->s->get_option( RS2_OPTION_THERMAL_COMPENSATION );
it->second.set_option( RS2_OPTION_THERMAL_COMPENSATION, 0.0f, ignored_error_message );
}

if (action == RS2_CALIB_ACTION_FL_CALIB)
calibrate_fl();
else if (action == RS2_CALIB_ACTION_UVMAPPING_CALIB)
Expand All @@ -1449,8 +1471,25 @@ namespace rs2
_sub_color->ui = *_ui_color;
_ui_color.reset();
}

//Restore options that were changed during the calibration.
//When calibration is successful options are restored in autocalib_notification_model::draw_content()
//Use options_model::set_option to update GUI after change
std::string ignored_error_message { "" };
auto it = _sub->options_metadata.find( RS2_OPTION_EMITTER_ENABLED );
if ( it != _sub->options_metadata.end() ) //Option supported
{
it->second.set_option( RS2_OPTION_EMITTER_ENABLED, laser_status_prev, ignored_error_message );
}
it = _sub->options_metadata.find( RS2_OPTION_THERMAL_COMPENSATION );
if ( it != _sub->options_metadata.end() ) //Option supported
{
it->second.set_option( RS2_OPTION_THERMAL_COMPENSATION, thermal_loop_prev, ignored_error_message );
}

if (_was_streaming)
start_viewer(0, 0, 0, invoke);

throw;
}
}
Expand Down Expand Up @@ -2294,12 +2333,29 @@ namespace rs2
}
else if (update_state == RS2_CALIB_STATE_CALIB_COMPLETE)
{
if (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_CALIB ||
get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_TARE_CALIB )
{
//Restore options that were changed during the calibration.
//Use options_model::set_option to update GUI after change
std::string ignored_error_message { "" };
auto it = get_manager()._sub->options_metadata.find( RS2_OPTION_EMITTER_ENABLED );
if ( it != get_manager()._sub->options_metadata.end() ) //Option supported
{
it->second.set_option( RS2_OPTION_EMITTER_ENABLED, get_manager().laser_status_prev, ignored_error_message );
}
it = get_manager()._sub->options_metadata.find( RS2_OPTION_THERMAL_COMPENSATION );
if ( it != get_manager()._sub->options_metadata.end() ) //Option supported
{
it->second.set_option( RS2_OPTION_THERMAL_COMPENSATION, get_manager().thermal_loop_prev, ignored_error_message );
}
}
if (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_UVMAPPING_CALIB)
{
if (get_manager()._sub->s->supports(RS2_OPTION_EMITTER_ENABLED))
get_manager()._sub->s->set_option(RS2_OPTION_EMITTER_ENABLED, get_manager().laser_status_prev);
if (get_manager()._sub->s->supports(RS2_OPTION_THERMAL_COMPENSATION))
get_manager()._sub->s->set_option(RS2_OPTION_THERMAL_COMPENSATION, get_manager().laser_status_prev);
get_manager()._sub->s->set_option(RS2_OPTION_THERMAL_COMPENSATION, get_manager().thermal_loop_prev);

ImGui::SetCursorScreenPos({ float(x + 20), float(y + 33) });
ImGui::Text("%s", "Health-Check Number for PX: ");
Expand Down
39 changes: 29 additions & 10 deletions common/res/icon.h

Large diffs are not rendered by default.

Binary file added common/res/icon_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/res/icon_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/res/icon_24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/res/icon_256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/res/icon_310.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/res/icon_32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/res/icon_512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added common/res/icon_64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions common/res/int-rs-splash.hpp

Large diffs are not rendered by default.

Binary file modified common/res/int-rs-splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions common/sw-update/versions-db-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <vector>
#include "http-downloader.h"
#include <regex>
#include <sstream>

namespace rs2
{
Expand Down
41 changes: 0 additions & 41 deletions src/ds5/ds5-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,11 +879,6 @@ namespace librealsense
);
}

depth_sensor.register_processing_block(
{ RS2_FORMAT_Y16I },
{ {RS2_FORMAT_Y16, RS2_STREAM_INFRARED, 1}, {RS2_FORMAT_Y16, RS2_STREAM_INFRARED, 2} },
[]() {return std::make_shared<y16i_to_y10msby10msb>(); }
);

pid_hex_str = hexify(_pid);

Expand Down Expand Up @@ -1134,42 +1129,6 @@ namespace librealsense
lazy<float>([default_depth_units]()
{ return default_depth_units; })));
}

// D457 dev - auto gain and exposure limits disabled for all devices
if (false) // D457 dev - this condition should be removed after bug resolved in FW
{
// Auto exposure and gain limit
if (_fw_version >= firmware_version("5.12.10.11"))
{
auto exposure_range = depth_sensor.get_option(RS2_OPTION_EXPOSURE).get_range();
auto gain_range = depth_sensor.get_option(RS2_OPTION_GAIN).get_range();

option_range enable_range = { 0.f /*min*/, 1.f /*max*/, 1.f /*step*/, 0.f /*default*/ };

//GAIN Limit
auto gain_limit_toggle_control = std::make_shared<limits_option>(RS2_OPTION_AUTO_GAIN_LIMIT_TOGGLE, enable_range, "Toggle Auto-Gain Limit", *_hw_monitor);
_gain_limit_value_control = std::make_shared<auto_gain_limit_option>(*_hw_monitor, &depth_sensor, gain_range, gain_limit_toggle_control);
depth_sensor.register_option(RS2_OPTION_AUTO_GAIN_LIMIT_TOGGLE, gain_limit_toggle_control);

depth_sensor.register_option(RS2_OPTION_AUTO_GAIN_LIMIT,
std::make_shared<auto_disabling_control>(
_gain_limit_value_control,
gain_limit_toggle_control

));

// EXPOSURE Limit
auto ae_limit_toggle_control = std::make_shared<limits_option>(RS2_OPTION_AUTO_EXPOSURE_LIMIT_TOGGLE, enable_range, "Toggle Auto-Exposure Limit", *_hw_monitor);
_ae_limit_value_control = std::make_shared<auto_exposure_limit_option>(*_hw_monitor, &depth_sensor, exposure_range, ae_limit_toggle_control);
depth_sensor.register_option(RS2_OPTION_AUTO_EXPOSURE_LIMIT_TOGGLE, ae_limit_toggle_control);

depth_sensor.register_option(RS2_OPTION_AUTO_EXPOSURE_LIMIT,
std::make_shared<auto_disabling_control>(
_ae_limit_value_control,
ae_limit_toggle_control
));
}
}
}); //group_multiple_fw_calls


Expand Down
Loading

0 comments on commit c00e630

Please sign in to comment.