Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit bc14c4f8 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

additional condition to avoid short simulation intervals.

if disengaged and the braking interval is pretty short (due to a slight decrease in target speed), start braking one simulation interval earlier instead of driving exactly to the point where braking starts and then have a pretty short interval of braking (<0.05s)
parent 06953fca
No related branches found
No related tags found
No related merge requests found
......@@ -89,9 +89,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
UpdateDrivingAction(currentDistance, ds);
if (NextDrivingAction != null) {
var remainingDistance = NextDrivingAction.ActionDistance - currentDistance;
var estimatedNextTimestep = remainingDistance / Driver.DataBus.VehicleSpeed;
if (remainingDistance.IsEqual(0.SI<Meter>(), Constants.SimulationSettings.DriverActionDistanceTolerance) ||
estimatedNextTimestep.IsSmaller(Constants.SimulationSettings.LowerBoundTimeInterval)) {
var estimatedTimestep = remainingDistance / Driver.DataBus.VehicleSpeed;
var atTriggerTistance = remainingDistance.IsEqual(
0.SI<Meter>(), Constants.SimulationSettings.DriverActionDistanceTolerance);
var closeBeforeBraking = estimatedTimestep.IsSmaller(Constants.SimulationSettings.LowerBoundTimeInterval);
var brakingIntervalTooShort = NextDrivingAction.Action == DrivingBehavior.Braking &&
((NextDrivingAction.TriggerDistance - NextDrivingAction.ActionDistance) / Driver.DataBus.VehicleSpeed)
.IsSmaller(
Constants.SimulationSettings.LowerBoundTimeInterval / 20) && !Driver.DataBus.ClutchClosed(absTime);
if ( atTriggerTistance || closeBeforeBraking || brakingIntervalTooShort) {
CurrentDrivingMode = DrivingMode.DrivingModeBrake;
DrivingModes[CurrentDrivingMode].ResetMode();
Log.Debug("Switching to DrivingMode BRAKE");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment