2026-06-28 15:04:55 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using ClumsyCore;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
namespace MultiWheelC;
|
|
|
|
|
|
|
|
|
|
public class VehicleSyncInfo
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("Master")] public bool Master { get; set; }
|
|
|
|
|
[JsonProperty("Ip")] public string Ip { get; set; } = "";
|
|
|
|
|
[JsonProperty("Port")] public int Port { get; set; } = 8008;
|
|
|
|
|
[JsonProperty("PosAvailable")] public bool PosAvailable { get; set; }
|
|
|
|
|
[JsonProperty("X")] public float X { get; set; }
|
|
|
|
|
[JsonProperty("Y")] public float Y { get; set; }
|
|
|
|
|
[JsonProperty("Th")] public float Th { get; set; }
|
|
|
|
|
[JsonProperty("LayoutX")] public float LayoutX { get; set; }
|
|
|
|
|
[JsonProperty("LayoutY")] public float LayoutY { get; set; }
|
|
|
|
|
[JsonProperty("LayoutTh")] public float LayoutTh { get; set; }
|
|
|
|
|
[JsonProperty("Aligned")] public bool Aligned { get; set; }
|
|
|
|
|
// 本车本轮是否成功识别到邻车(关闭互识别时恒为 true)。任一车为 false 则整队停车。
|
|
|
|
|
[JsonProperty("DetectOk")] public bool DetectOk { get; set; }
|
2026-06-30 22:20:10 +08:00
|
|
|
[JsonProperty("MotionFeasible")] public bool MotionFeasible { get; set; } = true;
|
|
|
|
|
[JsonProperty("MotionInfeasibleReason")] public string MotionInfeasibleReason { get; set; } = "";
|
2026-07-01 10:28:32 +08:00
|
|
|
[JsonProperty("RotateWheelsAligned")] public bool RotateWheelsAligned { get; set; } = true;
|
|
|
|
|
[JsonProperty("RotateWheelAlignDetail")] public string RotateWheelAlignDetail { get; set; } = "";
|
2026-06-28 15:04:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class VehicleSyncNotification
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("PosAvailable")] public bool PosAvailable { get; set; }
|
|
|
|
|
[JsonProperty("CenterX")] public float CenterX { get; set; }
|
|
|
|
|
[JsonProperty("CenterY")] public float CenterY { get; set; }
|
|
|
|
|
[JsonProperty("CenterTh")] public float CenterTh { get; set; }
|
|
|
|
|
[JsonProperty("Aligned")] public bool Aligned { get; set; }
|
|
|
|
|
[JsonProperty("Fleet")] public Dictionary<int, VehicleSyncInfo> Fleet { get; set; } = new();
|
|
|
|
|
[JsonProperty("FleetVx")] public float FleetVx { get; set; }
|
|
|
|
|
[JsonProperty("FleetFrontTh")] public float FleetFrontTh { get; set; }
|
|
|
|
|
[JsonProperty("FleetRearTh")] public float FleetRearTh { get; set; }
|
2026-06-28 19:09:24 +08:00
|
|
|
// 联动运动模式:0=常规(前进+转向) 1=蟹行(四轮同向平移) 2=原地旋转(绕车队中心)
|
|
|
|
|
[JsonProperty("Mode")] public int Mode { get; set; }
|
|
|
|
|
// 原地旋转角速度(deg/s,逆时针为正),仅 Mode==2 有效
|
|
|
|
|
[JsonProperty("FleetOmega")] public float FleetOmega { get; set; }
|
2026-07-01 10:28:32 +08:00
|
|
|
[JsonProperty("RequestedFleetOmega")] public float RequestedFleetOmega { get; set; }
|
|
|
|
|
[JsonProperty("FleetMotionReleased")] public bool FleetMotionReleased { get; set; } = true;
|
2026-06-30 22:20:10 +08:00
|
|
|
[JsonProperty("FleetStopActive")] public bool FleetStopActive { get; set; }
|
|
|
|
|
[JsonProperty("FleetStopReason")] public string FleetStopReason { get; set; } = "";
|
|
|
|
|
[JsonProperty("FleetStopSourceCar")] public int FleetStopSourceCar { get; set; }
|
2026-06-28 15:04:55 +08:00
|
|
|
[JsonProperty("AutoEnabled")] public bool AutoEnabled { get; set; }
|
|
|
|
|
[JsonProperty("ManualEnabled")] public bool ManualEnabled { get; set; }
|
|
|
|
|
[JsonProperty("SyncTh")] public float SyncTh { get; set; }
|
|
|
|
|
[JsonProperty("SyncDistance")] public float SyncDistance { get; set; }
|
|
|
|
|
[JsonProperty("DeltaDetectCenter")] public float DeltaDetectCenter { get; set; }
|
2026-06-29 15:59:28 +08:00
|
|
|
// F: 单调递增序列号,从车据此丢弃乱序到达的旧 notify 包。
|
|
|
|
|
[JsonProperty("Seq")] public long Seq { get; set; }
|
|
|
|
|
// D: 自动模式下主车路径控制器算出的车队中心理想位姿(世界系),由 idealPos/idealAngle 透传而来。
|
|
|
|
|
// HasIdeal=true 时各从车按各自 layout 推算 per-car 目标位姿做前馈+补偿,弧线路径不再只靠事后纠偏。
|
|
|
|
|
[JsonProperty("HasIdeal")] public bool HasIdeal { get; set; }
|
|
|
|
|
[JsonProperty("IdealX")] public float IdealX { get; set; }
|
|
|
|
|
[JsonProperty("IdealY")] public float IdealY { get; set; }
|
|
|
|
|
[JsonProperty("IdealTh")] public float IdealTh { get; set; }
|
2026-06-28 15:04:55 +08:00
|
|
|
}
|