18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 21:34:58 +01:00

AI: the passenger stop flag no longer turns itself on and off (#295)

Whether a train is at a passenger stop (IsAtPassengerStop) was checked against
the final approach margins fMinProximityDist and fMaxProximityDist, which are
themselves set from that flag: 10-15 m and 15-40 m at a stop, 8 m and 50 m
otherwise. With the two sets different, the flag switched on and off on every
other scan of the route on the way to a W4. Each time the train went from a
final approach to a stop 50 m long to one 15 m long and back: braking in one
scan, full power below the 10 km/h coasting speed in the next. Close to the
stop the braking demand did not hold the train to a standstill, and below
1 km/h the stop counted as done, so an SN61 drove off without ever standing
still (#290).

The margins are now worked out in train_proximity_margins(), and the check of
the stop uses the margins of a passenger stop whatever the flag is at the
moment. A vehicle that is not a train keeps the present ones, as before.
This commit is contained in:
pawelw
2026-11-08 14:40:13 +01:00
committed by GitHub
parent a6f30c3a2a
commit 3487e75f9a
2 changed files with 51 additions and 43 deletions

View File

@@ -312,6 +312,7 @@ private:
return mvOccupied->Vel * sign( iDirection * mvOccupied->V ); }
double brake_increase_margin() const;
std::pair<double, double> train_proximity_margins( bool const Passengerstop ) const;
void update_timers( double const dt );
void update_logs( double const dt );