The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/dai: Swap x and -y axis to account for orientation of IMU in the camera.

We need a different axis assignment before submitting samples from the
DepthAI driven Luxonis Oak cameras IMU to the imu sinks, to account for
the orientation of the IMU in those cameras. On those cameras, the IMU
y axis points to the right, the x axis points downwards, the z axis
backwards. See following official Luxonis answer for reference:

https://discuss.luxonis.com/d/1044-about-oak-d-pro-w-imu-coordinate-system/8

One way to confirm the current wrong assignment and this fix is to select
"Use 3DOF tracking instead of SLAM" checkbox in the "Generic inside out
head tracker" debug UI.

Tested with a Luxonis Oak-D Pro camera.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2228>

authored by

Mario Kleiner and committed by
Marge Bot
09273292 e7cbcefa

+6 -4
+6 -4
src/xrt/drivers/depthai/depthai_driver.cpp
··· 573 573 // Prepare sample 574 574 xrt_imu_sample sample; 575 575 sample.timestamp_ns = ts; 576 - sample.accel_m_s2.x = a.x; 577 - sample.accel_m_s2.y = a.y; 576 + 577 + // Need to swap x and y axis for Oak-D cameras at least: 578 + sample.accel_m_s2.x = a.y; 579 + sample.accel_m_s2.y = -a.x; 578 580 sample.accel_m_s2.z = a.z; 579 581 580 - sample.gyro_rad_secs.x = g.x; 581 - sample.gyro_rad_secs.y = g.y; 582 + sample.gyro_rad_secs.x = g.y; 583 + sample.gyro_rad_secs.y = -g.x; 582 584 sample.gyro_rad_secs.z = g.z; 583 585 584 586 // Sample prepared, now push it out.