feat(blackbox): the speed of the wheels read from the cab record, shown when they slip or skid

The simulator adds the speed of the wheels at the end of the cab record. It is read when there, and the cab
panel shows it next to the vehicle's speed when the two are a km/h apart or more: the wheels slipping, or
locked in a skid.
This commit is contained in:
maj00r
2026-11-14 00:50:03 +01:00
parent 1398545ff2
commit 7823bb8d09
6 changed files with 35 additions and 3 deletions

View File

@@ -172,6 +172,9 @@ public sealed class BlackBoxReader
Extra = new CabExtra((EngineKind)r.U8(), r.U8(), r.U8(), r.F32(), r.F32(), r.F32(), r.F32(), r.F32(),
r.F32(), r.F32(), r.F32(), r.I8(), r.U8(), r.U8(), r.F32(), r.F32(), r.F32(), r.F32())
};
// The speed of the wheels, later again.
if (sample.Extra is not null && r.Remaining >= 4)
sample = sample with { WheelSpeedKmh = r.F32() };
rec.AddCab(sample);
break;
}

View File

@@ -366,8 +366,12 @@ public readonly record struct CabSample(double Time, int Vehicle, Position Posit
Lights LightsHead, Lights LightsTail, sbyte CabEnd = 0,
SecurityFlags Security = SecurityFlags.None, float LateralAcceleration = 0,
Movement Movement = Movement.Unknown, short LightHintHead = -1, short LightHintTail = -1,
Lights? EquippedHead = null, Lights? EquippedTail = null, CabExtra? Extra = null)
Lights? EquippedHead = null, Lights? EquippedTail = null, CabExtra? Extra = null,
float? WheelSpeedKmh = null)
{
// WheelSpeedKmh: the speed of the wheels as they turn, which the speedometer shows, signed as SpeedKmh; apart
// from it while they slip, 0 while they are locked in a skid. None in a recording made before it.
public bool Has(CabDevices device) => (Devices & device) == device;
public bool Has(SecurityFlags flag) => (Security & flag) == flag;