feat(runtime): 完善 FANUC 命令参数与状态通道重连

* 在 FanucCommandProtocol/Client 中补齐速度倍率、TCP 位姿和
  IO 的封包/解析,并引入 FanucIoTypes 字符串到枚举映射
* FanucControllerRuntime 在非仿真模式下接入真机命令通道,本地
  缓存仅作为兜底,TCP 操作扩展为 7 维 Pose
* FanucStateClient 增加帧超时检测、退避自动重连和诊断状态接口,
  超时或重连期间不再把陈旧帧当作当前机器人状态
* FanucStateProtocol 锁定 90B 帧字段为 pose[6]、joint[6]、
  external_axes[3] 和 raw_tail_words[4],并保留状态字诊断槽位
* ICspPlanner 增加 global_scale > 1.0 失败判定,self-adapt-icsp
  内部禁用该判定以保留补点重试链路
* 同步更新 README/AGENTS/计划文档的 todo 状态和实现说明
This commit is contained in:
2026-04-27 00:18:50 +08:00
parent 390d066ece
commit 69fa3edd89
18 changed files with 1631 additions and 122 deletions

View File

@@ -9,6 +9,8 @@ public sealed class FanucStateFrame
{
private readonly double[] _pose;
private readonly double[] _jointOrExtensionValues;
private readonly double[] _jointDegrees;
private readonly double[] _externalAxes;
private readonly uint[] _tailWords;
/// <summary>
@@ -28,6 +30,24 @@ public sealed class FanucStateFrame
_pose = pose?.ToArray() ?? throw new ArgumentNullException(nameof(pose));
_jointOrExtensionValues = jointOrExtensionValues?.ToArray() ?? throw new ArgumentNullException(nameof(jointOrExtensionValues));
_tailWords = tailWords?.ToArray() ?? throw new ArgumentNullException(nameof(tailWords));
if (_pose.Length != 6)
{
throw new ArgumentException("状态帧位姿必须包含 6 个 float。", nameof(pose));
}
if (_jointOrExtensionValues.Length != 9)
{
throw new ArgumentException("状态帧关节/扩展轴必须包含 9 个 float。", nameof(jointOrExtensionValues));
}
if (_tailWords.Length != 4)
{
throw new ArgumentException("状态帧尾部状态字必须包含 4 个 u32。", nameof(tailWords));
}
_jointDegrees = _jointOrExtensionValues.Take(6).ToArray();
_externalAxes = _jointOrExtensionValues.Skip(6).ToArray();
}
/// <summary>
@@ -40,15 +60,55 @@ public sealed class FanucStateFrame
/// </summary>
public IReadOnlyList<double> Pose => _pose;
/// <summary>
/// 获取控制器回传的笛卡尔位姿 X/Y/Z/W/P/R单位来自 FANUC 状态服务器。
/// </summary>
public IReadOnlyList<double> CartesianPose => _pose;
/// <summary>
/// 获取控制器回传的关节或扩展轴状态。
/// </summary>
public IReadOnlyList<double> JointOrExtensionValues => _jointOrExtensionValues;
/// <summary>
/// 获取前 6 个机器人关节角度,单位为度。
/// </summary>
public IReadOnlyList<double> JointDegrees => _jointDegrees;
/// <summary>
/// 获取后 3 个扩展轴槽位。当前现场样本中这些值通常为 0。
/// </summary>
public IReadOnlyList<double> ExternalAxes => _externalAxes;
/// <summary>
/// 获取状态帧尾部状态槽位。
/// </summary>
public IReadOnlyList<uint> TailWords => _tailWords;
/// <summary>
/// 获取原始尾部状态字。当前抓包中恒为 [2,0,0,1],语义暂不强行推断。
/// </summary>
public IReadOnlyList<uint> RawTailWords => _tailWords;
/// <summary>
/// 获取第 0 个原始尾部状态字。
/// </summary>
public uint StatusWord0 => _tailWords[0];
/// <summary>
/// 获取第 1 个原始尾部状态字。
/// </summary>
public uint StatusWord1 => _tailWords[1];
/// <summary>
/// 获取第 2 个原始尾部状态字。
/// </summary>
public uint StatusWord2 => _tailWords[2];
/// <summary>
/// 获取第 3 个原始尾部状态字。
/// </summary>
public uint StatusWord3 => _tailWords[3];
}
/// <summary>