Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 24768e2d authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

Bugfix: avoiding short simulation interval.

in case the vehicle speed is already below the target speed of the current  'next driving action' and the trigger distance is reached, assume the current 'next driving action' as completed and switch to the next one.
parent 78fd7995
No related branches found
No related tags found
No related merge requests found
......@@ -558,12 +558,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// update action distance for current 'next action'
UpdateDistancesForCurrentNextAction();
SetNextDrivingAction(currentDistance, nextAction);
SetNextDrivingAction(currentDistance, nextAction, ds);
}
Log.Debug("Next Driving Action: {0}", NextDrivingAction);
}
private void SetNextDrivingAction(Meter currentDistance, DrivingBehaviorEntry nextAction)
private void SetNextDrivingAction(Meter currentDistance, DrivingBehaviorEntry nextAction, Meter ds)
{
if (nextAction != null) {
if (nextAction.HasEqualTrigger(NextDrivingAction)) {
......@@ -577,6 +577,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (nextAction.ActionDistance < NextDrivingAction.ActionDistance) {
NextDrivingAction = nextAction;
}
if ((currentDistance + ds).IsEqual(NextDrivingAction.TriggerDistance) && Driver.DataBus.VehicleInfo.VehicleSpeed < NextDrivingAction.NextTargetSpeed) {
// the currently active NextDrivingAction already reached the target speed - ignore it.
NextDrivingAction = nextAction;
}
}
} else {
NextDrivingAction = null;
......
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