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