feat: assemble longitudinal ST quadratic programs
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace MultiWheelC.TrajectoryPlanning.EMPlanner;
|
||||
|
||||
/// <summary>Immutable longitudinal solve result; only successful statuses may expose a candidate profile.</summary>
|
||||
public sealed class LongitudinalPlanningResult
|
||||
{
|
||||
public LongitudinalPlanningResult(EmPlanningStatus status, LongitudinalCandidate candidate, string failureReason)
|
||||
{
|
||||
if (!Enum.IsDefined(typeof(EmPlanningStatus), status))
|
||||
throw new ArgumentOutOfRangeException(nameof(status));
|
||||
bool successful = status == EmPlanningStatus.Success || status == EmPlanningStatus.SuccessWithFallback;
|
||||
if (successful && candidate == null)
|
||||
throw new ArgumentException("Successful longitudinal results require a candidate.", nameof(candidate));
|
||||
if (!successful && candidate != null)
|
||||
throw new ArgumentException("Failed longitudinal results cannot expose a candidate.", nameof(candidate));
|
||||
|
||||
Status = status;
|
||||
Candidate = candidate == null ? null : new LongitudinalCandidate(candidate.KnotTimes, candidate.S, candidate.U,
|
||||
candidate.A, candidate.J);
|
||||
FailureReason = failureReason ?? string.Empty;
|
||||
}
|
||||
|
||||
public EmPlanningStatus Status { get; }
|
||||
|
||||
public LongitudinalCandidate Candidate { get; }
|
||||
|
||||
public string FailureReason { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user