Skip to content

disable OCC when RGB streaming #14010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions common/calibration-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,18 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
}
ImGui::SameLine();

if (_accept)
rs2::sensor depth_sensor;
try
{
depth_sensor = dev.first<rs2::depth_sensor>();
}
catch (const std::exception& ex)
{
error_message = ex.what();
ImGui::CloseCurrentPopup();
}
auto streams = depth_sensor.get_active_streams();
if (_accept && streams.size())
{
if (ImGui::Button(u8"\uF2DB Write Table", ImVec2(120, 25)))
{
Expand Down Expand Up @@ -572,7 +583,7 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
ImGui::Button(u8"\uF2DB Write Table", ImVec2(120, 25));
if (ImGui::IsItemHovered())
{
RsImGui::CustomTooltip("%s", "Write selected calibration table to the device. For advanced users");
RsImGui::CustomTooltip("%s", "Write selected calibration table to the device. Requires \"Stereo Module\" stream to be on.For advanced users");
}

ImGui::PopStyleColor(2);
Expand All @@ -587,7 +598,6 @@ void calibration_model::d400_update(ux_window& window, std::string& error_messag
{
try
{
auto streams = dev.query_sensors()[0].get_active_streams();
dev.query_sensors()[0].close();
dev.query_sensors()[0].open(streams);
dev.as<rs2::auto_calibrated_device>().set_calibration_table(_calibration);
Expand Down
18 changes: 16 additions & 2 deletions common/device-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,16 @@ namespace rs2
});
}

bool rs2::device_model::is_color_streaming() const
{
for( const auto & sub : subdevices )
{
if (sub->s->is<color_sensor>() && sub->streaming)
return true;
}
return false;
}

void device_model::draw_controls(float panel_width, float panel_height,
ux_window& window,
std::string& error_message,
Expand Down Expand Up @@ -3060,6 +3070,10 @@ namespace rs2
std::string& error_message)
{
bool has_autocalib = false;

bool color_streaming = is_color_streaming();
ImGuiSelectableFlags avoid_selection_flag = (color_streaming) ? ImGuiSelectableFlags_Disabled : 0;

for (auto&& sub : subdevices)
{
if (sub->supports_on_chip_calib() && !has_autocalib)
Expand All @@ -3073,7 +3087,7 @@ namespace rs2
bool disable_fl_cal = (((device_pid == "0B5C") || show_disclaimer) &&
(!starts_with(device_usb_type, "3."))); // D410/D15/D455@USB2

if (ImGui::Selectable("On-Chip Calibration"))
if (ImGui::Selectable("On-Chip Calibration", false , avoid_selection_flag))
{
try
{
Expand Down Expand Up @@ -3167,7 +3181,7 @@ namespace rs2
if (ImGui::IsItemHovered())
RsImGui::CustomTooltip("Focal length calibration is used to adjust camera focal length with specific target.");

if (ImGui::Selectable("Tare Calibration"))
if (ImGui::Selectable("Tare Calibration", false, avoid_selection_flag))
{
try
{
Expand Down
1 change: 1 addition & 0 deletions common/device-model.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ namespace rs2
std::shared_ptr<syncer_model> syncer;
std::shared_ptr<rs2::asynchronous_syncer> dev_syncer;
bool is_streaming() const;
bool is_color_streaming() const;
bool metadata_supported = false;
bool get_curr_advanced_controls = true;
device dev;
Expand Down
4 changes: 4 additions & 0 deletions common/on-chip-calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,10 @@ namespace rs2
if (action == RS2_CALIB_ACTION_FL_CALIB || action == RS2_CALIB_ACTION_UVMAPPING_CALIB || action == RS2_CALIB_ACTION_FL_PLUS_CALIB)
stop_viewer(invoke);

if( action == RS2_CALIB_ACTION_ON_CHIP_CALIB || action == RS2_CALIB_ACTION_TARE_CALIB )
if( _model.is_color_streaming() )
throw std::runtime_error( "Turn off RGB Camera streaming before calibrating." );

update_last_used();

if (action == RS2_CALIB_ACTION_ON_CHIP_FL_CALIB || action == RS2_CALIB_ACTION_FL_CALIB)
Expand Down
Loading