18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 08:04:57 +01:00

fix(blackbox): the wheels of the powered vehicle, as the speedometer has them, and the logs described as the drivers' they are

In a unit driven from an unpowered car, the speed of the wheels was of the car
the user is in, whose wheels never slip; now of the motor car, signed as the
occupied vehicle's speed. The doc tells of a log per driver, and of the two
seconds of real time a crash loses.
This commit is contained in:
maj00r
2026-11-15 23:32:39 +01:00
parent 7547e6bf07
commit 5d0bf6ed00
3 changed files with 19 additions and 10 deletions

View File

@@ -418,8 +418,14 @@ void blackbox_recorder::write_cab() {
sample.vehicle = vehicle_id(vehicle);
sample.position = vehicle->GetPosition();
sample.speed_kmh = static_cast<float>(occupied->V * 3.6);
// of the wheels as they turn, which the speedometer shows: apart from that of the vehicle when they slip or skid
sample.wheel_speed_kmh = static_cast<float>(M_PI * occupied->WheelDiameter * occupied->nrot * 3.6);
// of the wheels as they turn, which the speedometer shows: apart from that of the vehicle when they slip or skid.
// those of the powered vehicle, as the speedometer has it (TTrain::DynamicSet), which in a unit driven from an
// unpowered car is another one, maybe facing the other way: signed as the occupied one's speed
auto *powered{train->Dynamic()->FindPowered()};
if (powered == nullptr)
powered = train->Dynamic();
auto const facing{powered->DirectionGet() * vehicle->DirectionGet()};
sample.wheel_speed_kmh = static_cast<float>(facing * M_PI * powered->MoverParameters->WheelDiameter * powered->MoverParameters->nrot * 3.6);
sample.acceleration = static_cast<float>(controlling->AccS);
sample.lateral_acceleration = static_cast<float>(occupied->AccN);
if (owner != nullptr && owner->is_train()) {