fix: freeze smoothing request snapshots
This commit is contained in:
@@ -8,6 +8,9 @@ namespace MultiWheelC.TrajectoryPlanning.PathSmoothing;
|
||||
/// <summary>路径平滑所需的原始粗路径、复核上下文和配置。</summary>
|
||||
public sealed class PathSmoothingRequest
|
||||
{
|
||||
private readonly VehicleParameters _vehicle;
|
||||
private readonly PathSmoothingConfiguration _configuration;
|
||||
|
||||
/// <summary>创建路径平滑请求,并复制粗路径和方向分段集合。</summary>
|
||||
public PathSmoothingRequest(
|
||||
IReadOnlyList<CoarsePathPoint> coarsePath,
|
||||
@@ -19,8 +22,8 @@ public sealed class PathSmoothingRequest
|
||||
CoarsePath = CopyReadOnly(coarsePath);
|
||||
Segments = CopyReadOnly(segments);
|
||||
Map = map;
|
||||
Vehicle = CopyVehicle(vehicle);
|
||||
Configuration = CopyConfiguration(configuration);
|
||||
_vehicle = CopyVehicle(vehicle);
|
||||
_configuration = CopyConfiguration(configuration);
|
||||
}
|
||||
|
||||
/// <summary>原始粗路径的不可变快照。</summary>
|
||||
@@ -32,11 +35,11 @@ public sealed class PathSmoothingRequest
|
||||
/// <summary>用于平滑后完整车体复核的规划栅格地图。</summary>
|
||||
public PlanningGridMap Map { get; }
|
||||
|
||||
/// <summary>车辆几何与最大曲率约束。</summary>
|
||||
public VehicleParameters Vehicle { get; }
|
||||
/// <summary>车辆几何与最大曲率约束的不可变快照副本。</summary>
|
||||
public VehicleParameters Vehicle => CopyVehicle(_vehicle);
|
||||
|
||||
/// <summary>本次平滑的配置。</summary>
|
||||
public PathSmoothingConfiguration Configuration { get; }
|
||||
/// <summary>本次平滑配置的不可变快照副本。</summary>
|
||||
public PathSmoothingConfiguration Configuration => CopyConfiguration(_configuration);
|
||||
|
||||
private static IReadOnlyList<T> CopyReadOnly<T>(IReadOnlyList<T> source)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user