Skip to content

Commit ef3ac9e

Browse files
committed
cr and removing extrinsics restoring methods from 36i
1 parent 0206051 commit ef3ac9e

File tree

4 files changed

+4
-178
lines changed

4 files changed

+4
-178
lines changed

src/ds/d400/d400-color.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ namespace librealsense
5353

5454
friend class d400_color_sensor;
5555
friend class rs435i_device;
56-
friend class rs436i_device;
5756
friend class ds_color_common;
5857

5958
uint8_t _color_device_idx = -1;

src/ds/d400/d400-factory.cpp

Lines changed: 1 addition & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -969,10 +969,7 @@ namespace librealsense
969969
, firmware_logger_device(
970970
dev_info, d400_device::_hw_monitor, get_firmware_logs_command(), get_flash_logs_command())
971971
{
972-
check_and_restore_rgb_stream_extrinsic();
973-
if (_fw_version >= firmware_version(5, 16, 0, 0))
974-
register_feature(
975-
std::make_shared< gyro_sensitivity_feature >(get_raw_motion_sensor(), get_motion_sensor()));
972+
register_feature(std::make_shared< gyro_sensitivity_feature >(get_raw_motion_sensor(), get_motion_sensor()));
976973
}
977974

978975

@@ -999,177 +996,6 @@ namespace librealsense
999996
return tags;
1000997
};
1001998
bool compress_while_record() const override { return false; }
1002-
1003-
private:
1004-
void check_and_restore_rgb_stream_extrinsic()
1005-
{
1006-
for (auto iter = 0, rec = 0; iter < 2; iter++, rec++)
1007-
{
1008-
std::vector< uint8_t > cal;
1009-
try
1010-
{
1011-
cal = *_color_calib_table_raw;
1012-
}
1013-
catch (...)
1014-
{
1015-
LOG_WARNING("Cannot read RGB calibration table");
1016-
}
1017-
1018-
if (!is_rgb_extrinsic_valid(cal) && !rec)
1019-
{
1020-
restore_rgb_extrinsic();
1021-
}
1022-
else
1023-
break;
1024-
};
1025-
}
1026-
1027-
bool is_rgb_extrinsic_valid(const std::vector<uint8_t>& raw_data) const
1028-
{
1029-
try
1030-
{
1031-
// verify extrinsic calibration table structure
1032-
auto table = ds::check_calib<ds::d400_rgb_calibration_table>(raw_data);
1033-
1034-
if ((table->header.version != 0 && table->header.version != 0xffff) && (table->header.table_size >= sizeof(ds::d400_rgb_calibration_table) - sizeof(ds::table_header)))
1035-
{
1036-
float3 trans_vector = table->translation_rect;
1037-
// Translation Heuristic tests
1038-
auto found = false;
1039-
for (auto i = 0; i < 3; i++)
1040-
{
1041-
//Nan/Infinity are not allowed
1042-
if (!std::isfinite(trans_vector[i]))
1043-
{
1044-
LOG_WARNING("RGB extrinsic - translation is corrupted: " << trans_vector);
1045-
return false;
1046-
}
1047-
// Translation must be assigned for at least one axis
1048-
if (std::fabs(trans_vector[i]) > std::numeric_limits<float>::epsilon())
1049-
found = true;
1050-
}
1051-
1052-
if (!found)
1053-
{
1054-
LOG_WARNING("RGB extrinsic - invalid (zero) translation: " << trans_vector);
1055-
return false;
1056-
}
1057-
1058-
// Rotation Heuristic tests
1059-
auto num_found = 0;
1060-
float3x3 rect_rot_mat = table->rotation_matrix_rect;
1061-
for (auto i = 0; i < 3; i++)
1062-
{
1063-
for (auto j = 0; j < 3; j++)
1064-
{
1065-
//Nan/Infinity are not allowed
1066-
if (!std::isfinite(rect_rot_mat(i, j)))
1067-
{
1068-
LOG_DEBUG("RGB extrinsic - rotation matrix corrupted:\n" << rect_rot_mat);
1069-
return false;
1070-
}
1071-
1072-
if (std::fabs(rect_rot_mat(i, j)) > std::numeric_limits<float>::epsilon())
1073-
num_found++;
1074-
}
1075-
}
1076-
1077-
bool res = (num_found >= 3); // At least three matrix indexes must be non-zero
1078-
if (!res) // At least three matrix indexes must be non-zero
1079-
LOG_DEBUG("RGB extrinsic - rotation matrix invalid:\n" << rect_rot_mat);
1080-
1081-
return res;
1082-
}
1083-
else
1084-
{
1085-
LOG_WARNING("RGB extrinsic - header corrupted: "
1086-
<< "Version: " << std::setfill('0') << std::setw(4) << std::hex << table->header.version
1087-
<< ", type " << std::dec << table->header.table_type << ", size " << table->header.table_size);
1088-
return false;
1089-
}
1090-
}
1091-
catch (...)
1092-
{
1093-
return false;
1094-
}
1095-
}
1096-
1097-
void assign_rgb_stream_extrinsic(const std::vector< uint8_t >& calib)
1098-
{
1099-
//write calibration to preset
1100-
command cmd(ds::fw_cmd::SETINTCALNEW, 0x20, 0x2);
1101-
cmd.data = calib;
1102-
d400_device::_hw_monitor->send(cmd);
1103-
}
1104-
1105-
std::vector< uint8_t > read_sector(const uint32_t address, const uint16_t size) const
1106-
{
1107-
if (size > ds_advanced_mode_base::HW_MONITOR_COMMAND_SIZE)
1108-
throw std::runtime_error(rsutils::string::from()
1109-
<< "Device memory read failed. max size: "
1110-
<< int(ds_advanced_mode_base::HW_MONITOR_COMMAND_SIZE)
1111-
<< ", requested: " << int(size));
1112-
command cmd(ds::fw_cmd::FRB, address, size);
1113-
return d400_device::_hw_monitor->send(cmd);
1114-
}
1115-
1116-
std::vector< uint8_t > read_rgb_gold() const
1117-
{
1118-
command cmd(ds::fw_cmd::LOADINTCAL, 0x20, 0x1);
1119-
return d400_device::_hw_monitor->send(cmd);
1120-
}
1121-
1122-
std::vector< uint8_t > restore_calib_factory_settings() const
1123-
{
1124-
command cmd(ds::fw_cmd::CAL_RESTORE_DFLT);
1125-
return d400_device::_hw_monitor->send(cmd);
1126-
}
1127-
1128-
void restore_rgb_extrinsic(void)
1129-
{
1130-
bool res = false;
1131-
LOG_WARNING("invalid RGB extrinsic was identified, recovery routine was invoked");
1132-
try
1133-
{
1134-
if ((res = is_rgb_extrinsic_valid(read_rgb_gold())))
1135-
{
1136-
restore_calib_factory_settings();
1137-
}
1138-
else
1139-
{
1140-
if (_fw_version == firmware_version("5.11.6.200"))
1141-
{
1142-
const uint32_t gold_address = 0x17c49c;
1143-
const uint16_t bytes_to_read = 0x100;
1144-
auto alt_calib = read_sector(gold_address, bytes_to_read);
1145-
if ((res = is_rgb_extrinsic_valid(alt_calib)))
1146-
assign_rgb_stream_extrinsic(alt_calib);
1147-
else
1148-
res = false;
1149-
}
1150-
else
1151-
res = false;
1152-
}
1153-
1154-
// Update device's internal state
1155-
if (res)
1156-
{
1157-
LOG_WARNING("RGB stream extrinsic successfully recovered");
1158-
_color_calib_table_raw.reset();
1159-
_color_extrinsic.get()->reset();
1160-
environment::get_instance().get_extrinsics_graph().register_extrinsics(*_color_stream, *_depth_stream, _color_extrinsic);
1161-
}
1162-
else
1163-
{
1164-
LOG_ERROR("RGB Extrinsic recovery routine failed");
1165-
_color_extrinsic.get()->reset();
1166-
}
1167-
}
1168-
catch (...)
1169-
{
1170-
LOG_ERROR("RGB Extrinsic recovery routine failed");
1171-
}
1172-
}
1173999
};
11741000

11751001
class rs400_imu_device : public d400_motion,

src/ds/d400/d400-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ namespace librealsense
161161
{RS435_RGB_PID, "5.8.15.0" },
162162
{RS405U_PID, "5.8.15.0" },
163163
{RS435I_PID, "5.12.7.100" },
164-
{RS436I_PID, "5.16.3.100" },
164+
{RS436I_PID, "5.16.3.100" }, // TODO - update final required FW version
165165
{RS416_PID, "5.8.15.0" },
166166
{RS430I_PID, "5.8.15.0" },
167167
{RS416_RGB_PID, "5.8.15.0" },

src/gl/camera-shader.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ namespace librealsense
164164
{
165165
auto dev_name = dev.get_info(RS2_CAMERA_INFO_NAME);
166166
if (starts_with(dev_name, "Intel RealSense D415")) index = 0;
167-
if (starts_with(dev_name, "Intel RealSense D435")) index = 1;
167+
if (starts_with(dev_name, "Intel RealSense D435") ||
168+
starts_with(dev_name, "Intel RealSense D436")) index = 1;
168169
if (starts_with(dev_name, "Intel RealSense D45")) index = 2;
169170
};
170171

0 commit comments

Comments
 (0)