feat: validate EM planner requests
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user