fix: accelerate EM trajectories from rest
This commit is contained in:
+19
-1
@@ -8,8 +8,15 @@ public sealed class LongitudinalSolutionValidator
|
||||
{
|
||||
public bool TryValidate(LongitudinalPlanningInput input, PathSpeedLimit speedLimit, LongitudinalCandidate candidate,
|
||||
out LongitudinalCandidate validatedCandidate, out string failureReason)
|
||||
{
|
||||
return TryValidate(input, speedLimit, candidate, out validatedCandidate, out _, out failureReason);
|
||||
}
|
||||
|
||||
public bool TryValidate(LongitudinalPlanningInput input, PathSpeedLimit speedLimit, LongitudinalCandidate candidate,
|
||||
out LongitudinalCandidate validatedCandidate, out EmPlanningStatus failureStatus, out string failureReason)
|
||||
{
|
||||
validatedCandidate = null;
|
||||
failureStatus = EmPlanningStatus.LongitudinalInfeasible;
|
||||
failureReason = string.Empty;
|
||||
if (input == null || speedLimit == null || candidate == null)
|
||||
{
|
||||
@@ -58,7 +65,8 @@ public sealed class LongitudinalSolutionValidator
|
||||
progress > input.PathUpperBoundS + tolerance || speed < -tolerance ||
|
||||
acceleration < -maximumDeceleration - tolerance || acceleration > maximumAcceleration + tolerance)
|
||||
{
|
||||
failureReason = "ST candidate violates physical bounds at knot " + index + ".";
|
||||
failureReason = "ST candidate violates physical bounds at knot " + index +
|
||||
" (S=" + progress + ", U=" + speed + ", A=" + acceleration + ").";
|
||||
return false;
|
||||
}
|
||||
double speedLimitAtProgress = index == 0
|
||||
@@ -84,6 +92,16 @@ public sealed class LongitudinalSolutionValidator
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bool requiresProgress = input.PathUpperBoundS >
|
||||
input.Configuration.Validation.TerminalPositionToleranceMeters;
|
||||
double achievedProgress = candidate.S[candidate.S.Count - 1] - candidate.S[0];
|
||||
if (input.PlanningScope == EmPlanningScope.FullDirectionSegment && requiresProgress &&
|
||||
achievedProgress <= input.Configuration.Validation.SpatialToleranceMeters)
|
||||
{
|
||||
failureStatus = EmPlanningStatus.NoProgress;
|
||||
failureReason = "NoProgress: a nonterminal full direction segment produced zero progress.";
|
||||
return false;
|
||||
}
|
||||
int stabilizationStart = candidate.S.Count;
|
||||
if (input.Mode == EmLongitudinalMode.ExactStopAtBoundary)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user