feat: add lateral optimization model
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace MultiWheelC.TrajectoryPlanning.EMPlanner;
|
||||
|
||||
/// <summary>Result of the lateral stage; only independently validated paths may be successful.</summary>
|
||||
public sealed class LateralPlanningResult
|
||||
{
|
||||
public LateralPlanningResult(EmPlanningStatus status, LateralPath path, string failureReason)
|
||||
{
|
||||
if (!Enum.IsDefined(typeof(EmPlanningStatus), status))
|
||||
throw new ArgumentOutOfRangeException(nameof(status));
|
||||
|
||||
bool successful = status == EmPlanningStatus.Success || status == EmPlanningStatus.SuccessWithFallback;
|
||||
if (successful && (path == null || path.Points.Count == 0 || !path.IsIndependentlyValidated))
|
||||
throw new ArgumentException("Successful lateral results require a non-empty independently validated path.", nameof(path));
|
||||
if (!successful && path != null)
|
||||
throw new ArgumentException("Failed lateral results cannot contain a path.", nameof(path));
|
||||
|
||||
Status = status;
|
||||
Path = path;
|
||||
FailureReason = failureReason ?? string.Empty;
|
||||
}
|
||||
|
||||
public EmPlanningStatus Status { get; }
|
||||
|
||||
public LateralPath Path { get; }
|
||||
|
||||
public string FailureReason { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user