Skip to content

fix(mobile): retain reverse motion in vehicle odometry - #929

Open
Afloat16 wants to merge 1 commit into
petercorke:mainfrom
Afloat16:fix/signed-vehicle-odometry
Open

Afloat16 wants to merge 1 commit into
petercorke:mainfrom
Afloat16:fix/signed-vehicle-odometry

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Vehicle simulation computes travelled distance with a norm, so reverse motion produces positive odometry. Feeding that odometry into the existing vehicle state transition predicts forward motion, breaking estimator prediction when a vehicle reverses.

Change

Project the translation increment onto the vehicle's heading before the state update to retain its sign. This uses the actual limited motion and handles differential steering even when one wheel moves forward while the vehicle reverses. The odometry docstring now explicitly describes signed distance.

The regression covers Bicycle, Unicycle and DiffSteer, with forward controls, reversing controls, nonzero heading and opposite wheel directions. It verifies that returned odometry reconstructs the actual next pose through VehicleBase.f.

Validation

  • Original source: all 4 reverse cases failed; the 4 forward controls passed.
  • PYTHONPATH=src python -m pytest tests/test_vehicle_estimators.py -q: 55 passed, 30 subtests passed.
  • The regression module passes Ruff.
  • git diff --check passed.

This corrects the sign of reverse odometry and consequently changes estimator trajectories for reversing vehicles.

@Afloat16
Afloat16 marked this pull request as ready for review November 3, 2026 13:56
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch has not been deployed

No deployments
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.

1 participant