Keep a standing train's direction through jitter and missing bearings

- GPS jitter under 15 m at a standing train no longer turns it, in reports
  and in playback; a reversal needs at least 15 m of movement.
- A standing train keeps its operator's last bearing through reports that
  leave it out.
- Playback resets its turn point at a break, so a jump to a corrected
  position is not a reversal.
- A train bound while its line is still loading takes its direction from
  the movement it already made.
- A vehicle in view that leaves a Transit hold goes on from its own clock
  instead of rewinding.
- Tests cover the 15 m boundary, the late line, the hold release and the
  icon after Transit is turned back on; duplicate jitter tests are merged.
- FOLLOW_MIN_MOVE_M is gone; comments and CURRENT-STATE match the code.
This commit is contained in:
German Khokhlov committed 2026-11-18 20:49:15 +04:00
1 parent df4d76384c
commit 58afb169d1
10 files changed
+291 -127

No files matched your search

+17 -14
View File
@@ -2769,8 +2769,8 @@ HUD view is.
The Rail layer offers a read API for such a view: `getSelectedTrain()` and
`getCockpitSubject()` (a snapshot of the train: where it is along its line,
which way it runs (`pathBinding.js` learns it), its rail height (null while
no floor is known), speed as reported or
derived, position source, feed credit and stops, and
no floor is known), speed as reported or derived, position source, feed
credit and stops, and
`selectedAtMs`, when the user last selected it by a click or `focusTrain`,
even again; null after a deselection and for a train only a hold selected),
`setCockpitSubject(key)` (its marker, 3D model and card hidden, the selection kept, its
@@ -2788,18 +2788,21 @@ box are hidden; released, it is out of play until a visibility sweep finds it in
view. Turning the layer off ends the hold. Its snapshot's
`position.groundHeightM` is the floor where playback draws it (the drawn
marker's height while it is placed, else its segment's two reports' floors at
the playback fraction), not the newest report's, and null while that floor is
unknown, also while the camera is too high for the layer to sample the ground
and such a vehicle is drawn on the ellipsoid. Rail's `path.direction` is the
way the drawn train runs: once playback has placed it, a report that runs back
turns it only when playback starts the segment to that report. A train turns
once it has backed away from the farthest point it reached by more than a
standing train's GPS jitter, however slowly it backs, so that jitter keeps the
direction it had. `docs/APPLICATION.md` (Cockpit subjects) shows a minimal
provider. `src/ui/cockpitSubjectView.test.mjs`,
`src/cockpitSubjectProviders.test.mjs`, `src/cockpitProgress.test.mjs`,
`src/layers/rail/cockpitSubject.test.mjs`, `src/layers/rail/pathBinding.test.mjs`
and the Transit lifecycle tests cover them.
the playback fraction), not the newest report's, and null while either of
those two floors is unknown. Rail's `path.direction` is the way the drawn
train runs: once playback has placed it, a report that runs back turns it
only when playback starts the segment to that report. A train turns once it
is more than a standing train's GPS jitter back from the last place a longer
move took it, however slowly it backs, so jitter on either side of where it
stands keeps its direction, and so does a jump to a corrected position.
A train bound after it stopped takes its direction from earlier reports in
the same run. While movement gives no direction, the snapshot uses the
operator's last reported bearing.
`docs/APPLICATION.md` (Cockpit subjects) shows a minimal provider.
`src/ui/cockpitSubjectView.test.mjs`, `src/cockpitSubjectProviders.test.mjs`,
`src/cockpitProgress.test.mjs`, `src/layers/rail/cockpitSubject.test.mjs`,
`src/layers/rail/pathBinding.test.mjs` and the Transit lifecycle tests cover
them.
## Context coordination