Skip to content
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

on chip calibration bug fixes #6097

Merged
merged 5 commits into from
Mar 25, 2020
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
1 change: 1 addition & 0 deletions common/model-views.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ namespace rs2
namespace viewer
{
static const char* is_3d_view { "viewer_model.is_3d_view" };
static const char* ground_truth_r { "viewer_model.ground_truth_r" };
static const char* continue_with_ui_not_aligned { "viewer_model.continue_with_ui_not_aligned" };
static const char* continue_with_current_fw{ "viewer_model.continue_with_current_fw" };
static const char* settings_tab { "viewer_model.settings_tab" };
Expand Down
30 changes: 22 additions & 8 deletions common/on-chip-calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ namespace rs2
_in_3d_view = _viewer.is_3d_view;
_viewer.is_3d_view = true;

config_file::instance().set(configurations::viewer::ground_truth_r, ground_truth);


auto calib_dev = _dev.as<auto_calibrated_device>();
_old_calib = calib_dev.get_calibration_table();

Expand Down Expand Up @@ -390,6 +393,9 @@ namespace rs2

_viewer.is_3d_view = _in_3d_view;

_viewer.ground_truth_r = ground_truth;
config_file::instance().set(configurations::viewer::ground_truth_r, ground_truth);

_viewer.synchronization_enable = _synchronized;

stop_viewer(invoke);
Expand Down Expand Up @@ -431,7 +437,7 @@ namespace rs2
using namespace chrono;

auto health = get_manager().get_health();
auto recommend_keep = health > 0.25;
auto recommend_keep = fabs(health) > 0.25f;
if (!recommend_keep && update_state == RS2_CALIB_STATE_CALIB_COMPLETE && !get_manager().tare)
{
auto sat = 1.f + sin(duration_cast<milliseconds>(system_clock::now() - created_time).count() / 700.f) * 0.1f;
Expand Down Expand Up @@ -505,6 +511,8 @@ namespace rs2

if (update_state == RS2_CALIB_STATE_TARE_INPUT || update_state == RS2_CALIB_STATE_TARE_INPUT_ADVANCED)
ImGui::SetCursorScreenPos({ float(x + width - 30), float(y) });
else if (update_state == RS2_CALIB_STATE_FAILED)
ImGui::SetCursorScreenPos({ float(x + 2), float(y + 27) });
else
ImGui::SetCursorScreenPos({ float(x + 9), float(y + 27) });

Expand Down Expand Up @@ -557,7 +565,7 @@ namespace rs2
ImGui::Text("%s", "Avg Step Count:");
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", "Number of frames to average, Min = 1, Max = 30, Default = 10");
ImGui::SetTooltip("%s", "Number of frames to average, Min = 1, Max = 30, Default = 20");
}
ImGui::SetCursorScreenPos({ float(x + 135), float(y + 30) });

Expand All @@ -572,7 +580,7 @@ namespace rs2
ImGui::Text("%s", "Step Count:");
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", "Max iteration steps, Min = 5, Max = 30, Default = 10");
ImGui::SetTooltip("%s", "Max iteration steps, Min = 5, Max = 30, Default = 20");
}
ImGui::SetCursorScreenPos({ float(x + 135), float(y + 35 + ImGui::GetTextLineHeightWithSpacing()) });

Expand Down Expand Up @@ -636,6 +644,8 @@ namespace rs2

std::string id = to_string() << "##ground_truth_for_tare" << index;

get_manager().ground_truth = config_file::instance().get_or_default(configurations::viewer::ground_truth_r,2500);

std::string gt = to_string() << get_manager().ground_truth;
const int MAX_SIZE = 256;
char buff[MAX_SIZE];
Expand All @@ -650,6 +660,8 @@ namespace rs2
}
ImGui::PopItemWidth();

config_file::instance().set(configurations::viewer::ground_truth_r, get_manager().ground_truth);

auto sat = 1.f + sin(duration_cast<milliseconds>(system_clock::now() - created_time).count() / 700.f) * 0.1f;

ImGui::PushStyleColor(ImGuiCol_Button, saturate(sensor_header_light_blue, sat));
Expand Down Expand Up @@ -689,6 +701,7 @@ namespace rs2
for (auto&& s : vals) vals_cstr.push_back(s.c_str());

ImGui::PushItemWidth(width - 145);

