using System;
namespace MultiWheelC.TrajectoryPlanning.EMPlanner;
/// 不耦合控制器或硬件的不可变轨迹执行状态,组合选中点和换向状态机的安全语义。
public sealed class TrajectoryExecutionState
{
internal TrajectoryExecutionState(EmTrajectoryPoint selectedPoint, GearSwitchStateUpdate gearSwitchUpdate)
{
SelectedPoint = selectedPoint ?? throw new ArgumentNullException(nameof(selectedPoint));
if (gearSwitchUpdate == null)
throw new ArgumentNullException(nameof(gearSwitchUpdate));
GearSwitchState = gearSwitchUpdate.State;
HoldZero = gearSwitchUpdate.HoldZero;
RequestDirectionChange = gearSwitchUpdate.RequestDirectionChange;
AllowsTrajectoryMotion = gearSwitchUpdate.AllowsTrajectoryMotion;
IsTrajectoryComplete = gearSwitchUpdate.IsTrajectoryComplete;
Reason = gearSwitchUpdate.Reason;
}
/// 按调用方时刻选中或插值得到的轨迹点;位置为 m、航向为 rad、速度为 m/s。
public EmTrajectoryPoint SelectedPoint { get; }
public GearSwitchState GearSwitchState { get; }
/// 是否要求保持零速度和零 yaw rate。
public bool HoldZero { get; }
public bool RequestDirectionChange { get; }
/// 状态机是否允许跟随选中点的非零轨迹运动。
public bool AllowsTrajectoryMotion { get; }
public bool IsTrajectoryComplete { get; }
public string Reason { get; }
}