37 lines
1.5 KiB
C#
37 lines
1.5 KiB
C#
using System;
|
|
|
|
namespace MultiWheelC.TrajectoryPlanning.PathSmoothing;
|
|
|
|
/// <summary>一次 Local G2 平滑尝试的不可变诊断快照,适用于成功、取消和失败结果。</summary>
|
|
public sealed class PathSmoothingDiagnostics
|
|
{
|
|
/// <summary>创建不可行、零耗时且没有终止原因的默认诊断快照。</summary>
|
|
public PathSmoothingDiagnostics()
|
|
: this(new PathQualityMetrics(), TimeSpan.Zero, string.Empty)
|
|
{
|
|
}
|
|
|
|
/// <summary>创建平滑诊断快照。</summary>
|
|
/// <param name="metrics">路径可行性、曲率、净空和相对变化的质量指标。</param>
|
|
/// <param name="elapsed">从服务入口到终止的累计耗时。</param>
|
|
/// <param name="terminationReason">可供调用方记录的成功、取消或失败原因;为 <see langword="null"/> 时为空字符串。</param>
|
|
public PathSmoothingDiagnostics(
|
|
PathQualityMetrics metrics,
|
|
TimeSpan elapsed,
|
|
string terminationReason = null)
|
|
{
|
|
Metrics = metrics ?? new PathQualityMetrics();
|
|
Elapsed = elapsed;
|
|
TerminationReason = terminationReason ?? string.Empty;
|
|
}
|
|
|
|
/// <summary>本次尝试的质量指标;未提供时为全零且不可行的默认指标。</summary>
|
|
public PathQualityMetrics Metrics { get; }
|
|
|
|
/// <summary>本次尝试的累计耗时,类型为 <see cref="TimeSpan"/>。</summary>
|
|
public TimeSpan Elapsed { get; }
|
|
|
|
/// <summary>终止原因文本;不承载可消费的部分路径。</summary>
|
|
public string TerminationReason { get; }
|
|
}
|