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

Skip to content
Snippets Groups Projects
Commit 305d400b authored by Michael KRISPER's avatar Michael KRISPER
Browse files

[VECTO-271] corrected error: DistanceRun got an unexpected response: ResponseGearShift

parent e046c662
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,8 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
......
......@@ -70,7 +70,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected internal DrivingBehaviorEntry BrakeTrigger { get; set; }
public IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient)
{
if (CurrentDrivingMode == DrivingMode.DrivingModeBrake) {
......@@ -118,7 +117,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return Driver.DrivingActionHalt(absTime, dt, targetVelocity, gradient);
}
private void UpdateDrivingAction(Meter currentDistance, Meter ds)
{
var nextAction = GetNextDrivingAction(currentDistance, ds);
......@@ -166,7 +164,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Log.Debug("Next Driving Action: {0}", NextDrivingAction);
}
protected DrivingBehaviorEntry GetNextDrivingAction(Meter minDistance, Meter ds)
{
var currentSpeed = Driver.DataBus.VehicleSpeed;
......@@ -225,7 +222,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
//=====================================
public interface IDriverMode
{
DefaultDriverStrategy DriverStrategy { get; set; }
......@@ -266,7 +262,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return response;
}
// if we accelerate in the current simulation interval the ActionDistance of the next action
// changes and we might pass the ActionDistance - check again...
if (response.Acceleration <= 0) {
......@@ -292,7 +287,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
//DriverStrategy.BrakeTrigger = DriverStrategy.NextDrivingAction;
}
Log.Debug("Exceeding next ActionDistance at {0}. Reducing max Distance from {2} to {1}",
DriverStrategy.NextDrivingAction.ActionDistance, newds, ds);
return new ResponseDrivingCycleDistanceExceeded() {
......@@ -355,15 +349,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
response = Driver.DrivingActionAccelerate(absTime, ds, targetVelocity, gradient);
}
response.Switch().
Case<ResponseGearShift>(() => {
response = Driver.DrivingActionRoll(absTime, ds, velocity, gradient);
response.Switch().
Case<ResponseUnderload>(() => {
// overload may happen if driver limits acceleration when rolling downhill
response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient);
}).
Case<ResponseSpeedLimitExceeded>(() => { response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient); });
}).
Case<ResponseUnderload>(r => {
if (DriverStrategy.OverspeedAllowed(gradient, targetVelocity)) {
response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient);
......@@ -374,6 +359,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient);
}
});
response.Switch().
Case<ResponseGearShift>(r => {
response = Driver.DrivingActionRoll(absTime, ds, velocity, gradient);
response.Switch().
Case<ResponseUnderload>(() => {
// overload may happen if driver limits acceleration when rolling downhill
response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient);
}).
Case<ResponseSpeedLimitExceeded>(() => { response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient); });
});
} else {
if (DataBus.VehicleSpeed.IsSmallerOrEqual(0.SI<MeterPerSecond>())) {
// the clutch is disengaged, and the vehicle stopped - we can't perform a roll action. wait for the clutch to be engaged
......
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