Skip to content

Phase B4: fuse mobile GPS/IMU into camera calibration - #12

Closed
mandarwagh9 wants to merge 1 commit into
feat/phaseB-3-extrapolationfrom
feat/phaseB-4-gps-imu-fusion
Closed

mandarwagh9 wants to merge 1 commit into
feat/phaseB-3-extrapolationfrom
feat/phaseB-4-gps-imu-fusion

Conversation

@mandarwagh9

Copy link
Copy Markdown
Owner

What & why

Phase B4. The mobile client streams GPS (watchPosition) + IMU (DeviceOrientationEvent), but the backend was receiving and discarding the sensor_data message (pass). Now it's fused into the camera calibration.

⚠️ Stacked on the chain (#11 → … → #4). Auto-retargets as the stack merges.

Changes

  • New app/infrastructure/geo.pygps_to_local(): equirectangular projection of lat/lng to local east/north metres.
  • World model update_camera_sensor() — GPS → local position (relative to GPS_REFERENCE_*, or the first fix becomes the origin) and DeviceOrientation alpha/beta/gamma → camera rotation (roll/pitch/yaw). Overrides the auto-default calibration for that camera; missing fields fall back to any existing calibration. Added to the WorldModelRepository port as a concrete no-op default.
  • main.py — the /ws/camera handler now forwards sensor_data to the world model instead of discarding it (verified the fused keys match what cameraStreamAdapter.js actually sends).
  • README — flipped GPS/IMU fusion from 🔭 planned to ✅ implemented (status table, platform row, mobile handshake).

Tests (TDD)

8 new:

  • test_geo.py — reference→origin, north offset → +y (~111 m), east offset → +x scaled by cos(lat)
  • test_gps_fusion.py — first fix becomes origin, second fix north → +y, configured reference used, orientation → rotation (yaw), no-data → no-op

Verification

  • ruff clean · mypy clean (18 files) · 103 tests pass (was 95).
  • Coverage 58% → 59% (floor 50%).

🤖 Generated with Claude Code

Phase B4. The mobile client streams GPS (watchPosition) + IMU
(DeviceOrientationEvent), but the backend was receiving and discarding the
sensor_data message. Now it's fused.

- New app/infrastructure/geo.py: gps_to_local() equirectangular projection.
- World model: update_camera_sensor() converts GPS -> local position (relative to
  GPS_REFERENCE_* or the first fix as origin) and DeviceOrientation alpha/beta/gamma
  -> camera rotation, overriding the auto-default calibration. Added to the
  WorldModelRepository port (concrete no-op default).
- main.py: /ws/camera handler forwards sensor_data to the world model instead of pass.
- README: flip GPS/IMU fusion from planned to implemented.
- Tests: 8 new (geo: origin/north/east projection; fusion: first-fix origin, north
  offset, configured reference, orientation->rotation, no-data no-op).

Coverage 58%->59%. ruff/mypy clean, 103 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mandarwagh9

Copy link
Copy Markdown
Owner Author

Superseded — all commits from this phase landed on main via the merge of #13 (the top of the stack, which contains every phase commit). Closing to tidy up; the work is fully merged.

@mandarwagh9
mandarwagh9 deleted the feat/phaseB-4-gps-imu-fusion branch June 19, 2026 15:49
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