From 8a8e8d9c61137e95243c1144e286491614170fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Mon, 17 May 2021 16:53:02 +0200 Subject: [PATCH] AI driver has more histeresis when using ep brake --- Driver.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Driver.cpp b/Driver.cpp index 28186853..f9c3c56d 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -7730,8 +7730,11 @@ void TController::control_braking_force() { fAccGravity < 0.025 ? // HACK: when going downhill be more responsive to desired deceleration fAccThreshold : std::max( -0.2, fAccThreshold ) ) }; + auto const AccMax{ std::min(fBrake_a0[0] + 12 * fBrake_a1[0], mvOccupied->MED_amax) }; + auto const accmargin = ((AccMax > 1.1 * AccDesired) && (fAccGravity < 0.025)) ? + 0.05 : 0.0; if( ( AccDesired < accthreshold ) // jeśli hamować - u góry ustawia się hamowanie na fAccThreshold - && ( ( AbsAccS > AccDesired ) + && ( ( AbsAccS > AccDesired + accmargin) || ( BrakeCtrlPosition < 0 ) ) ) { // hamować bardziej, gdy aktualne opóźnienie hamowania mniejsze niż (AccDesired) cue_action( locale::string::driver_hint_brakingforceincrease );