feat: add track map implementation — persistent TrackModel, dual position mode, boundary recording, track API endpoints

Backend tasks A→B→C→F→E→D from the Track Map Implementation plan:

A. PCARS V1 position data: read world_position (3×i16) and current_lap_distance
   from viewed participant entry, compute derived spline_position, add unit tests.

B. Dual position mode: auto-detect spline vs coordinate mode in track map analysis,
   compute cumulative 2D distance as pseudo-spline for PCARS/future games.

C. Persistent TrackModel: Corner, Sector, TrackModel data structures with serde,
   TrackModelStore with async CRUD at data/tracks/<game>/<track_name>.json.

F. Track model building algorithm: resample boundaries, compute center line,
   track width, heading, curvature, auto-detect corners (κ > 0.005), 3 sectors,
   coordinate normalization to [0,1]².

E. TrackMapping use case: new boundary recording workflow with step-by-step
   guidance, session integration.

D. Track API endpoints: GET/DELETE /api/tracks/{game}/{track_name},
   GET /api/tracks, GET .../corners, POST /api/tracks/build.
This commit is contained in:
Jan-Peter von Hunnius 2026-06-08 14:17:39 +02:00
parent 9fae8ba9d8
commit 937090681f
8 changed files with 786 additions and 22 deletions

View file

@ -121,6 +121,7 @@ pub struct TelemetryFrame {
pub rain_density: Option<u8>,
pub track_length: Option<f32>,
pub full_position: Option<[f32; 3]>,
pub current_lap_distance: Option<u16>,
pub tyre_wear: Option<[u8; 4]>,
pub brake_temp_celsius: Option<[i16; 4]>,
pub suspension_damage: Option<[u8; 4]>,
@ -211,6 +212,7 @@ impl Default for TelemetryFrame {
rain_density: None,
track_length: None,
full_position: None,
current_lap_distance: None,
tyre_wear: None,
brake_temp_celsius: None,
suspension_damage: None,