ImGui::Combo(id.c_str(), &get_manager().speed, vals_cstr.data(), vals.size());
ImGui::PopItemWidth();

Expand Down Expand Up @@ -751,7 +764,7 @@ namespace rs2
{
auto health = get_manager().get_health();

auto recommend_keep = health > 0.25;
auto recommend_keep = fabs(health) > 0.25f;

ImGui::SetCursorScreenPos({ float(x + 15), float(y + 33) });

Expand Down Expand Up @@ -789,7 +802,7 @@ namespace rs2
ImGui::PushStyleColor(ImGuiCol_Text, light_blue);
ImGui::Text("%s", "(Good)");
}
else if (health < 0.75f)
else if (fabs(health) < 0.75f)
{
ImGui::PushStyleColor(ImGuiCol_Text, yellowish);
ImGui::Text("%s", "(Can be Improved)");
Expand All @@ -804,9 +817,9 @@ namespace rs2
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", "Calibration Health-Check captures how far camera calibration is from the optimal one\n"
"[0, 0.15) - Good\n"
"[0.15, 0.25) - Can be Improved\n"
"[0.25, ) - Requires Calibration");
"[0, 0.25) - Good\n"
"[0.25, 0.75) - Can be Improved\n"
"[0.75, ) - Requires Calibration");
}
}

Expand Down Expand Up @@ -1130,6 +1143,7 @@ namespace rs2
else if (update_state == RS2_CALIB_STATE_SELF_INPUT) return 110;
else if (update_state == RS2_CALIB_STATE_TARE_INPUT) return 85;
else if (update_state == RS2_CALIB_STATE_TARE_INPUT_ADVANCED) return 210;
else if (update_state == RS2_CALIB_STATE_FAILED) return 110;
else return 100;
}

Expand Down
2 changes: 2 additions & 0 deletions common/on-chip-calib.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace rs2
: process_manager("On-Chip Calibration"), _model(model),
_dev(dev), _sub(sub), _viewer(viewer)
{
auto dev_name = dev.get_info(RS2_CAMERA_INFO_NAME);
if (!strcmp(dev_name, "Intel RealSense D415")) { speed = 4; }
}

bool allow_calib_keep() const { return true; }
Expand Down
1 change: 1 addition & 0 deletions common/ux-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace rs2
config_file::instance().set_default(configurations::viewer::log_to_file, false);
config_file::instance().set_default(configurations::viewer::log_severity, 2);
config_file::instance().set_default(configurations::viewer::metric_system, true);
config_file::instance().set_default(configurations::viewer::ground_truth_r, 2500);

config_file::instance().set_default(configurations::record::compression_mode, 2); // Let the device decide
config_file::instance().set_default(configurations::record::default_path, get_folder_path(special_folder::user_documents));
Expand Down
3 changes: 3 additions & 0 deletions common/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,9 @@ namespace rs2
is_3d_view = config_file::instance().get_or_default(
configurations::viewer::is_3d_view, false);

ground_truth_r = config_file::instance().get_or_default(
configurations::viewer::ground_truth_r, 2500);

metric_system = config_file::instance().get_or_default(
configurations::viewer::metric_system, true);

Expand Down
1 change: 1 addition & 0 deletions common/viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ namespace rs2
bool is_3d_view = false;
bool paused = false;
bool metric_system = true;
uint32_t ground_truth_r = 2500;

enum export_type
{
Expand Down
2 changes: 1 addition & 1 deletion src/ds5/ds5-auto-calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ namespace librealsense
}

if (progress_callback)
progress_callback->on_update_progress(count * (2 * speed)); //curently this number does not reflect the actual progress
progress_callback->on_update_progress(count++ * (2 * speed)); //curently this number does not reflect the actual progress

now = std::chrono::high_resolution_clock::now();

Expand Down
2 changes: 1 addition & 1 deletion src/hw-monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace librealsense
if (opCodeAsUint32 != opCodeXmit)
{
auto err_type = static_cast<hwmon_response>(opCodeAsUint32);
throw invalid_value_exception(to_string() << "hwmon command 0x" << std::hex << opCodeXmit << " failed. Error type: "
throw invalid_value_exception(to_string() << "hwmon command 0x" << std::hex << opCodeXmit << " failed.\nError type: "
<< hwmon_error2str(err_type) << " (" << std::dec <<(int)err_type << ").");
}

Expand Down