Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

allow driver strategy to override announced driving action.

necessary if slight braking is required when accelerating from stop due to engine inertia (special case, vehicle stops too early when halting uphill)
parent 8606185f
Branches
Tags
No related merge requests found
......@@ -32,6 +32,7 @@
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.Simulation.DataBus;
using TUGraz.VectoCore.Models.SimulationComponent.Impl;
using DriverData = TUGraz.VectoCore.Models.SimulationComponent.Data.DriverData;
namespace TUGraz.VectoCore.Models.SimulationComponent
......@@ -83,12 +84,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent
/// <param name="gradient"></param>
/// <param name="previousResponse"></param>
/// <param name="targetDistance"></param>
/// <param name="overrideAction"></param>
/// <returns>
/// * ResponseSuccess
/// * ResponseDrivingCycleDistanceExceeded: vehicle is at low speed, coasting would lead to stop before ds is reached.
/// </returns>
IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient,
IResponse previousResponse = null, Meter targetDistance = null);
IResponse previousResponse = null, Meter targetDistance = null, DrivingAction? overrideAction = null);
/// <summary>
/// perform a 'roll driving action', i.e., the clutch is open and the vehicle rolls without motoring. adjust the acceleration
......
......@@ -653,7 +653,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
response = Driver.DrivingActionAccelerate(absTime, ds, 1.KMPHtoMeterPerSecond(), gradient);
if (response is ResponseUnderload) {
response = Driver.DrivingActionBrake(absTime, ds, 1.KMPHtoMeterPerSecond(), gradient, response);
response = Driver.DrivingActionBrake(absTime, ds, 1.KMPHtoMeterPerSecond(), gradient, response, overrideAction: DrivingAction.Accelerate);
}
} else {
response = Driver.DrivingActionBrake(
......
......@@ -478,10 +478,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return response;
}
public IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient,
IResponse previousResponse = null, Meter targetDistance = null)
public IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient, IResponse previousResponse = null, Meter targetDistance = null, DrivingAction? overrideAction = null)
{
DrivingAction = DrivingAction.Brake;
DrivingAction = overrideAction ?? DrivingAction.Brake;
IterationStatistics.Increment(this, "Brake");
Log.Debug("DrivingAction Brake");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment