feat: validate EM planner requests

This commit is contained in:
梁薄云
2026-08-03 22:22:44 +08:00
parent e12eb31205
commit b326431d63
16 changed files with 734 additions and 11 deletions
@@ -0,0 +1,13 @@
namespace MultiWheelC.TrajectoryPlanning.EMPlanner;
public sealed class EmPlannerDebugOptions
{
public bool EnableSummary { get; set; }
public bool EnableProjectionTrace { get; set; }
public bool EnableCorridorTrace { get; set; }
public bool EnableLateralSolverTrace { get; set; }
public bool EnableLongitudinalSolverTrace { get; set; }
public bool EnableTrajectoryDump { get; set; }
public bool EnableVisualization { get; set; }
public IEmPlannerDebugSink Sink { get; set; }
}
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace MultiWheelC.TrajectoryPlanning.EMPlanner;
public sealed class EmPlanningDiagnostics
{
private readonly List<string> _debugSinkFailures = new List<string>();
public IReadOnlyList<string> DebugSinkFailures
{
get { return new ReadOnlyCollection<string>(new List<string>(_debugSinkFailures)); }
}
public void WriteDebug(EmPlannerDebugOptions options, string message)
{
if (options == null || options.Sink == null)
return;
try
{
options.Sink.Write(message ?? string.Empty);
}
catch (Exception exception)
{
_debugSinkFailures.Add(exception.GetType().FullName + ": " + exception.Message);
}
}
}
@@ -0,0 +1,6 @@
namespace MultiWheelC.TrajectoryPlanning.EMPlanner;
public interface IEmPlannerDebugSink
{
void Write(string message);
}