# 01 RTCP 刀具轨迹问题复盘 生成时间:2026-06-22 ## 1. 测试来源 专项测试脚本: ```text qa/web-rtcp-5axis-site-test/capture-toolpath-preview-cases.mjs ``` 专项报告: ```text qa/web-rtcp-5axis-site-test/output/web-rtcp-5axis-toolpath-preview-report-2026-06-22.docx ``` 原始数据: ```text qa/web-rtcp-5axis-site-test/output/toolpath-preview-cases.json ``` ## 2. 失败现象 失败场景: ```text 06-running-rtcp-toolpath ``` 失败前证据: ```text 05-vendored-impeller-toolpath: threeRtcpState=on pathPoints=1498 executedPathPoints=1 programSource=linuxcnc-vendored-5axis-gcode programExecution.summary.switchkinsEventCount=2 switchkinsCodes=M428,M429 ``` 失败时证据: ```text 06-running-rtcp-toolpath: threeRtcpState=off state.rtcpState=off state.kinsType=identity programRuntimeFeedbackSource=linuxcnc-task-motion-hal-wasm ``` ## 3. 影响 该问题影响 G-code 执行时的刀具轨迹可信度: ```text 1. 预览路径显示程序已经进入 TCP/RTCP 区间。 2. RUN 后 task/HAL 状态把 kinsType 回退到 identity。 3. canvas 上的 TCP/刀轴/RTCP 状态与程序 switchkins 语义不一致。 4. 操作者可能误判当前刀具姿态和五轴 RTCP 执行状态。 ``` ## 4. 根因定位 代码落点: ```text web-rtcp-5axis-sim-plan/app/src/state/store.js ``` 原逻辑: ```js const kinsType = kinsTypeFromSwitchkinsTypeValue(state, ui.switchkinsType); ``` 问题: ```text task/HAL runtime status.ui.switchkinsType=0 时,store 直接解析为 identity。 但当前 activeLine 对应的 interpreter/canonical motion 仍处于 M428 后的 TCP 区间。 因此 task/HAL status 覆盖了程序语义。 ``` ## 5. 正确边界 整改原则: ```text 1. 不在可视化层硬编码 RTCP。 2. 不用 JavaScript 重新解释 G-code。 3. 优先消费 LinuxCNC interpreter 已输出的 canonical motion switchkins 信息。 4. task/HAL status 非零 switchkinsType 可直接采用。 5. task/HAL status 为 0 时,必须结合当前 activeLine 的 program motion 判断是否仍在 TCP 区间。 ``` ## 6. 修复目标 目标状态: ```text 预览态: threeRtcpState=on state.kinsType=tcp-xyzac RUN 后: threeRtcpState=on state.kinsType=tcp-xyzac programRuntimeFeedbackSource=linuxcnc-task-motion-hal-wasm ``` 同时,当程序执行到 M429/identity 区间时,仍允许正确回退: ```text activeLine 对应 motion.switchkinsType=0 -> kinsType=identity, rtcpState=off ```