From 24b7161a31a0840c37cd7aec5bba954eb8d682e6 Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Mon, 23 Dec 2024 12:42:28 +0200 Subject: [PATCH 01/11] D436i added to SDK - TODO linux adjustments --- scripts/realsense_metadata_win10.ps1 | 1 + src/ds/advanced_mode/advanced_mode.cpp | 1 + src/ds/d400/d400-color.h | 1 + src/ds/d400/d400-factory.cpp | 232 +++++++++++++++++++++++++ src/ds/d400/d400-private.cpp | 1 + src/ds/d400/d400-private.h | 7 + src/ds/ds-calib-parsers.cpp | 2 +- 7 files changed, 244 insertions(+), 1 deletion(-) diff --git a/scripts/realsense_metadata_win10.ps1 b/scripts/realsense_metadata_win10.ps1 index 7a8e2aa700..b98b65fec9 100644 --- a/scripts/realsense_metadata_win10.ps1 +++ b/scripts/realsense_metadata_win10.ps1 @@ -80,6 +80,7 @@ $MultiPinDevices = "USB\VID_8086&PID_0B68&MI_00",# L535 "USB\VID_8086&PID_0B56&MI_00",# D555 "USB\VID_8086&PID_1155&MI_00" # D421 + "USB\VID_8086&PID_1156&MI_00" # D436i #Inhibit system warnings and erros, such as permissions or missing values $ErrorActionPreference = "silentlycontinue" diff --git a/src/ds/advanced_mode/advanced_mode.cpp b/src/ds/advanced_mode/advanced_mode.cpp index d91d234b55..a218b0610f 100644 --- a/src/ds/advanced_mode/advanced_mode.cpp +++ b/src/ds/advanced_mode/advanced_mode.cpp @@ -114,6 +114,7 @@ namespace librealsense case ds::RS430I_PID: case ds::RS435_RGB_PID: case ds::RS435I_PID: + case ds::RS436I_PID: default_430(p); break; case ds::RS455_PID: diff --git a/src/ds/d400/d400-color.h b/src/ds/d400/d400-color.h index 67ed3904a7..634de348fe 100644 --- a/src/ds/d400/d400-color.h +++ b/src/ds/d400/d400-color.h @@ -53,6 +53,7 @@ namespace librealsense friend class d400_color_sensor; friend class rs435i_device; + friend class rs436i_device; friend class ds_color_common; uint8_t _color_device_idx = -1; diff --git a/src/ds/d400/d400-factory.cpp b/src/ds/d400/d400-factory.cpp index 44867a2e97..643d521bbf 100644 --- a/src/ds/d400/d400-factory.cpp +++ b/src/ds/d400/d400-factory.cpp @@ -951,6 +951,227 @@ namespace librealsense } }; + class rs436i_device : public d400_active, + public d400_color, + public d400_motion, + public ds_advanced_mode_base, + public firmware_logger_device + { + public: + rs436i_device(std::shared_ptr< const d400_info > const& dev_info, bool register_device_notifications) + : device(dev_info, register_device_notifications) + , backend_device(dev_info, register_device_notifications) + , d400_device(dev_info) + , d400_active(dev_info) + , d400_color(dev_info) + , d400_motion(dev_info) + , ds_advanced_mode_base(d400_device::_hw_monitor, get_depth_sensor()) + , firmware_logger_device( + dev_info, d400_device::_hw_monitor, get_firmware_logs_command(), get_flash_logs_command()) + { + check_and_restore_rgb_stream_extrinsic(); + if (_fw_version >= firmware_version(5, 16, 0, 0)) + register_feature( + std::make_shared< gyro_sensitivity_feature >(get_raw_motion_sensor(), get_motion_sensor())); + } + + + std::shared_ptr create_matcher(const frame_holder& frame) const override; + + std::vector get_profiles_tags() const override + { + std::vector tags; + auto usb_spec = get_usb_spec(); + bool usb3mode = (usb_spec >= platform::usb3_type || usb_spec == platform::usb_undefined); + + int depth_width = usb3mode ? 848 : 640; + int depth_height = usb3mode ? 480 : 480; + int color_width = usb3mode ? 1280 : 640; + int color_height = usb3mode ? 720 : 480; + int fps = usb3mode ? 30 : 15; + + tags.push_back({ RS2_STREAM_COLOR, -1, color_width, color_height, get_color_format(), fps, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + tags.push_back({ RS2_STREAM_DEPTH, -1, depth_width, depth_height, RS2_FORMAT_Z16, fps, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + tags.push_back({ RS2_STREAM_INFRARED, -1, depth_width, depth_height, RS2_FORMAT_Y8, fps, profile_tag::PROFILE_TAG_SUPERSET }); + tags.push_back({ RS2_STREAM_GYRO, -1, 0, 0, RS2_FORMAT_MOTION_XYZ32F, (int)odr::IMU_FPS_200, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + tags.push_back({ RS2_STREAM_ACCEL, -1, 0, 0, RS2_FORMAT_MOTION_XYZ32F, (int)odr::IMU_FPS_63, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + tags.push_back({ RS2_STREAM_ACCEL, -1, 0, 0, RS2_FORMAT_MOTION_XYZ32F, (int)odr::IMU_FPS_100, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT }); + return tags; + }; + bool compress_while_record() const override { return false; } + + private: + void check_and_restore_rgb_stream_extrinsic() + { + for (auto iter = 0, rec = 0; iter < 2; iter++, rec++) + { + std::vector< uint8_t > cal; + try + { + cal = *_color_calib_table_raw; + } + catch (...) + { + LOG_WARNING("Cannot read RGB calibration table"); + } + + if (!is_rgb_extrinsic_valid(cal) && !rec) + { + restore_rgb_extrinsic(); + } + else + break; + }; + } + + bool is_rgb_extrinsic_valid(const std::vector& raw_data) const + { + try + { + // verify extrinsic calibration table structure + auto table = ds::check_calib(raw_data); + + if ((table->header.version != 0 && table->header.version != 0xffff) && (table->header.table_size >= sizeof(ds::d400_rgb_calibration_table) - sizeof(ds::table_header))) + { + float3 trans_vector = table->translation_rect; + // Translation Heuristic tests + auto found = false; + for (auto i = 0; i < 3; i++) + { + //Nan/Infinity are not allowed + if (!std::isfinite(trans_vector[i])) + { + LOG_WARNING("RGB extrinsic - translation is corrupted: " << trans_vector); + return false; + } + // Translation must be assigned for at least one axis + if (std::fabs(trans_vector[i]) > std::numeric_limits::epsilon()) + found = true; + } + + if (!found) + { + LOG_WARNING("RGB extrinsic - invalid (zero) translation: " << trans_vector); + return false; + } + + // Rotation Heuristic tests + auto num_found = 0; + float3x3 rect_rot_mat = table->rotation_matrix_rect; + for (auto i = 0; i < 3; i++) + { + for (auto j = 0; j < 3; j++) + { + //Nan/Infinity are not allowed + if (!std::isfinite(rect_rot_mat(i, j))) + { + LOG_DEBUG("RGB extrinsic - rotation matrix corrupted:\n" << rect_rot_mat); + return false; + } + + if (std::fabs(rect_rot_mat(i, j)) > std::numeric_limits::epsilon()) + num_found++; + } + } + + bool res = (num_found >= 3); // At least three matrix indexes must be non-zero + if (!res) // At least three matrix indexes must be non-zero + LOG_DEBUG("RGB extrinsic - rotation matrix invalid:\n" << rect_rot_mat); + + return res; + } + else + { + LOG_WARNING("RGB extrinsic - header corrupted: " + << "Version: " << std::setfill('0') << std::setw(4) << std::hex << table->header.version + << ", type " << std::dec << table->header.table_type << ", size " << table->header.table_size); + return false; + } + } + catch (...) + { + return false; + } + } + + void assign_rgb_stream_extrinsic(const std::vector< uint8_t >& calib) + { + //write calibration to preset + command cmd(ds::fw_cmd::SETINTCALNEW, 0x20, 0x2); + cmd.data = calib; + d400_device::_hw_monitor->send(cmd); + } + + std::vector< uint8_t > read_sector(const uint32_t address, const uint16_t size) const + { + if (size > ds_advanced_mode_base::HW_MONITOR_COMMAND_SIZE) + throw std::runtime_error(rsutils::string::from() + << "Device memory read failed. max size: " + << int(ds_advanced_mode_base::HW_MONITOR_COMMAND_SIZE) + << ", requested: " << int(size)); + command cmd(ds::fw_cmd::FRB, address, size); + return d400_device::_hw_monitor->send(cmd); + } + + std::vector< uint8_t > read_rgb_gold() const + { + command cmd(ds::fw_cmd::LOADINTCAL, 0x20, 0x1); + return d400_device::_hw_monitor->send(cmd); + } + + std::vector< uint8_t > restore_calib_factory_settings() const + { + command cmd(ds::fw_cmd::CAL_RESTORE_DFLT); + return d400_device::_hw_monitor->send(cmd); + } + + void restore_rgb_extrinsic(void) + { + bool res = false; + LOG_WARNING("invalid RGB extrinsic was identified, recovery routine was invoked"); + try + { + if ((res = is_rgb_extrinsic_valid(read_rgb_gold()))) + { + restore_calib_factory_settings(); + } + else + { + if (_fw_version == firmware_version("5.11.6.200")) + { + const uint32_t gold_address = 0x17c49c; + const uint16_t bytes_to_read = 0x100; + auto alt_calib = read_sector(gold_address, bytes_to_read); + if ((res = is_rgb_extrinsic_valid(alt_calib))) + assign_rgb_stream_extrinsic(alt_calib); + else + res = false; + } + else + res = false; + } + + // Update device's internal state + if (res) + { + LOG_WARNING("RGB stream extrinsic successfully recovered"); + _color_calib_table_raw.reset(); + _color_extrinsic.get()->reset(); + environment::get_instance().get_extrinsics_graph().register_extrinsics(*_color_stream, *_depth_stream, _color_extrinsic); + } + else + { + LOG_ERROR("RGB Extrinsic recovery routine failed"); + _color_extrinsic.get()->reset(); + } + } + catch (...) + { + LOG_ERROR("RGB Extrinsic recovery routine failed"); + } + } + }; + class rs400_imu_device : public d400_motion, public ds_advanced_mode_base, public firmware_logger_device @@ -1161,6 +1382,8 @@ namespace librealsense return std::make_shared< rs435_device >( dev_info, register_device_notifications ); case RS435I_PID: return std::make_shared< rs435i_device >( dev_info, register_device_notifications ); + case RS436I_PID: + return std::make_shared< rs436i_device >(dev_info, register_device_notifications); case RS_USB2_PID: return std::make_shared< rs410_device >( dev_info, register_device_notifications ); case RS400_IMU_PID: @@ -1356,6 +1579,15 @@ namespace librealsense return matcher_factory::create(RS2_MATCHER_DEFAULT, streams); } + std::shared_ptr rs436i_device::create_matcher(const frame_holder& frame) const + { + std::vector streams = { _depth_stream.get() , _left_ir_stream.get() , _right_ir_stream.get(), _color_stream.get() }; + // TODO - A proper matcher for High-FPS sensor is required + std::vector mm_streams = { _ds_motion_common->get_accel_stream().get(), + _ds_motion_common->get_gyro_stream().get() }; + streams.insert(streams.end(), mm_streams.begin(), mm_streams.end()); + return matcher_factory::create(RS2_MATCHER_DEFAULT, streams); + } std::shared_ptr rs457_device::create_matcher(const frame_holder& frame) const { diff --git a/src/ds/d400/d400-private.cpp b/src/ds/d400/d400-private.cpp index 915fde7e5a..edca84eed9 100644 --- a/src/ds/d400/d400-private.cpp +++ b/src/ds/d400/d400-private.cpp @@ -40,6 +40,7 @@ namespace librealsense case RS430_MM_PID: case RS420_MM_PID: case RS435I_PID: + case RS436I_PID: case RS455_PID: found = (result.mi == 6); break; diff --git a/src/ds/d400/d400-private.h b/src/ds/d400/d400-private.h index c7ea54c5f6..dddff6ca6f 100644 --- a/src/ds/d400/d400-private.h +++ b/src/ds/d400/d400-private.h @@ -30,6 +30,7 @@ namespace librealsense const uint16_t RS430_MM_RGB_PID = 0x0b01; // AWGCT const uint16_t RS460_PID = 0x0b03; // DS5U const uint16_t RS435_RGB_PID = 0x0b07; // AWGC + const uint16_t RS436I_PID = 0x1156; // D436i const uint16_t RS405U_PID = 0x0b0c; // DS5U const uint16_t RS435I_PID = 0x0b3a; // D435i const uint16_t RS416_PID = 0x0b49; // F416 @@ -57,6 +58,7 @@ namespace librealsense ds::RS430_MM_RGB_PID, ds::RS460_PID, ds::RS435_RGB_PID, + ds::RS436I_PID, ds::RS405U_PID, ds::RS435I_PID, ds::RS416_RGB_PID, @@ -75,6 +77,7 @@ namespace librealsense ds::RS430_MM_PID, ds::RS430_MM_RGB_PID, ds::RS435_RGB_PID, + ds::RS436I_PID, ds::RS435I_PID, ds::RS455_PID, ds::RS457_PID @@ -86,12 +89,14 @@ namespace librealsense static const std::set d400_hid_sensors_pid = { ds::RS435I_PID, + ds::RS436I_PID, ds::RS430I_PID, ds::RS455_PID }; static const std::set d400_hid_bmi_055_pid = { ds::RS435I_PID, + ds::RS436I_PID, ds::RS430I_PID, ds::RS455_PID }; @@ -124,6 +129,7 @@ namespace librealsense { RS430_MM_RGB_PID, "Intel RealSense D430 with Tracking and RGB Modules"}, { RS460_PID, "Intel RealSense D460" }, { RS435_RGB_PID, "Intel RealSense D435"}, + { RS436I_PID, "Intel RealSense D436I"}, { RS405U_PID, "Intel RealSense DS5U" }, { RS435I_PID, "Intel RealSense D435I" }, { RS416_PID, "Intel RealSense F416"}, @@ -155,6 +161,7 @@ namespace librealsense {RS435_RGB_PID, "5.8.15.0" }, {RS405U_PID, "5.8.15.0" }, {RS435I_PID, "5.12.7.100" }, + {RS436I_PID, "5.16.3.100" }, {RS416_PID, "5.8.15.0" }, {RS430I_PID, "5.8.15.0" }, {RS416_RGB_PID, "5.8.15.0" }, diff --git a/src/ds/ds-calib-parsers.cpp b/src/ds/ds-calib-parsers.cpp index c9dee14cce..0463a40bad 100644 --- a/src/ds/ds-calib-parsers.cpp +++ b/src/ds/ds-calib-parsers.cpp @@ -152,7 +152,7 @@ namespace librealsense // predefined platform specific extrinsic, IMU assembly transformation based on mechanical drawing (meters) rs2_extrinsics _def_extr; - if (_pid == ds::RS435I_PID) + if (_pid == ds::RS435I_PID || _pid == ds::RS436I_PID) { // D435i specific - Bosch BMI055 _def_extr = { { 1, 0, 0, 0, 1, 0, 0, 0, 1 }, { -0.00552f, 0.0051f, 0.01174f} }; From 1c9b8729e900b868381eaa43720d1fae43e54a54 Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Wed, 25 Dec 2024 11:29:59 +0200 Subject: [PATCH 02/11] adding 36i to linux patch - noble, kernel 6.8 --- .../realsense-metadata-noble-hwe-6.8.patch | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/realsense-metadata-noble-hwe-6.8.patch b/scripts/realsense-metadata-noble-hwe-6.8.patch index 7374ac88d9..9bf7055ee0 100644 --- a/scripts/realsense-metadata-noble-hwe-6.8.patch +++ b/scripts/realsense-metadata-noble-hwe-6.8.patch @@ -1,20 +1,29 @@ -From 25a687e89e8f365caccef1b9bbb11406e53cc1be Mon Sep 17 00:00:00 2001 +From 72ad58529ed26a3b4a61c394a53d5c3caa1be141 Mon Sep 17 00:00:00 2001 From: Arun-Prasad-V Date: Mon, 5 Aug 2024 15:02:57 +0530 Subject: [PATCH] Realsense camera metadata support for kernel 6.8 --- - drivers/media/usb/uvc/uvc_driver.c | 36 ++++++++++++++++++++++++++++++ - 1 file changed, 36 insertions(+) + drivers/media/usb/uvc/uvc_driver.c | 45 ++++++++++++++++++++++++++++++ + 1 file changed, 45 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index bbd90123a..1cd98a8cc 100644 +index 04e7f5855..9a0f49b9e 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -3102,6 +3102,15 @@ static const struct usb_device_id uvc_ids[] = { +@@ -3165,6 +3165,24 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, ++ /* Intel D436i Depth Camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x8086, ++ .idProduct = 0x1156, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = UVC_PC_PROTOCOL_15, ++ .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, + /* Intel D555 Depth Camera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, @@ -27,7 +36,7 @@ index bbd90123a..1cd98a8cc 100644 /* Intel D405 Depth Camera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, -@@ -3120,6 +3129,33 @@ static const struct usb_device_id uvc_ids[] = { +@@ -3183,6 +3201,33 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, From c69caa12ee6625208a1e3e3146e8c6cc020f0058 Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Sun, 29 Dec 2024 09:52:20 +0200 Subject: [PATCH 03/11] adding 36i to linux patch, jammy, kernel 6.5 --- .../realsense-metadata-jammy-hwe-6.5.patch | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/scripts/realsense-metadata-jammy-hwe-6.5.patch b/scripts/realsense-metadata-jammy-hwe-6.5.patch index 22402260a7..04aef03c6c 100644 --- a/scripts/realsense-metadata-jammy-hwe-6.5.patch +++ b/scripts/realsense-metadata-jammy-hwe-6.5.patch @@ -1,18 +1,34 @@ -From cd69befded13738c855bb40b99dbee24676f0a41 Mon Sep 17 00:00:00 2001 +From 4b8a3b2cbe9d0f658e72e62b13f5b6ee756372dd Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sun, 7 Jul 2024 04:56:36 -0400 Subject: [PATCH] RealSense UVC Metadata, jammy kernel 6.5 Signed-off-by: Dmitry --- - drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ - 1 file changed, 9 insertions(+) + drivers/media/usb/uvc/uvc_driver.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index fb3e43dde..b04271d30 100644 +index 7b6479dac..bc92234db 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -3147,6 +3147,15 @@ static const struct usb_device_id uvc_ids[] = { +@@ -3084,6 +3084,15 @@ static const struct usb_device_id uvc_ids[] = { + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, ++ /* Intel D436i depth camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x8086, ++ .idProduct = 0x1156, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = 0, ++ .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, + /* Intel D555 Depth Camera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, +@@ -3129,6 +3138,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = UVC_PC_PROTOCOL_15, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, From d3dcc6a2dd9d9a001ee7cf1f409fc9e35359c191 Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Sun, 29 Dec 2024 11:42:37 +0200 Subject: [PATCH 04/11] adding 36i linux patch, jammy, kernel 5.19 --- scripts/realsense-metadata-jammy-master.patch | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/realsense-metadata-jammy-master.patch b/scripts/realsense-metadata-jammy-master.patch index db1e37df55..ea7d8e3019 100644 --- a/scripts/realsense-metadata-jammy-master.patch +++ b/scripts/realsense-metadata-jammy-master.patch @@ -1,4 +1,4 @@ -From f8c4dca6a001d42a79a2a7a5d9fc4748bb5df25c Mon Sep 17 00:00:00 2001 +From a2acb950b65b4a8e87451c28dd5a1a6bdaaa7ab6 Mon Sep 17 00:00:00 2001 From: Dmitry Perchanov Date: Sun, 22 Jan 2023 12:58:19 +0200 Subject: [PATCH] Enabling UVC Metadata attributes with Ubuntu 22.04. Kernel @@ -8,15 +8,15 @@ Co-developed-by: Yu MENG Co-developed-by: Evgeni Raikhel Signed-off-by: Dmitry Perchanov --- - drivers/media/usb/uvc/uvc_driver.c | 288 +++++++++++++++++++++++++++++ + drivers/media/usb/uvc/uvc_driver.c | 297 +++++++++++++++++++++++++++++ drivers/media/usb/uvc/uvcvideo.h | 2 +- - 2 files changed, 289 insertions(+), 1 deletion(-) + 2 files changed, 298 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index caed9a2ab..c6763420b 100644 +index caed9a2ab..e72113059 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -3234,6 +3234,294 @@ static const struct usb_device_id uvc_ids[] = { +@@ -3234,6 +3234,303 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, @@ -191,6 +191,15 @@ index caed9a2ab..c6763420b 100644 + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, ++ /* Intel D436i depth camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x8086, ++ .idProduct = 0x1156, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = 0, ++ .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, + /* Intel L515 Pre-PRQ */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, @@ -312,7 +321,7 @@ index caed9a2ab..c6763420b 100644 { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) }, { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) }, diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h -index 20782860d..f469327d9 100644 +index 186191290..112b7ea22 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -224,7 +224,7 @@ From f6d1ddd40276c9ca661fa2101f63d546ac8dbd19 Mon Sep 17 00:00:00 2001 From: SamerKhshiboun Date: Sun, 29 Dec 2024 12:01:42 +0200 Subject: [PATCH 05/11] adding 36i linux patch, focal, kernel 5.15 --- .../realsense-metadata-focal-hwe-5.15.patch | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/realsense-metadata-focal-hwe-5.15.patch b/scripts/realsense-metadata-focal-hwe-5.15.patch index 33a3452bdc..febd3d9e3c 100644 --- a/scripts/realsense-metadata-focal-hwe-5.15.patch +++ b/scripts/realsense-metadata-focal-hwe-5.15.patch @@ -1,4 +1,4 @@ -From 1d10a22a198d8b54c252de46efd4b05396bc0aed Mon Sep 17 00:00:00 2001 +From 32b0a7afe8c609472f447adfb726a5e42ea99d17 Mon Sep 17 00:00:00 2001 From: Dmitry Perchanov Date: Sun, 22 Jan 2023 13:46:16 +0200 Subject: [PATCH] Enabling UVC Metadata attributes with Ubuntu 20.04. Kernel @@ -8,15 +8,15 @@ Co-developed-by: Yu MENG Co-developed-by: Evgeni Raikhel Signed-off-by: Dmitry Perchanov --- - drivers/media/usb/uvc/uvc_driver.c | 288 +++++++++++++++++++++++++++++ + drivers/media/usb/uvc/uvc_driver.c | 297 +++++++++++++++++++++++++++++ drivers/media/usb/uvc/uvcvideo.h | 2 +- - 2 files changed, 289 insertions(+), 1 deletion(-) + 2 files changed, 298 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index 2816f79ef..81b86da7c 100644 +index 0e3a8b38c..fcf0159d8 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -3221,6 +3221,294 @@ static const struct usb_device_id uvc_ids[] = { +@@ -3215,6 +3215,303 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, @@ -191,6 +191,15 @@ index 2816f79ef..81b86da7c 100644 + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, ++ /* Intel D436i depth camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x8086, ++ .idProduct = 0x1156, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = 0, ++ .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, + /* Intel L515 Pre-PRQ */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, @@ -312,7 +321,7 @@ index 2816f79ef..81b86da7c 100644 { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) }, { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) }, diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h -index 098cc8fa4..5d252335c 100644 +index 242fa9352..0b7067c1d 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -221,7 +221,7 @@ From 352595cab05efce32df192ad6ee764e6c27fd8b1 Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Tue, 31 Dec 2024 10:51:09 +0200 Subject: [PATCH 06/11] adding 36i linux patch, jammy, kernel 6.8 --- .../realsense-metadata-jammy-hwe-6.8.patch | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/scripts/realsense-metadata-jammy-hwe-6.8.patch b/scripts/realsense-metadata-jammy-hwe-6.8.patch index 7374ac88d9..6387f40b67 100644 --- a/scripts/realsense-metadata-jammy-hwe-6.8.patch +++ b/scripts/realsense-metadata-jammy-hwe-6.8.patch @@ -1,20 +1,29 @@ -From 25a687e89e8f365caccef1b9bbb11406e53cc1be Mon Sep 17 00:00:00 2001 +From bf995360a83d28d88308c811a4e91c21b3cdd1e1 Mon Sep 17 00:00:00 2001 From: Arun-Prasad-V Date: Mon, 5 Aug 2024 15:02:57 +0530 Subject: [PATCH] Realsense camera metadata support for kernel 6.8 --- - drivers/media/usb/uvc/uvc_driver.c | 36 ++++++++++++++++++++++++++++++ - 1 file changed, 36 insertions(+) + drivers/media/usb/uvc/uvc_driver.c | 45 ++++++++++++++++++++++++++++++ + 1 file changed, 45 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index bbd90123a..1cd98a8cc 100644 +index 91a41aa3c..bc04a3182 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -3102,6 +3102,15 @@ static const struct usb_device_id uvc_ids[] = { +@@ -3133,6 +3133,24 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, ++ /* Intel D436i depth camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x8086, ++ .idProduct = 0x1156, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = 0, ++ .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, + /* Intel D555 Depth Camera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, @@ -27,7 +36,7 @@ index bbd90123a..1cd98a8cc 100644 /* Intel D405 Depth Camera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, -@@ -3120,6 +3129,33 @@ static const struct usb_device_id uvc_ids[] = { +@@ -3151,6 +3169,33 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, @@ -62,5 +71,5 @@ index bbd90123a..1cd98a8cc 100644 { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) }, { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) }, -- -2.43.0 +2.34.1 From 9aee1f52e481fd5c7a261aa033e93218a571675c Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Tue, 31 Dec 2024 13:40:34 +0200 Subject: [PATCH 07/11] adding 36i to linux patch, jammy, kernel 6.2 --- .../realsense-metadata-jammy-hwe-6.2.patch | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/scripts/realsense-metadata-jammy-hwe-6.2.patch b/scripts/realsense-metadata-jammy-hwe-6.2.patch index 1b8394d9bc..cd5671e93c 100644 --- a/scripts/realsense-metadata-jammy-hwe-6.2.patch +++ b/scripts/realsense-metadata-jammy-hwe-6.2.patch @@ -1,4 +1,4 @@ -From 3df5a4700229bd76b6c460e0b26529637f3ed172 Mon Sep 17 00:00:00 2001 +From c66fc5a4acc09b51d5ad0cf9b1c9cfc07b595b16 Mon Sep 17 00:00:00 2001 From: Dmitry Perchanov Date: Sun, 13 Aug 2023 12:13:21 +0300 Subject: [PATCH] Enabling UVC Metadata attributes, Ubuntu jammy 22.04. Kernel @@ -6,15 +6,15 @@ Subject: [PATCH] Enabling UVC Metadata attributes, Ubuntu jammy 22.04. Kernel Signed-off-by: Dmitry Perchanov --- - drivers/media/usb/uvc/uvc_driver.c | 99 ++++++++++++++++++++++++++++++ - drivers/media/usb/uvc/uvcvideo.h | 2 +- - 2 files changed, 100 insertions(+), 1 deletion(-) + drivers/media/usb/uvc/uvc_driver.c | 108 +++++++++++++++++++++++++++++ + drivers/media/usb/uvc/uvcvideo.h | 2 +- + 2 files changed, 109 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index 362df9dd3..3fedf65ab 100644 +index 5ab3fc04c..6b1c6153b 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -2963,6 +2963,33 @@ static const struct usb_device_id uvc_ids[] = { +@@ -2969,6 +2969,33 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited }, @@ -48,7 +48,7 @@ index 362df9dd3..3fedf65ab 100644 /* Intel RealSense D4M */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, -@@ -2972,6 +2999,78 @@ static const struct usb_device_id uvc_ids[] = { +@@ -2978,6 +3005,87 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, @@ -70,6 +70,15 @@ index 362df9dd3..3fedf65ab 100644 + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, ++ /* Intel D436i depth camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x8086, ++ .idProduct = 0x1156, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = 0, ++ .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, + /* Intel D555 Depth Camera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, From b6df50f279c131c384a174d80def1e89a6c7513a Mon Sep 17 00:00:00 2001 From: SamerKhshiboun Date: Tue, 31 Dec 2024 14:03:35 +0200 Subject: [PATCH 08/11] adding 36i linux patch, focal, kernel 5.13 --- .../realsense-metadata-focal-hwe-5.13.patch | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/realsense-metadata-focal-hwe-5.13.patch b/scripts/realsense-metadata-focal-hwe-5.13.patch index ad24cbce6d..da1df1acc5 100644 --- a/scripts/realsense-metadata-focal-hwe-5.13.patch +++ b/scripts/realsense-metadata-focal-hwe-5.13.patch @@ -1,4 +1,4 @@ -From 7480bd53bd1af5a11fc890e6b9a1a2991bfa6a28 Mon Sep 17 00:00:00 2001 +From ddde28a28ea29750a7a9cf486d8f46283c755745 Mon Sep 17 00:00:00 2001 From: Dmitry Perchanov Date: Sun, 22 Jan 2023 13:46:16 +0200 Subject: [PATCH] Enabling UVC Metadata attributes with Ubuntu 20.04. Kernel @@ -8,15 +8,15 @@ Co-developed-by: Yu MENG Co-developed-by: Evgeni Raikhel Signed-off-by: Dmitry Perchanov --- - drivers/media/usb/uvc/uvc_driver.c | 288 +++++++++++++++++++++++++++++ + drivers/media/usb/uvc/uvc_driver.c | 297 +++++++++++++++++++++++++++++ drivers/media/usb/uvc/uvcvideo.h | 2 +- - 2 files changed, 289 insertions(+), 1 deletion(-) + 2 files changed, 298 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index 205d52412..e167ec854 100644 +index 205d52412..622c8bc06 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -3221,6 +3221,294 @@ static const struct usb_device_id uvc_ids[] = { +@@ -3221,6 +3221,303 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, @@ -191,6 +191,15 @@ index 205d52412..e167ec854 100644 + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, ++ /* Intel D436i depth camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x8086, ++ .idProduct = 0x1156, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = 0, ++ .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, + /* Intel L515 Pre-PRQ */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, From 8700357e87eaf5f07174df07b2b3aa6ac5ceed7f Mon Sep 17 00:00:00 2001 From: SamerKhshiboun Date: Tue, 31 Dec 2024 14:59:05 +0200 Subject: [PATCH 09/11] adding 36i linux patch, focal, kernel 5.11 --- scripts/realsense-metadata-focal-master.patch | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/realsense-metadata-focal-master.patch b/scripts/realsense-metadata-focal-master.patch index ddf5eb17f4..e72c6f73e6 100644 --- a/scripts/realsense-metadata-focal-master.patch +++ b/scripts/realsense-metadata-focal-master.patch @@ -1,4 +1,4 @@ -From e6e4fd91cdfdb0b9cbb439916ebd12d61f1ff1b4 Mon Sep 17 00:00:00 2001 +From 4219d7a6e4f4c9c2b063402b167f1288dabba0ca Mon Sep 17 00:00:00 2001 From: Dmitry Perchanov Date: Mon, 21 Aug 2023 15:10:57 +0300 Subject: [PATCH] Enabling UVC Metadata attributes with Ubuntu 20.04. Kernel @@ -7,15 +7,15 @@ Subject: [PATCH] Enabling UVC Metadata attributes with Ubuntu 20.04. Kernel Co-developed-by: Evgeni Raikhel Signed-off-by: Dmitry Perchanov --- - drivers/media/usb/uvc/uvc_driver.c | 279 +++++++++++++++++++++++++++++ + drivers/media/usb/uvc/uvc_driver.c | 288 +++++++++++++++++++++++++++++ drivers/media/usb/uvc/uvcvideo.h | 2 +- - 2 files changed, 280 insertions(+), 1 deletion(-) + 2 files changed, 289 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c -index 3be9bc97f..386832678 100644 +index b77eef67d..c0b9bd21a 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c -@@ -2916,6 +2916,285 @@ static const struct usb_device_id uvc_ids[] = { +@@ -3029,6 +3029,294 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, @@ -190,6 +190,15 @@ index 3be9bc97f..386832678 100644 + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, ++ /* Intel D436i depth camera */ ++ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE ++ | USB_DEVICE_ID_MATCH_INT_INFO, ++ .idVendor = 0x8086, ++ .idProduct = 0x1156, ++ .bInterfaceClass = USB_CLASS_VIDEO, ++ .bInterfaceSubClass = 1, ++ .bInterfaceProtocol = 0, ++ .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, + /* Intel L515 Pre-PRQ */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, @@ -302,10 +311,10 @@ index 3be9bc97f..386832678 100644 { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) }, { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) }, diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h -index a3dfacf06..898eebe42 100644 +index ced37a11a..01a3923b3 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h -@@ -181,7 +181,7 @@ +@@ -215,7 +215,7 @@ /* Maximum number of packets per URB. */ #define UVC_MAX_PACKETS 32 /* Maximum status buffer size in bytes of interrupt URB. */ @@ -315,5 +324,5 @@ index a3dfacf06..898eebe42 100644 #define UVC_CTRL_CONTROL_TIMEOUT 500 #define UVC_CTRL_STREAMING_TIMEOUT 5000 -- -2.34.1 +2.25.1 From 2d561a04f4fc75f000a3d05cf98fdedf8b29d381 Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Thu, 2 Jan 2025 10:18:02 +0200 Subject: [PATCH 10/11] cr and removing extrinsics restoring methods from 36i --- src/ds/d400/d400-color.h | 1 - src/ds/d400/d400-factory.cpp | 176 +---------------------------------- src/ds/d400/d400-private.h | 2 +- src/gl/camera-shader.cpp | 3 +- 4 files changed, 4 insertions(+), 178 deletions(-) diff --git a/src/ds/d400/d400-color.h b/src/ds/d400/d400-color.h index 634de348fe..67ed3904a7 100644 --- a/src/ds/d400/d400-color.h +++ b/src/ds/d400/d400-color.h @@ -53,7 +53,6 @@ namespace librealsense friend class d400_color_sensor; friend class rs435i_device; - friend class rs436i_device; friend class ds_color_common; uint8_t _color_device_idx = -1; diff --git a/src/ds/d400/d400-factory.cpp b/src/ds/d400/d400-factory.cpp index 643d521bbf..832f861287 100644 --- a/src/ds/d400/d400-factory.cpp +++ b/src/ds/d400/d400-factory.cpp @@ -969,10 +969,7 @@ namespace librealsense , firmware_logger_device( dev_info, d400_device::_hw_monitor, get_firmware_logs_command(), get_flash_logs_command()) { - check_and_restore_rgb_stream_extrinsic(); - if (_fw_version >= firmware_version(5, 16, 0, 0)) - register_feature( - std::make_shared< gyro_sensitivity_feature >(get_raw_motion_sensor(), get_motion_sensor())); + register_feature(std::make_shared< gyro_sensitivity_feature >(get_raw_motion_sensor(), get_motion_sensor())); } @@ -999,177 +996,6 @@ namespace librealsense return tags; }; bool compress_while_record() const override { return false; } - - private: - void check_and_restore_rgb_stream_extrinsic() - { - for (auto iter = 0, rec = 0; iter < 2; iter++, rec++) - { - std::vector< uint8_t > cal; - try - { - cal = *_color_calib_table_raw; - } - catch (...) - { - LOG_WARNING("Cannot read RGB calibration table"); - } - - if (!is_rgb_extrinsic_valid(cal) && !rec) - { - restore_rgb_extrinsic(); - } - else - break; - }; - } - - bool is_rgb_extrinsic_valid(const std::vector& raw_data) const - { - try - { - // verify extrinsic calibration table structure - auto table = ds::check_calib(raw_data); - - if ((table->header.version != 0 && table->header.version != 0xffff) && (table->header.table_size >= sizeof(ds::d400_rgb_calibration_table) - sizeof(ds::table_header))) - { - float3 trans_vector = table->translation_rect; - // Translation Heuristic tests - auto found = false; - for (auto i = 0; i < 3; i++) - { - //Nan/Infinity are not allowed - if (!std::isfinite(trans_vector[i])) - { - LOG_WARNING("RGB extrinsic - translation is corrupted: " << trans_vector); - return false; - } - // Translation must be assigned for at least one axis - if (std::fabs(trans_vector[i]) > std::numeric_limits::epsilon()) - found = true; - } - - if (!found) - { - LOG_WARNING("RGB extrinsic - invalid (zero) translation: " << trans_vector); - return false; - } - - // Rotation Heuristic tests - auto num_found = 0; - float3x3 rect_rot_mat = table->rotation_matrix_rect; - for (auto i = 0; i < 3; i++) - { - for (auto j = 0; j < 3; j++) - { - //Nan/Infinity are not allowed - if (!std::isfinite(rect_rot_mat(i, j))) - { - LOG_DEBUG("RGB extrinsic - rotation matrix corrupted:\n" << rect_rot_mat); - return false; - } - - if (std::fabs(rect_rot_mat(i, j)) > std::numeric_limits::epsilon()) - num_found++; - } - } - - bool res = (num_found >= 3); // At least three matrix indexes must be non-zero - if (!res) // At least three matrix indexes must be non-zero - LOG_DEBUG("RGB extrinsic - rotation matrix invalid:\n" << rect_rot_mat); - - return res; - } - else - { - LOG_WARNING("RGB extrinsic - header corrupted: " - << "Version: " << std::setfill('0') << std::setw(4) << std::hex << table->header.version - << ", type " << std::dec << table->header.table_type << ", size " << table->header.table_size); - return false; - } - } - catch (...) - { - return false; - } - } - - void assign_rgb_stream_extrinsic(const std::vector< uint8_t >& calib) - { - //write calibration to preset - command cmd(ds::fw_cmd::SETINTCALNEW, 0x20, 0x2); - cmd.data = calib; - d400_device::_hw_monitor->send(cmd); - } - - std::vector< uint8_t > read_sector(const uint32_t address, const uint16_t size) const - { - if (size > ds_advanced_mode_base::HW_MONITOR_COMMAND_SIZE) - throw std::runtime_error(rsutils::string::from() - << "Device memory read failed. max size: " - << int(ds_advanced_mode_base::HW_MONITOR_COMMAND_SIZE) - << ", requested: " << int(size)); - command cmd(ds::fw_cmd::FRB, address, size); - return d400_device::_hw_monitor->send(cmd); - } - - std::vector< uint8_t > read_rgb_gold() const - { - command cmd(ds::fw_cmd::LOADINTCAL, 0x20, 0x1); - return d400_device::_hw_monitor->send(cmd); - } - - std::vector< uint8_t > restore_calib_factory_settings() const - { - command cmd(ds::fw_cmd::CAL_RESTORE_DFLT); - return d400_device::_hw_monitor->send(cmd); - } - - void restore_rgb_extrinsic(void) - { - bool res = false; - LOG_WARNING("invalid RGB extrinsic was identified, recovery routine was invoked"); - try - { - if ((res = is_rgb_extrinsic_valid(read_rgb_gold()))) - { - restore_calib_factory_settings(); - } - else - { - if (_fw_version == firmware_version("5.11.6.200")) - { - const uint32_t gold_address = 0x17c49c; - const uint16_t bytes_to_read = 0x100; - auto alt_calib = read_sector(gold_address, bytes_to_read); - if ((res = is_rgb_extrinsic_valid(alt_calib))) - assign_rgb_stream_extrinsic(alt_calib); - else - res = false; - } - else - res = false; - } - - // Update device's internal state - if (res) - { - LOG_WARNING("RGB stream extrinsic successfully recovered"); - _color_calib_table_raw.reset(); - _color_extrinsic.get()->reset(); - environment::get_instance().get_extrinsics_graph().register_extrinsics(*_color_stream, *_depth_stream, _color_extrinsic); - } - else - { - LOG_ERROR("RGB Extrinsic recovery routine failed"); - _color_extrinsic.get()->reset(); - } - } - catch (...) - { - LOG_ERROR("RGB Extrinsic recovery routine failed"); - } - } }; class rs400_imu_device : public d400_motion, diff --git a/src/ds/d400/d400-private.h b/src/ds/d400/d400-private.h index dddff6ca6f..4afea9034a 100644 --- a/src/ds/d400/d400-private.h +++ b/src/ds/d400/d400-private.h @@ -161,7 +161,7 @@ namespace librealsense {RS435_RGB_PID, "5.8.15.0" }, {RS405U_PID, "5.8.15.0" }, {RS435I_PID, "5.12.7.100" }, - {RS436I_PID, "5.16.3.100" }, + {RS436I_PID, "5.16.3.100" }, // TODO - update final required FW version {RS416_PID, "5.8.15.0" }, {RS430I_PID, "5.8.15.0" }, {RS416_RGB_PID, "5.8.15.0" }, diff --git a/src/gl/camera-shader.cpp b/src/gl/camera-shader.cpp index 8f8a072540..c32b67f29d 100644 --- a/src/gl/camera-shader.cpp +++ b/src/gl/camera-shader.cpp @@ -164,7 +164,8 @@ namespace librealsense { auto dev_name = dev.get_info(RS2_CAMERA_INFO_NAME); if (starts_with(dev_name, "Intel RealSense D415")) index = 0; - if (starts_with(dev_name, "Intel RealSense D435")) index = 1; + if (starts_with(dev_name, "Intel RealSense D435") || + starts_with(dev_name, "Intel RealSense D436")) index = 1; if (starts_with(dev_name, "Intel RealSense D45")) index = 2; }; From 23e132664d1311591f2bfdfe27b44467bbc40df9 Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Thu, 2 Jan 2025 10:32:56 +0200 Subject: [PATCH 11/11] visual preset from 435 depth and 455 color --- src/ds/advanced_mode/advanced_mode.cpp | 4 +- src/ds/advanced_mode/presets.cpp | 130 +++++++++++++++---------- src/ds/advanced_mode/presets.h | 1 + 3 files changed, 82 insertions(+), 53 deletions(-) diff --git a/src/ds/advanced_mode/advanced_mode.cpp b/src/ds/advanced_mode/advanced_mode.cpp index a218b0610f..4a19e39508 100644 --- a/src/ds/advanced_mode/advanced_mode.cpp +++ b/src/ds/advanced_mode/advanced_mode.cpp @@ -114,9 +114,11 @@ namespace librealsense case ds::RS430I_PID: case ds::RS435_RGB_PID: case ds::RS435I_PID: - case ds::RS436I_PID: default_430(p); break; + case ds::RS436I_PID: + default_436(p); + break; case ds::RS455_PID: case ds::RS457_PID: case ds::D555_PID: diff --git a/src/ds/advanced_mode/presets.cpp b/src/ds/advanced_mode/presets.cpp index 46435c8aa3..7d2813bc4a 100644 --- a/src/ds/advanced_mode/presets.cpp +++ b/src/ds/advanced_mode/presets.cpp @@ -361,7 +361,41 @@ namespace librealsense p.depth_gain.gain = 16.f; } - void default_430(preset& p) + void default_430_color_only(preset& p) + { + p.color_control.disableRAUColor = 0; + p.color_control.disableSADColor = 0; + p.color_control.disableSADNormalize = 0; + p.color_control.disableSLOLeftColor = 0; + p.color_control.disableSLORightColor = 0; + p.cc.colorCorrection1 = 0.298828f; + p.cc.colorCorrection2 = 0.293945f; + p.cc.colorCorrection3 = 0.293945f; + p.cc.colorCorrection4 = 0.114258f; + p.cc.colorCorrection5 = 0.f; + p.cc.colorCorrection6 = 0.f; + p.cc.colorCorrection7 = 0.f; + p.cc.colorCorrection8 = 0.f; + p.cc.colorCorrection9 = 0.f; + p.cc.colorCorrection10 = 0.f; + p.cc.colorCorrection11 = 0.f; + p.cc.colorCorrection12 = 0.f; + p.color_auto_exposure.auto_exposure = 1; + p.color_exposure.exposure = 156; + p.color_backlight_compensation.backlight_compensation = 0; + p.color_brightness.brightness = 0; + p.color_contrast.contrast = 50; + p.color_gain.gain = 64; + p.color_gamma.gamma = 300; + p.color_hue.hue = 0; + p.color_power_line_frequency.power_line_frequency = 3; + p.color_saturation.saturation = 64; + p.color_sharpness.sharpness = 50; + p.color_auto_white_balance.auto_white_balance = 1; + p.color_white_balance.white_balance = 4600; + } + + void default_430_except_color(preset& p) { p.depth_controls.deepSeaMedianThreshold = 500; p.depth_controls.deepSeaNeighborThreshold = 7; @@ -385,11 +419,6 @@ namespace librealsense p.rsvc.minWEsum = 3; p.rsvc.uShrink = 3; p.rsvc.vShrink = 1; - p.color_control.disableRAUColor = 0; - p.color_control.disableSADColor = 0; - p.color_control.disableSADNormalize = 0; - p.color_control.disableSLOLeftColor = 0; - p.color_control.disableSLORightColor = 0; p.rctc.rauDiffThresholdBlue = 51; p.rctc.rauDiffThresholdGreen = 51; p.rctc.rauDiffThresholdRed = 51; @@ -404,18 +433,6 @@ namespace librealsense p.spc.sloK2PenaltyMod2 = 130; p.hdad.lambdaAD = 800.f; p.hdad.lambdaCensus = 26.f; - p.cc.colorCorrection1 = 0.298828f; - p.cc.colorCorrection2 = 0.293945f; - p.cc.colorCorrection3 = 0.293945f; - p.cc.colorCorrection4 = 0.114258f; - p.cc.colorCorrection5 = 0.f; - p.cc.colorCorrection6 = 0.f; - p.cc.colorCorrection7 = 0.f; - p.cc.colorCorrection8 = 0.f; - p.cc.colorCorrection9 = 0.f; - p.cc.colorCorrection10 = 0.f; - p.cc.colorCorrection11 = 0.f; - p.cc.colorCorrection12 = 0.f; p.depth_table.depthClampMax = 65536; p.depth_table.depthClampMin = 0; p.depth_table.depthUnits = 1000; @@ -427,31 +444,23 @@ namespace librealsense p.laser_power.laser_power = 150.f; p.depth_exposure.exposure = 8500.f; p.depth_auto_exposure.auto_exposure = 1; - p.color_auto_exposure.auto_exposure = 1; - p.color_exposure.exposure = 156; - p.color_backlight_compensation.backlight_compensation = 0; - p.color_brightness.brightness = 0; - p.color_contrast.contrast = 50; - p.color_gain.gain = 64; - p.color_gamma.gamma = 300; - p.color_hue.hue = 0; - p.color_power_line_frequency.power_line_frequency = 3; - p.color_saturation.saturation = 64; - p.color_sharpness.sharpness = 50; - p.color_auto_white_balance.auto_white_balance = 1; - p.color_white_balance.white_balance = 4600; p.depth_gain.gain = 16.f; p.hdad.ignoreSAD = 0; p.amplitude_factor.amplitude = 0.f; } + + void default_430(preset& p) + { + default_430_except_color(p); + default_430_color_only(p); + } // the only different between high res to mid & low is the amplitude_factor value void default_450_high_res(preset& p) { p.amplitude_factor.amplitude = 0.f; } - //used as base preset for the D450 - void default_450_mid_low_res(preset& p) + void default_450_mid_low_res_except_color(preset& p) { p.depth_controls.deepSeaMedianThreshold = 500; p.depth_controls.deepSeaNeighborThreshold = 7; @@ -475,11 +484,6 @@ namespace librealsense p.rsvc.minWEsum = 3; p.rsvc.uShrink = 3; p.rsvc.vShrink = 1; - p.color_control.disableRAUColor = 0; - p.color_control.disableSADColor = 0; - p.color_control.disableSADNormalize = 0; - p.color_control.disableSLOLeftColor = 0; - p.color_control.disableSLORightColor = 0; p.rctc.rauDiffThresholdBlue = 51; p.rctc.rauDiffThresholdGreen = 51; p.rctc.rauDiffThresholdRed = 51; @@ -494,6 +498,29 @@ namespace librealsense p.spc.sloK2PenaltyMod2 = 130; p.hdad.lambdaAD = 800.f; p.hdad.lambdaCensus = 26.f; + p.depth_table.depthClampMax = 65536; + p.depth_table.depthClampMin = 0; + p.depth_table.depthUnits = 1000; + p.depth_table.disparityShift = 0; + p.ae.meanIntensitySetPoint = 1000; + p.census.uDiameter = 9; + p.census.vDiameter = 9; + p.laser_state.laser_state = 1; + p.laser_power.laser_power = 150.f; + p.depth_exposure.exposure = 8500.f; + p.depth_auto_exposure.auto_exposure = 1; + p.depth_gain.gain = 16.f; + p.hdad.ignoreSAD = 0; + p.amplitude_factor.amplitude = 0.08f; + } + + void default_450_mid_low_res_color_only(preset& p) + { + p.color_control.disableRAUColor = 0; + p.color_control.disableSADColor = 0; + p.color_control.disableSADNormalize = 0; + p.color_control.disableSLOLeftColor = 0; + p.color_control.disableSLORightColor = 0; p.cc.colorCorrection1 = -0.493164f; p.cc.colorCorrection2 = 0.831055f; p.cc.colorCorrection3 = 0.831055f; @@ -506,17 +533,6 @@ namespace librealsense p.cc.colorCorrection10 = -0.272461f; p.cc.colorCorrection11 = -0.272461f; p.cc.colorCorrection12 = -0.355469f; - p.depth_table.depthClampMax = 65536; - p.depth_table.depthClampMin = 0; - p.depth_table.depthUnits = 1000; - p.depth_table.disparityShift = 0; - p.ae.meanIntensitySetPoint = 1000; - p.census.uDiameter = 9; - p.census.vDiameter = 9; - p.laser_state.laser_state = 1; - p.laser_power.laser_power = 150.f; - p.depth_exposure.exposure = 8500.f; - p.depth_auto_exposure.auto_exposure = 1; p.color_auto_exposure.auto_exposure = 1; p.color_exposure.exposure = 156; p.color_backlight_compensation.backlight_compensation = 0; @@ -530,10 +546,20 @@ namespace librealsense p.color_sharpness.sharpness = 50; p.color_auto_white_balance.auto_white_balance = 1; p.color_white_balance.white_balance = 4600; - p.depth_gain.gain = 16.f; - p.hdad.ignoreSAD = 0; - p.amplitude_factor.amplitude = 0.08f; + } + //used as base preset for the D450 + void default_450_mid_low_res(preset& p) + { + default_450_mid_low_res_except_color(p); + default_450_mid_low_res_color_only(p); + } + + // D436i has same depth as D435 and same color as D455 + void default_436(preset& p) + { + default_430_except_color(p); + default_450_mid_low_res_color_only(p); } void high_accuracy(preset& p) diff --git a/src/ds/advanced_mode/presets.h b/src/ds/advanced_mode/presets.h index 222934d471..d0f8c30c9a 100644 --- a/src/ds/advanced_mode/presets.h +++ b/src/ds/advanced_mode/presets.h @@ -138,6 +138,7 @@ namespace librealsense void default_410( preset & p ); void default_420( preset & p ); void default_430( preset & p ); + void default_436( preset & p ); void default_450_high_res( preset & p ); void default_450_mid_low_res( preset & p ); void high_accuracy( preset & p );