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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user