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

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

driver strategy: handle the case that the vehicle stops before a requested...

driver strategy: handle the case that the vehicle stops before a requested stop in the cycle due to disengage.

if the vehicle stopped already but did not reach the stop distance, accelerate for half of the remaining distance until stop.
call handleTargetSpeedReached only of the vehicle is not stopped
parent 5e9611b8
No related branches found
No related tags found
No related merge requests found
......@@ -593,7 +593,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected override IResponse DoHandleRequest(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient,
bool prohibitOverspeed = false)
{
if (DataBus.VehicleSpeed <= DriverStrategy.BrakeTrigger.NextTargetSpeed) {
if (DataBus.VehicleSpeed <= DriverStrategy.BrakeTrigger.NextTargetSpeed && !DataBus.VehicleStopped) {
var retVal = HandleTargetspeedReached(absTime, ds, targetVelocity, gradient);
for (var i = 0; i < 3 && retVal == null; i++) {
retVal = HandleTargetspeedReached(absTime, ds, targetVelocity, gradient);
......@@ -642,8 +642,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
targetDistance = DriverStrategy.BrakeTrigger.TriggerDistance - DefaultDriverStrategy.BrakingSafetyMargin;
}
Driver.DriverBehavior = DrivingBehavior.Braking;
response = Driver.DrivingActionBrake(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed,
gradient, targetDistance: targetDistance);
if (DataBus.VehicleSpeed.IsEqual(0) && DriverStrategy.BrakeTrigger.NextTargetSpeed.IsEqual(0)) {
if (ds.IsEqual(targetDistance - currentDistance)) {
return new ResponseDrivingCycleDistanceExceeded() {
Source = this,
MaxDistance = ds / 2
};
}
response = Driver.DrivingActionAccelerate(absTime, ds, 1.KMPHtoMeterPerSecond(), gradient);
} else {
response = Driver.DrivingActionBrake(
absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed,
gradient, targetDistance: targetDistance);
}
if (DataBus.GearboxType.AutomaticTransmission() && response == null) {
for (var i = 0; i < 3 && response == null; i++) {
......
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