Skip to content

Commit 8c27f73

Browse files
authored
PR realsenseai#14177 from remibettan: hkr merged to dev
2 parents ca98249 + 3aeabe6 commit 8c27f73

171 files changed

Lines changed: 10958 additions & 472 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ lib/
33

44
ubuntu-xenial/
55
ubuntu-xenial-hwe/
6+
ubuntu-focal-master/
7+
8+
.gitconfig
9+
610

711
# Docs
812
doc/doxygen/html/

common/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ set(COMMON_SRC
5757
"${CMAKE_CURRENT_LIST_DIR}/stream-model.cpp"
5858
"${CMAKE_CURRENT_LIST_DIR}/post-processing-filters.h"
5959
"${CMAKE_CURRENT_LIST_DIR}/post-processing-filters.cpp"
60+
"${CMAKE_CURRENT_LIST_DIR}/labeled-point-cloud-utilities.h"
61+
"${CMAKE_CURRENT_LIST_DIR}/labeled-point-cloud-utilities.cpp"
6062
"${CMAKE_CURRENT_LIST_DIR}/dds-model.h"
6163
"${CMAKE_CURRENT_LIST_DIR}/dds-model.cpp"
6264
"${CMAKE_CURRENT_LIST_DIR}/hdr-model.h"

common/d500-on-chip-calib.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <viewer.h>
66
#include "d500-on-chip-calib.h"
77

8-
98
namespace rs2
109
{
1110
d500_on_chip_calib_manager::d500_on_chip_calib_manager(viewer_model& viewer, std::shared_ptr<subdevice_model> sub,
@@ -81,6 +80,18 @@ namespace rs2
8180

8281
void d500_on_chip_calib_manager::prepare_for_calibration()
8382
{
83+
// safety sensor in service mode - if safety sensor exists
84+
auto sensors = _dev.query_sensors();
85+
for (auto&& s : sensors)
86+
{
87+
if (s.is<rs2::safety_sensor>())
88+
{
89+
rs2::safety_sensor safety_s = s.as<rs2::safety_sensor>();
90+
set_option_if_needed<rs2::safety_sensor>(safety_s, RS2_OPTION_SAFETY_MODE, RS2_SAFETY_MODE_SERVICE);
91+
break;
92+
}
93+
}
94+
8495
// set depth preset as default preset, turn projector ON and depth AE ON
8596
if (_sub->s->supports(RS2_CAMERA_INFO_NAME) &&
8697
(std::string(_sub->s->get_info(RS2_CAMERA_INFO_NAME)) == "Stereo Module"))
@@ -186,6 +197,15 @@ namespace rs2
186197
else
187198
{
188199
update_ui_on_calibration_complete(win, x, y);
200+
if (get_manager().get_device_pid() == "0B6B")
201+
{
202+
if (!reset_called &&
203+
get_manager().action != d500_on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_CALIB_ABORT)
204+
{
205+
get_manager().reset_device();
206+
reset_called = true;
207+
}
208+
}
189209
}
190210

191211
ImGui::SetCursorScreenPos({ float(x + 5), float(y + height - 25) });
@@ -294,6 +314,7 @@ namespace rs2
294314

295315
void d500_autocalib_notification_model::update_ui_after_abort_called(ux_window& win, int x, int y)
296316
{
317+
ImGui::SetCursorScreenPos({ float(x + 10), float(y) });
297318
ImGui::Text("%s", "Calibration Aborting");
298319
ImGui::SetCursorScreenPos({ float(x + 10), float(y + 40) });
299320
ImGui::PushFont(win.get_large_font());

common/d500-on-chip-calib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ namespace rs2
2323
class d500_on_chip_calib_manager : public process_manager
2424
{
2525
public:
26-
d500_on_chip_calib_manager(viewer_model& viewer, std::shared_ptr<subdevice_model> sub, device_model& model, device dev);
26+
d500_on_chip_calib_manager(viewer_model& viewer, std::shared_ptr<subdevice_model> sub, device_model& model,
27+
device dev);
2728

2829
enum calib_action
2930
{

common/device-model.cpp

Lines changed: 55 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,7 @@ namespace rs2
10411041
error_message = e.what();
10421042
}
10431043
}
1044+
10441045
void device_model::check_for_device_updates(viewer_model& viewer, bool activated_by_user )
10451046
{
10461047
std::weak_ptr< updates_model > updates_model_protected( viewer.updates );
@@ -1385,7 +1386,6 @@ namespace rs2
13851386
RsImGui::CustomTooltip("%s", tooltip.c_str());
13861387
}
13871388

1388-
13891389
if( dev.supports( RS2_CAMERA_INFO_PRODUCT_LINE )
13901390
&& ( dev.get_info( RS2_CAMERA_INFO_PRODUCT_LINE ) ) )
13911391
{
@@ -1839,33 +1839,24 @@ namespace rs2
18391839

18401840
//Find Resolution
18411841
std::pair<int, int> requested_res{ kvp.second.width,kvp.second.height };
1842-
size_t res_id = 0;
1843-
for (; res_id < sub->res_values.size(); res_id++)
1844-
{
1845-
if (sub->res_values[res_id] == requested_res)
1846-
break;
1847-
}
1848-
if (res_id == sub->res_values.size())
1849-
{
1850-
throw std::runtime_error( rsutils::string::from()
1851-
<< "No match found for requested resolution: " << requested_res.first
1852-
<< "x" << requested_res.second );
1853-
}
18541842
if (!sub->ui.is_multiple_resolutions)
1855-
sub->ui.selected_res_id = static_cast<int>(res_id);
1856-
else
18571843
{
1858-
int depth_res_id, ir1_res_id, ir2_res_id;
1859-
sub->get_depth_ir_mismatch_resolutions_ids(depth_res_id, ir1_res_id, ir2_res_id);
1860-
1861-
if (kvp.first.first == RS2_STREAM_DEPTH)
1862-
sub->ui.selected_res_id_map[depth_res_id] = static_cast<int>(res_id);
1863-
else
1844+
size_t res_id = 0;
1845+
for (; res_id < sub->res_values.size(); res_id++)
1846+
{
1847+
if (sub->res_values[res_id] == requested_res)
1848+
break;
1849+
}
1850+
if (res_id == sub->res_values.size())
18641851
{
1865-
sub->ui.selected_res_id_map[ir1_res_id] = static_cast<int>(res_id);
1866-
sub->ui.selected_res_id_map[ir2_res_id] = static_cast<int>(res_id);
1852+
throw std::runtime_error(rsutils::string::from()
1853+
<< "No match found for requested resolution: " << requested_res.first
1854+
<< "x" << requested_res.second);
18671855
}
1856+
sub->ui.selected_res_id = static_cast<int>(res_id);
18681857
}
1858+
else
1859+
sub->ui.selected_stream_to_res[kvp.first.first] = requested_res;
18691860
}
18701861
}
18711862
}
@@ -2129,7 +2120,7 @@ namespace rs2
21292120
sub->_options_invalidated = true;
21302121
}
21312122
}
2132-
auto ret = file_dialog_open(open_file, "JavaScript Object Notation (JSON | PRESET)\0*.json;*.preset\0", NULL, NULL);
2123+
auto ret = file_dialog_open(open_file, "JavaScript Object Notation (JSON | PRESET)\0*.json\0*.preset\0", NULL, NULL);
21332124
if (ret)
21342125
{
21352126
error_message = safe_call([&]() { load_json(ret); });
@@ -2985,23 +2976,60 @@ namespace rs2
29852976

29862977
bool device_model::disable_record_button_logic(bool is_streaming, bool is_playback_device)
29872978
{
2988-
return (!is_streaming || is_playback_device);
2979+
bool depth_mapping_camera_streaming_alone = is_depth_mapping_camera_streaming_alone();
2980+
return (!is_streaming || is_playback_device || depth_mapping_camera_streaming_alone);
29892981
}
29902982

29912983
std::string device_model::get_record_button_hover_text(bool is_streaming)
29922984
{
2985+
bool depth_mapping_camera_streaming_alone = is_depth_mapping_camera_streaming_alone();
29932986
std::string record_button_hover_text;
29942987
if (!is_streaming)
29952988
{
29962989
record_button_hover_text = "Start streaming to enable recording";
29972990
}
29982991
else
29992992
{
3000-
record_button_hover_text = is_recording ? "Stop Recording" : "Start Recording";
2993+
if (depth_mapping_camera_streaming_alone)
2994+
{
2995+
record_button_hover_text = "To record Depth Mapping Camera also stream Stereo Module";
2996+
}
2997+
else
2998+
{
2999+
record_button_hover_text = is_recording ? "Stop Recording" : "Start Recording";
3000+
}
30013001
}
30023002
return record_button_hover_text;
30033003
}
30043004

3005+
//In order to record LPC and enable 3D we need to also record depth stereo sensor
3006+
bool device_model::is_depth_mapping_camera_streaming_alone()
3007+
{
3008+
std::string pid = dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID);
3009+
if (pid == "0B6B")
3010+
{
3011+
bool depth_mapping_sensor_streaming = false;
3012+
bool depth_stereo_sensor_streaming = false;
3013+
for (auto&& sub : subdevices)
3014+
{
3015+
if (sub->s->is<rs2::depth_mapping_sensor>() && sub->streaming)
3016+
{
3017+
depth_mapping_sensor_streaming = true;
3018+
}
3019+
if (sub->s->is<rs2::depth_stereo_sensor>() && sub->streaming)
3020+
{
3021+
depth_stereo_sensor_streaming = true;
3022+
}
3023+
}
3024+
if (depth_mapping_sensor_streaming && !depth_stereo_sensor_streaming)
3025+
{
3026+
return true;
3027+
}
3028+
}
3029+
return false;
3030+
}
3031+
3032+
30053033
std::vector<std::pair<std::string, std::string>> get_devices_names(const device_list& list)
30063034
{
30073035
std::vector<std::pair<std::string, std::string>> device_names;
@@ -3434,7 +3462,7 @@ namespace rs2
34343462
}
34353463
else
34363464
{
3437-
manager = std::make_shared< d500_on_chip_calib_manager >( viewer, sub, *this, dev );
3465+
manager = std::make_shared<d500_on_chip_calib_manager>(viewer, sub, *this, dev );
34383466
n = std::make_shared< d500_autocalib_notification_model >( "", manager, false );
34393467
}
34403468
viewer.not_model->add_notification( n );

common/device-model.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ namespace rs2
167167
static const char* hwlogger_xml{ "viewer_model.hwlogger_xml" };
168168

169169
static const char* last_ip{ "viewer_model.last_ip" };
170+
171+
static const char* lpc_point_size{ "viewer_model.lpc_point_size" };
172+
static const char* show_safety_zones_3d{ "viewer_model.show_safety_zones_3d" };
173+
static const char* show_safety_zones_2d{ "viewer_model.show_safety_zones_2d" };
170174
}
171175
namespace window
172176
{
@@ -260,6 +264,8 @@ namespace rs2
260264
static const textual_icon cube{ u8"\uf1b2" };
261265
static const textual_icon measure{ u8"\uf545" };
262266
static const textual_icon wifi{ u8"\uf1eb" };
267+
static const textual_icon grid_6{ u8"\uf58d" };
268+
static const textual_icon polygon{ u8"\uf5ee" };
263269
}
264270

265271
class viewer_model;
@@ -400,6 +406,7 @@ namespace rs2
400406
void check_for_device_updates(viewer_model& viewer, bool activated_by_user = false);
401407
bool disable_record_button_logic(bool is_streaming, bool is_playback_device);
402408
std::string get_record_button_hover_text(bool is_streaming);
409+
bool is_depth_mapping_camera_streaming_alone();
403410

404411
void open_hdr_config_tool_window();
405412

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// License: Apache 2.0. See LICENSE file in root directory.
2+
// Copyright(c) 2023 RealSense, Inc. All Rights Reserved.
3+
4+
#include "float3.h"
5+
#include <map>
6+
#include <vector>
7+
#include <algorithm>
8+
#include <include/librealsense2/h/rs_types.h>
9+
#include <include/librealsense2/hpp/rs_frame.hpp>
10+
11+
#include "labeled-point-cloud-utilities.h"
12+
13+
namespace rs2
14+
{
15+
std::map<rs2_point_cloud_label, float3> labeled_point_cloud_utilities::get_label_to_color3f()
16+
{
17+
static const float3 ORANGE_COL = { 1.0f, 0.65f, 0.2f };
18+
static const float3 DARK_PURPLE_COL = { 0.2f, 0.1f, 0.2f };
19+
static const float3 WHITE_COL = { 1.0f, 1.0f, 1.0f };
20+
static const float3 GREEN_COL = { 0.0f, 1.0f, 0.0f };
21+
static const float3 RED_COL = { 1.0f, 0.0f, 0.0f };
22+
static const float3 TURQUOISE_COL = { 0.0f, 1.0f, 1.0f };
23+
static const float3 BLUE_COL = { 0.0f, 0.0f, 1.0f };
24+
static const float3 PINK_COL = { 1.0f, 0.75f, 0.8f };
25+
static const float3 GREY_COL = { 0.5f, 0.5f, 0.5f };
26+
static const float3 YELLOW_COL = { 1.0f, 1.0f, 0.0f };
27+
std::map<rs2_point_cloud_label, float3> label_to_color3f;
28+
29+
label_to_color3f[RS2_POINT_CLOUD_LABEL_UNKNOWN] = ORANGE_COL;
30+
label_to_color3f[RS2_POINT_CLOUD_LABEL_UNDEFINED] = ORANGE_COL;
31+
label_to_color3f[RS2_POINT_CLOUD_LABEL_INVALID] = ORANGE_COL;
32+
label_to_color3f[RS2_POINT_CLOUD_LABEL_GAP] = ORANGE_COL;
33+
34+
label_to_color3f[RS2_POINT_CLOUD_LABEL_GROUND] = WHITE_COL;
35+
label_to_color3f[RS2_POINT_CLOUD_LABEL_NEAR_GROUND] = GREEN_COL;
36+
label_to_color3f[RS2_POINT_CLOUD_LABEL_OVERHEAD] = TURQUOISE_COL;
37+
label_to_color3f[RS2_POINT_CLOUD_LABEL_ABOVE_CEILING_HEIGHT] = BLUE_COL;
38+
label_to_color3f[RS2_POINT_CLOUD_LABEL_MASKED] = GREY_COL;
39+
label_to_color3f[RS2_POINT_CLOUD_LABEL_CLIFF] = DARK_PURPLE_COL;
40+
label_to_color3f[RS2_POINT_CLOUD_LABEL_OBSTACLE] = PINK_COL;
41+
label_to_color3f[RS2_POINT_CLOUD_LABEL_OBSTACLE_DANGER] = RED_COL;
42+
label_to_color3f[RS2_POINT_CLOUD_LABEL_OBSTACLE_WARNING] = YELLOW_COL;
43+
44+
45+
46+
return label_to_color3f;
47+
}
48+
} // rs2 namespace
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// License: Apache 2.0. See LICENSE file in root directory.
2+
// Copyright(c) 2023-2024 RealSense, Inc. All Rights Reserved.
3+
4+
#pragma once
5+
6+
#include <include/librealsense2/h/rs_types.h>
7+
#include <common/float3.h>
8+
9+
namespace rs2
10+
{
11+
class labeled_point_cloud_utilities
12+
{
13+
public:
14+
static std::map<rs2_point_cloud_label, float3> get_label_to_color3f();
15+
};
16+
17+
}

common/metadata-helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ namespace rs2
3131
// This is the command-line parameter that gets passed to another process (running as admin) in order to enable metadata -- see WinMain
3232
static std::string get_command_line_param() { return "--enable_metadata"; }
3333
};
34-
}
34+
}

common/os.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,13 @@ Some auxillary functionalities might be affected. Please report this message if
201201
202202
if (filters_split.size() >= 1)
203203
{
204-
filters_count = int( filters_split.size() - 1 );
204+
filters_count = static_cast<int>( filters_split.size() - 1 );
205205
206206
// set description
207207
aSingleFilterDescription = filters_split[0].c_str();
208208
209209
// fill filter pattern with extensions
210-
for (int i = 1; i < filters_split.size(); ++i)
210+
for(int i = 1; i < filters_split.size(); ++i)
211211
{
212212
filter.push_back(filters_split[i].c_str());
213213
}

0 commit comments

Comments
 (0)