Skip to content

Add centripetal acceleration to the simulated IMU - #6

Merged
JaidenAGrimminck merged 1 commit into
mainfrom
fix-imu-lateral-acceleration
Oct 2, 2026
Merged

JaidenAGrimminck merged 1 commit into
mainfrom
fix-imu-lateral-acceleration

Conversation

@clmazzac

@clmazzac clmazzac commented Oct 1, 2026

Copy link
Copy Markdown
Member

Problem

The simulated IMU reports no lateral acceleration in a turn.

captureVehicleSnapshot takes body acceleration from the derivative of body-frame velocity. The body frame rotates with the vehicle, so that derivative omits omega x v. In a steady turn the body-frame velocity stays (speed, 0, 0), and the result is zero. A real accelerometer reads speed * yaw rate toward the turn.

A filter that uses lateral acceleration then sees a reading that contradicts the gyro. An EKF with the measurement model a_y = v * omega drove its speed estimate toward zero in each turn.

Fix

Add the omega x v term to the body acceleration in captureVehicleSnapshot:

  • a_y += yawRate * v_x
  • a_x -= yawRate * v_y

Only the IMU reads bodyAcceleration.

Measurements

One scenario, run before and after: about 90 m with two turns, route follower at 3 m/s. IMU messages were recorded from the orchestrator. The internal pose came from the run's SFLog. Both runs also had #5 applied. This change does not depend on #5.

Check Before After
IMU linear_acceleration.y vs speed x yaw rate, while turning (least-squares slope) 0.000 +1.008
Largest linear_acceleration.y in a turn 0.07 m/s² 2.40 m/s² (expected up to 2.27)
IMU gyro z, accel x, accel z, 3,620 samples bit-for-bit the same
GNSS latitude and longitude, 362 fixes the same

Effect on an external EKF (IMU yaw rate, lateral acceleration and GNSS), position error against visualization.localization.error:

Before After
Mean 2.45 m 0.18 m
Max 7.36 m 1.62 m
In the two turns (mean) 4.91 m, 1.99 m 0.19 m, 0.22 m

Tests

  • npm test: 1,892 of 1,899 pass. The one failure, Python decodes retained RGB, depth, and CameraInfo SFLog messages, also fails on main on my machine.
  • Two new tests in localization-sensors.test.js:
    • a steady turn reads speed * yaw rate on IMU y, with the sign of the turn, for both directions. This test fails on main.
    • straight driving reads no lateral acceleration.

Not in this change

An IMU mounted away from the vehicle reference point also feels terms from that offset (alpha x r and omega x (omega x r)). The default IMU sits at the reference point, so this change omits them.

🤖 Generated with Claude Code

The IMU took body acceleration from the derivative of body-frame
velocity. The body frame rotates with the vehicle, so that derivative
omits omega x v. In a steady turn the body-frame velocity is constant
and the IMU reported no lateral acceleration.

Add the omega x v term. Lateral acceleration is now yaw rate times
forward speed, toward the turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JaidenAGrimminck
JaidenAGrimminck merged commit bbbd09d into main Oct 2, 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