d500 motion: align D555/D585 gyro path with HKR physical-unit IMU encoding#15456
d500 motion: align D555/D585 gyro path with HKR physical-unit IMU encoding#15456remibettan wants to merge 5 commits into
Conversation
…uard test cleanup
sysrsbuild-gh-agentic
left a comment
There was a problem hiding this comment.
🤖 rs-agentic bot automated review — bugs and notes below.
|
|
||
| // HID metadata attributes | ||
| hid_ep->get_raw_sensor()->register_metadata(RS2_FRAME_METADATA_FRAME_TIMESTAMP, make_hid_header_parser(&hid_header::timestamp)); | ||
|
|
There was a problem hiding this comment.
🤖 [rs-agentic bot] BUG – get_raw_motion_sensor() uses dynamic_pointer_cast and can return nullptr if the cast fails. Dereferencing without a null-check here will crash. Add: if (auto raw = get_raw_motion_sensor()) raw->set_gyro_scale_factor(10000.);
| #endif | ||
| } | ||
|
|
||
| void d500_motion::register_gyro_sensitivity() |
There was a problem hiding this comment.
🤖 [rs-agentic bot] BUG – get_raw_motion_sensor() is called twice without a null-check. If dynamic_pointer_cast fails both calls return nullptr and the first dereference crashes. Cache the result and guard: auto raw = get_raw_motion_sensor(); if (!raw) return;
| return value; | ||
|
|
||
| switch( static_cast< int >( value ) ) | ||
| { |
There was a problem hiding this comment.
🤖 [rs-agentic bot] BUG – static_cast<int>(value) truncates without checking for fractional input (e.g. 0.9f silently falls to case 0). Consider std::lround + a range assertion, or document that only integer-valued floats are accepted.
| namespace | ||
| { | ||
| // REVIEW BLOCKER: replace this sentinel with the first released FW that | ||
| // contains IO 34cf87d6 and device-manager 1be508e0. |
There was a problem hiding this comment.
🤖 [rs-agentic bot] REVIEW BLOCKER – hkr_physical_imu_min_fw("65535.65535.65535.65535") is a sentinel that makes supports_hkr_physical_imu() always return false today. Per the PR description this must be replaced with the real first HKR FW version before merge, otherwise the HKR path never activates (or if the sentinel is ever lowered without proper testing, will activate against legacy FW emitting 16-bit samples — misinterpreting all gyro data).
|
|
||
| pipe = rs.pipeline(ctx) | ||
| pipe.set_device(dev) | ||
| cfg = rs.config() |
There was a problem hiding this comment.
🤖 [rs-agentic bot] BUG – set_option is called on motion_sensor obtained before pipe.start(). After pipe.start() the sensor is re-fetched from profile.get_device(). If the option is not persisted across pipeline restarts the readback will reflect the default, not the value set, causing intermittent failures. Set the option after pipe.start() or verify the option survives a pipeline restart.
Overview: Extend D555/D585 gyro sensitivity registration to all D585 variants and align the SDK gyro path with the FW's HKR physical-unit IMU encoding.
Tracked on [RSDEV-60196]
Why
D555 and D585 firmwares that ship the HKR physical-IMU work (IO
34cf87d6+ device-manager1be508e0) emit gyro samples as 32-bit fixed physical units instead of 16-bit raw registers. The SDK today interprets those samples as legacy raw 16-bit output, and the D585 constructors do not register the sensitivity option at all.Builds on top of PR #15436 (
d555-usb-gyro-sensitivity).Summary
gyro_sensitivity_encoding(d400_hid_token/hkr_range_index) and route the D400 conversion table + defaults throughencode_gyro_sensitivity()/default_gyro_sensitivity().d500_motion:supports_hkr_physical_imu(),is_imu_high_accuracy() override, and switchget_gyro_default_scale()to0.0001for HKR-eligible devices.10000.increate_hid_devicefor HKR-eligible devices and register the sensitivity option with the HKR encoding + default range index4.f.RS2_OPTION_GYRO_SENSITIVITYon the four D585 constructors (rs5x5_device,rs5x5_dedicated_color_device,rs585_legacy_device,rs585s_device); D555 registration already lands via PR d500: register Gyro Sensitivity option on USB for D555 #15436, macOS guard preserved.Behavior change (HKR-eligible D555/D585 only)
is_imu_high_accuracy()false(base default)trueconverter_32_bit)get_gyro_default_scale()0.0038146972656250.0001set_gyro_scale_factor10000.d400_hid_token)hkr_range_index1.f)4.fd400_hid_token)REVIEW BLOCKER
hkr_physical_imu_min_fwis a sentinel65535.65535.65535.65535. It must be replaced with the first released FW that contains IO34cf87d6+ device-manager1be508e0before this PR can merge — otherwise HKR mode activates against firmwares that still emit 16-bit samples and gyro/accel data will be misinterpreted.Test plan
test-gyro-sensitivity-encodingpasses (Windows + Linux).d400_hid_token).pytest-gyro-sensitivity-levels.pystill passes.#if !defined(__APPLE__)guarded).🤖 Generated by AI