using System.Collections.Generic; using System.Collections.ObjectModel; using MultiWheelC.TrajectoryPlanning.CoarsePath; using MultiWheelC.TrajectoryPlanning.Mapping; namespace MultiWheelC.TrajectoryPlanning.PathSmoothing; /// 路径平滑所需的原始粗路径、复核上下文和配置。 public sealed class PathSmoothingRequest { /// 创建路径平滑请求,并复制粗路径和方向分段集合。 public PathSmoothingRequest( IReadOnlyList coarsePath, IReadOnlyList segments, PlanningGridMap map, VehicleParameters vehicle, PathSmoothingConfiguration configuration) { CoarsePath = CopyReadOnly(coarsePath); Segments = CopyReadOnly(segments); Map = map; Vehicle = vehicle; Configuration = configuration; } /// 原始粗路径的不可变快照。 public IReadOnlyList CoarsePath { get; } /// 原始粗路径方向分段的不可变快照。 public IReadOnlyList Segments { get; } /// 用于平滑后完整车体复核的规划栅格地图。 public PlanningGridMap Map { get; } /// 车辆几何与最大曲率约束。 public VehicleParameters Vehicle { get; } /// 本次平滑的配置。 public PathSmoothingConfiguration Configuration { get; } private static IReadOnlyList CopyReadOnly(IReadOnlyList source) { var copy = new List(source == null ? 0 : source.Count); if (source != null) { for (int index = 0; index < source.Count; index++) copy.Add(source[index]); } return new ReadOnlyCollection(copy); } }