Repository navigation
Integrate wheel odometry over the real capture interval - #9
Merged
Merged
Conversation
Wheel odometry computed travel over 1 / rateHz. The fixed-step schedule rounds the sensor period to whole steps, so captures can arrive more often than that. A 50 Hz sensor on the default 60 Hz step captures every 16.67 ms but integrated 20 ms each time, which overstated distance by 20%. Travel now uses the time since the previous capture, as the IMU and GNSS models already do. The first capture still uses 1 / rateHz. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JaidenAGrimminck
approved these changes
Oct 16, 2026
JaidenAGrimminck
left a comment
Member
There was a problem hiding this comment.
for the built in model i think this is fine but since we're adjusting to dynamics package might need to do some later adjusting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
wheelTravelFromBicyclecomputed each sample's travel as speed × (1 /rateHz). The fixed-step schedule rounds the sensor period to whole steps (periodSteps = round(periodNs / stepNs)), so captures can arrive more often thanrateHz.Example: 50 Hz wheel odometry on the default 60 Hz step.
periodStepsrounds 1.2 to 1, so the sensor captures every 16.67 ms. Each capture still integrated 20 ms of travel. Distance came out 20% too long.Measured at 3 m/s for 30 s: 107.7 m reported against 90.0 m true.
Fix
Travel uses the time since the previous capture, from
state.lastCaptureTimeNs. The IMU and GNSS models already do this. The first capture has no previous one and still uses 1 /rateHz.wheelTravelFromBicycletakesdtas an argument. It no longer readssnapshot.rateHz, andbuildWheelOdometryMeasurementno longer writesrateHzonto the shared snapshot.Tests
tests/localization-sensors.test.js: 50 Hz odometry on a 16.67 ms step at 3 m/s for 180 captures. Distance is within 1% of truth. Without the fix it reports 10.78 m against 9.01 m.npm teston a clean checkout: all pass exceptPython decodes retained RGB, depth, and CameraInfo SFLog messages, which also fails onmain.Related
#10 fixes tick rounding in the same function. The two PRs merge cleanly in either order; I checked the combined result with
npm test.The measured wheel odometry values change for affected runs.
deterministic-state-sensorsstays at version1. Bump it if recorded runs must reproduce exactly across this change.🤖 Generated with Claude Code