# 31-04 Motion FERROR / Virtual MPG Gate 实施记录 ## 定位 本文件落实 `ACC-043/INT-030`,闭合 125 项绑定表最后两个可在无真实硬件条件下开发的 `3.6` 与 `3.10`。 ## LinuxCNC 对标 依据 `src/emc/motion/control.c`: ```text ferror = pos_cmd - pos_fb ferror_limit = max_ferror * abs(vel_cmd) / vel_limit ferror_limit = max(ferror_limit, min_ferror) abs(ferror) > ferror_limit -> motion error delta = new_jog_counts - old_jog_counts distance = delta * jog_scale ``` 依据 `motion.c/mot_priv.h` 创建 `joint.N.jog-counts`、`jog-enable`、`jog-scale`、`jog-vel-mode` 四类 HAL pin。 ## 实现与 Gate `linuxcnc_motion_runtime.c` 新增 FERROR 诊断命令,记录实际 ferror/limit 并按上游公式锁存 motion error;virtual MPG 在 servo cycle 读取 count delta,启用时按 scale 更新 joint/axis command-feedback。 ```text motion_ferror_threshold_pair=ok virtual_mpg_count_delta_response=ok motion_hal_sync_smoke=ok linuxcnc_task_runtime_smoke=ok ``` FERROR 测试在相同 `MIN_FERROR=0.01`、`FERROR=1`、`vel_limit=100`、`vel_cmd=50` 下,验证 limit=0.5、error=0.4 不报警、error=0.6 报警。MPG 测试验证 counts `0 -> 5 -> 2`、scale=0.1 时位置 `0 -> 0.5 -> 0.2`。 ## 边界 本轮证明 Web/WASM virtual servo 与 HAL pin 行为;没有物理编码器、真实伺服驱动或 USB/现场总线 MPG。真实硬件仍需独立授权和 IO loopback evidence。 ## 结论 `ACC-043/INT-030` 完成,`3.6` 与 `3.10` 可在 L3 Web/WASM simulation 边界内条件通过。