Skip to content

L515 IMU Calibration and Motion Correction - #6587

Merged
ev-mp merged 8 commits into
realsenseai:developmentfrom
gwen2018:l515_imu_mc3
Jun 17, 2020
Merged

ev-mp merged 8 commits into
realsenseai:developmentfrom
gwen2018:l515_imu_mc3

Conversation

@gwen2018

@gwen2018 gwen2018 commented Jun 15, 2020 •

Copy link
Copy Markdown
Contributor
  1. support L515 IMU calibration and motion correction
  2. updated L515 extrinsic
  3. keep lazy design, use default intrinsic in case valid calibration data is not available on device
  4. calibration instruction aligned for all D400 and L515 devices with IMU
    Tracked on: RS5-7834

@ev-mp ev-mp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!
Several comments inside

Comment thread src/ds5/ds5-motion.cpp Outdated
using namespace ds;

_mm_calib = std::make_shared<mm_calib_handler>(_hw_monitor,_device_capabilities);
_mm_calib = std::make_shared<mm_calib_handler>(_hw_monitor, false, _device_capabilities);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace the boolean with PID type, either raw or enumerated. This is required to assign the proper extrinsic based on CAD

Comment thread src/ds5/ds5-motion.cpp Outdated
mm_calib_handler::mm_calib_handler(std::shared_ptr<hw_monitor> hw_monitor, ds::d400_caps dev_cap) :
_hw_monitor(hw_monitor), _dev_cap(dev_cap)
mm_calib_handler::mm_calib_handler(std::shared_ptr<hw_monitor> hw_monitor, bool l515_imu_cal, ds::d400_caps dev_cap) :
_hw_monitor(hw_monitor), _l515_table_on_flash(l515_imu_cal), _dev_cap(dev_cap)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_l515_table_on_flash to be refactored into _sku/dev_pid type

Comment thread src/ds5/ds5-motion.cpp Outdated
@@ -470,6 +474,8 @@ namespace librealsense
prs = std::make_shared<dm_v2_imu_calib_parser>(raw, _dev_cap, valid); break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PID will be then passed here

Comment thread src/ds5/ds5-motion.h Outdated
// valid extrinsic, the extrinsic_valid field should be set in the table and detected here so the values from the table can be used.
if (valid)
{
imu_calib_table = *(ds::check_calib<ds::dm_v2_calibration_table>(raw_data));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line may throw - needs to be protected

Comment thread src/ds5/ds5-motion.h Outdated
if (_valid_extrinsic)
{
// only in case valid extrinsic is available in calibration data by calibration script in future or user custom calibration
librealsense::copy(&extr, &imu_calib_table.depth_to_imu, sizeof(rs2_extrinsics));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parsed data should be handled with lazy<> so it will be copied once

Comment thread src/ds5/ds5-motion.h Outdated
if (_valid_extrinsic)
{
// The extrinsic is stored as array of floats / little-endian
librealsense::copy(&extr, &_calib_table.module_info.dm_v2_calib_table.depth_to_imu, sizeof(rs2_extrinsics));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle the extrinsic with lazy to avoid copying the data

Comment thread src/ds5/ds5-private.h Outdated
EN_ADV = 0x2D, // enable advanced mode
UAMG = 0X30, // get advanced mode status
PFD = 0x3b, // Disable power features <Parameter1 Name="0 - Disable, 1 - Enable" />
READ_TABLE = 0x43, // read table from flash, for example, read imu calibration table, read_table 0x243 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is not complaint with D400 HWMon 0x43
Please refactor it into a separate enum/header

@ev-mp ev-mp mentioned this pull request Jun 15, 2020
@gwen2018

Copy link
Copy Markdown
Contributor Author

@ev-mp thanks for the review. I submitted changes with pid and extrinsic handling to address the issues. also updated d455 extrinsic.

Comment thread src/ds5/ds5-motion.h
else // unmapped configurations
{
_def_extr = { { 1, 0, 0, 0, 1, 0, 0, 0, 1 },{ 0.f, 0.f, 0.f } };
_imu_2_depth_rot = { { -1,0,0 },{ 0,1,0 },{ 0,0,-1 } };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use identity matrix for default + add the unresolved PID to log

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMU on new devices is now intentionally oriented and FW flips output such that output is consistent with D435i, it's better to use this matrix so in those unsupported cases the librealsense output will be correctly aligned with depth coordinate system.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added more comment and pid to log

Comment thread src/ds5/ds5-motion.h
// predefined platform specific extrinsic, IMU assembly transformation based on mechanical drawing (meters)
rs2_extrinsics _def_extr;

if (_pid == ds::RS435I_PID)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls add a TODO make - this section should be later refactored into a map with calib. data

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comment

@ev-mp ev-mp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ev-mp
ev-mp merged commit 1a218f3 into realsenseai:development Jun 17, 2020
@gwen2018
gwen2018 deleted the l515_imu_mc3 branch February 4, 2025 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants