Files

39 lines
1.5 KiB
C#

using System;
namespace MultiWheelC.TrajectoryPlanning.EMPlanner;
/// <summary>不耦合控制器或硬件的不可变轨迹执行状态,组合选中点和换向状态机的安全语义。</summary>
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;
}
/// <summary>按调用方时刻选中或插值得到的轨迹点;位置为 m、航向为 rad、速度为 m/s。</summary>
public EmTrajectoryPoint SelectedPoint { get; }
public GearSwitchState GearSwitchState { get; }
/// <summary>是否要求保持零速度和零 yaw rate。</summary>
public bool HoldZero { get; }
public bool RequestDirectionChange { get; }
/// <summary>状态机是否允许跟随选中点的非零轨迹运动。</summary>
public bool AllowsTrajectoryMotion { get; }
public bool IsTrajectoryComplete { get; }
public string Reason { get; }
}