18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 10:24:58 +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()) {

View File

@@ -88,8 +88,8 @@ private:
static std::vector<std::pair<glm::dvec3, float>> stop_point_headings();
void write_cab();
// with the physics logs off, the line of the log of the driver the user is with, to its log, physicslog/<vehicle>.dat,
// as the physics logs would have it. a log is begun at the first line of the recording, and goes on while the user
// looks around outside, until the user takes another vehicle; back in the vehicle, it goes on after the gap
// as the physics logs would have it. a driver's log is begun at the first line given for that driver, and goes on
// while the user looks around outside or is in another vehicle of that driver; back with it, after the gap
void keep_tape_line();
// the clock, the user's vehicle, the vehicles, the switches and the signals
void look_around(bool Keyframe);