diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index 04c979bd3a9f62e56907b006cc6b4f7a80401086..3d9f71a01e5c9bfc037fc6d6dc1805fc933b9c8c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -214,12 +214,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //} if (CurrentDrivingMode == DrivingMode.DrivingModeBrake) { + var nextAction = GetNextDrivingAction(ds); + if (nextAction != null && !BrakeTrigger.HasEqualTrigger(nextAction) && nextAction.ActionDistance.IsSmallerOrEqual(BrakeTrigger.ActionDistance)) { + BrakeTrigger = nextAction; + } if (Driver.DataBus.MileageCounter.Distance.IsGreaterOrEqual(BrakeTrigger.TriggerDistance, 1e-3.SI<Meter>())) { CurrentDrivingMode = DrivingMode.DrivingModeDrive; NextDrivingAction = null; DrivingModes[CurrentDrivingMode].ResetMode(); Log.Debug("Switching to DrivingMode DRIVE"); } + + } if (CurrentDrivingMode == DrivingMode.DrivingModeDrive) { var currentDistance = Driver.DataBus.MileageCounter.Distance;