Repository navigation
Assign a pilot to a performance group live, during a flight #223
Description
Is your feature request related to a problem? Please describe.
#216 clusters pilots in batch, after their flights are finished and logged. The client eventually wants to see which performance group a pilot falls into while the pilot is still flying. Nothing in inference/ reads the stream live or assigns a pilot to an existing performance group. The batch model is not saved either, so the only option today is to refit the whole cohort.
Describe the solution you'd like
A live mode that taps the same TCP stream inference/Data/data_logger.py reads. It computes deviation features for the flight in progress at a fixed refresh rate and assigns the pilot to the nearest performance group of a saved batch fit, without refitting.
- Save the scaler and group centres from a Build a baseline pilot clustering model #216 batch run (the reference cohort).
- Recompute the flight's deviation features (
stdand|bias|per flight dynamics factor) from all samples so far. Reuseinference/features.py, not a second implementation. - Scale them with the saved scaler and assign the nearest centre.
- Withhold an assignment until the flight has enough samples to make it meaningful.
Open questions (needs-info)
- Refresh rate: how often to reassign (every N seconds, every N samples, or on demand).
- Minimum flight length before the first assignment.
stdfrom a few seconds of data is noisy. - Window: all samples since flight start, or a rolling window.
- Where the assignment is shown (console, relay GUI, an iMotions event, a file).
- When to refit the reference cohort as more pilots are logged.
Describe alternatives you've considered
- Refit the whole cohort on every refresh. Rejected because KMeans numbers groups differently on each fit, so a pilot's group could change label without any change in how they fly. It would also move every other pilot's assignment.
- Assign only at the end of the flight. Simpler, but it is the batch case from Build a baseline pilot clustering model #216 and not what the client asked for.
Additional context
Blocked by #216 (batch fit to save), #211 (pilot_id/flight_id) and #213 (targets; without them there is no deviation to compute). Units must be post-#196, see docs/telemetry_schema.md.
Activity
jmacd867 commentedon Oct 15, 2026
One more open question: the client's current data is from Prepar3D at about 1 Hz, and the move to X-Plane (our plugin, 20 Hz) comes later. Group centres saved from a Prepar3D batch fit may not apply to live X-Plane flights. The flight models differ, and
stddepends on the sample rate. Before live assignment uses a Prepar3D reference cohort, check that the same flying gives the same features in both simulators, or resample to a common rate.jmacd867 commentedon Oct 16, 2026
Answers from the client meeting (`docs/client_meeting_notes.md`):
Phlabry commentedon Oct 23, 2026
Status update on the blockers listed here. #216 merged in #225 and #211 merged in #219, so the saved batch fit and the
pilot_id/flight_idcolumns both exist now. #247 adds the other missing piece, a live stream the Python side can read while iMotions is recording.That leaves #213. Without targets there is no deviation to compute from real flights, so a live assignment can only be demonstrated on synthetic pilots. The open questions in this issue about refresh rate, minimum flight length and where the assignment is shown are still unanswered.