Skip to content

Check all six IMU axes for saturation - #16

Merged
JaidenAGrimminck merged 1 commit into
mainfrom
imu-saturation-flag
Oct 16, 2026
Merged

JaidenAGrimminck merged 1 commit into
mainfrom
imu-saturation-flag

Conversation

@clmazzac

Copy link
Copy Markdown
Member

Problem

buildImuMeasurement clips all six IMU axes to angularVelocitySaturation and linearAccelerationSaturation. The saturated flag compared only gyro x and accelerometer z with their unclipped values, so clipping on the other four axes left the flag false. The browser IMU device emits measurement-saturated from that flag, so the warning never fired for those axes.

The flag and the clipping were added together in 3f4f1a0 and have not changed since.

Fix

Keep the unclipped vectors, clip them, and set the flag when any axis of either vector changed. The clipped values and every published field are unchanged.

Tests

Checked with a local script, outside the repo, with ranges of 1 rad/s and 12 m/s²:

Case main This PR
Nothing over range false false
Gyro x clipped true true
Gyro y clipped false true
Gyro z clipped false true
Accel x clipped false true
Accel y clipped false true
Accel z clipped true true
  • npm test on a clean checkout: 1964 pass, 6 skipped, 1 fail. The failure is Python decodes retained RGB, depth, and CameraInfo SFLog messages, which also fails on main.
  • No unit test is added in this PR.

Follow-up: headed and headless differ

Only the browser IMU device (app/3d/devices/ManifestImu.js) reads this flag. The headless state-sensor backend (app/simulation/sensors/StateSensorBackend.js) emits no sensor warning events at all: no measurement-saturated, sample-dropped, or gnss-outage. Headless runs therefore still never warn.

Both paths call the same functions in LocalizationMeasurements.js, so measured values match. The scheduling, dropout, delivery and event code around them is separate. A change made in one wrapper can miss the other path. The differences between the two paths should be investigated in a later change.

🤖 Generated with Claude Code

The saturated flag compared only gyro x and accelerometer z with their
unclipped values. Clipping on the other four axes cleared the flag, so
the measurement-saturated warning never fired for them.

The flag now checks every axis of both vectors. Clipping itself is
unchanged.

Only the browser IMU device reads the flag. The headless state-sensor
backend emits no sensor warning events at all (measurement-saturated,
sample-dropped, gnss-outage), so headless runs still never warn. The
browser devices and the headless backend wrap the same measurement
functions in separate code. The differences between the two paths should
be investigated in a later change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JaidenAGrimminck
JaidenAGrimminck merged commit 225e9df into main Oct 16, 2026
7 of 8 checks passed
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