mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 06:55:02 +01:00
feat(blackbox): the cab record holds the speed of the wheels, apart from the vehicle's when they slip
The speed of the cab record is the vehicle's. The speedometer, and a speed recorder's tape with it, shows the speed of the wheels as they turn, which runs away from it while they slip and drops to 0 while they are locked in a skid. It is added at the end of the record (194 bytes), where the readers skip what they don't know; the .dat tapes have it already, in their second column.
This commit is contained in:
@@ -172,14 +172,15 @@ record.
|
||||
|
||||
### 0x20 cab
|
||||
|
||||
The vehicle the user is in, every 0.1 s, also while the user looks around outside it. 190 bytes.
|
||||
The vehicle the user is in, every 0.1 s, also while the user looks around outside it. 194 bytes (190 in the
|
||||
files written before the speed of the wheels was added at the end).
|
||||
|
||||
| type | field |
|
||||
|---------|------------------------------------------------------------------------|
|
||||
| `f64` | t |
|
||||
| `u32` | number of the vehicle |
|
||||
| `dvec3` | position |
|
||||
| `f32` | speed [km/h], positive along the front of the vehicle |
|
||||
| `f32` | speed of the vehicle [km/h], positive along its front |
|
||||
| `f32` | acceleration along the track [m/s²] |
|
||||
| `f32` | odometer [km] |
|
||||
| `u8` | driver: 0 none, 1 the user, 2 the AI (the autopilot) |
|
||||
@@ -231,6 +232,7 @@ The vehicle the user is in, every 0.1 s, also while the user looks around outsid
|
||||
| `f32` | the clutch of a diesel's gearbox, 0 open .. 1 closed |
|
||||
| `f32` | the filling of a diesel's hydraulic torque converter, 0..1 |
|
||||
| `f32` | the highest brake cylinder pressure of the vehicles of the train [bar] |
|
||||
| `f32` | speed of the wheels [km/h], as the speedometer shows it, signed as the speed of the vehicle: apart from it while the wheels slip, 0 while they are locked in a skid |
|
||||
|
||||
The lights the train is to show follow from the movement and the two patterns after it: in a train run the head the pattern asked for,
|
||||
the usual one Pc 1 (both headlights and the upper one; Pc 2 is the left red marker with the right and the
|
||||
|
||||
@@ -418,6 +418,8 @@ 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);
|
||||
sample.acceleration = static_cast<float>(controlling->AccS);
|
||||
sample.lateral_acceleration = static_cast<float>(occupied->AccN);
|
||||
if (owner != nullptr && owner->is_train()) {
|
||||
|
||||
@@ -127,6 +127,7 @@ blackbox::cab_sample sample() {
|
||||
s.clutch = 0.75f;
|
||||
s.converter_fill = 0.25f;
|
||||
s.consist_brake_cylinder = 3.5f;
|
||||
s.wheel_speed_kmh = 71.5f;
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -285,6 +286,8 @@ TEST_CASE("blackbox: a sample of the user's train has the documented size and or
|
||||
CHECK(cab.get<float>() == 0.25f);
|
||||
// the highest brake cylinder pressure of the train
|
||||
CHECK(cab.get<float>() == 3.5f);
|
||||
// the speed of the wheels
|
||||
CHECK(cab.get<float>() == 71.5f);
|
||||
CHECK(cab.done());
|
||||
}
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ void writer::cab(cab_sample const &Sample) {
|
||||
out.f32(Sample.clutch);
|
||||
out.f32(Sample.converter_fill);
|
||||
out.f32(Sample.consist_brake_cylinder);
|
||||
out.f32(Sample.wheel_speed_kmh);
|
||||
emit(record::cab);
|
||||
}
|
||||
|
||||
|
||||
@@ -257,6 +257,9 @@ struct cab_sample {
|
||||
float clutch{0.0f}; // the clutch of a diesel's gearbox, 0 open .. 1 closed
|
||||
float converter_fill{0.0f}; // the filling of a diesel's hydraulic torque converter, 0..1
|
||||
float consist_brake_cylinder{0.0f}; // the highest brake cylinder pressure of the vehicles of the train [bar]
|
||||
// [km/h] of the wheels as they turn, which the speedometer shows, signed as speed_kmh: apart from it while the wheels
|
||||
// slip, and 0 while they are locked in a skid
|
||||
float wheel_speed_kmh{0.0f};
|
||||
};
|
||||
|
||||
// a station of the timetable of the user's train; the times in minutes of the day, -1 none
|
||||
@@ -354,7 +357,7 @@ struct signal_passing {
|
||||
// sizes of the parts of fixed size, as the readers expect them
|
||||
inline constexpr std::size_t header_size{12};
|
||||
inline constexpr std::size_t record_header_size{5};
|
||||
inline constexpr std::size_t cab_sample_size{190};
|
||||
inline constexpr std::size_t cab_sample_size{194};
|
||||
inline constexpr std::size_t vehicle_state_size{25};
|
||||
|
||||
// writes the records to a stream. nothing is written until header() is
|
||||
|
||||
Reference in New Issue
Block a user