Files
cnc_wams/web-rtcp-5axis-sim-plan/gptlog-process/gpdlog.md
2026-07-02 23:53:51 -04:00

135 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 2026-07-03 web-rtcp-5axis-xyzbc-trt-sim-plan50ms G 代码执行过程采样同步
本轮接续上一轮任务,目标是针对 `/home/mes123456/cnc_wams/web-rtcp-5axis-xyzbc-trt-sim-plan`,按用户要求完整记录 LinuxCNC 源程序和 Web 数控系统仿真程序的 G 代码完整执行过程,并将采样周期暂定统一为 50 毫秒。
执行过程:
1. 检查项目工作目录和 `working` 文档,确认上一轮已完成 T-001 到 T-046包括 `semanticExecutionPath``lineExecutionTrace``axisValuesByLine``gcodeExecutionProcess` 和 compare 对标字段。
2. 检查 git 工作树发现已有多处未提交修改包括采集脚本、compare 脚本、前端运行态、`working` 文档和 evidence JSON本轮未回退任何已有改动。
3. 搜索采样周期相关硬编码,发现 native 采集器、Web 采集器、Web AXIS 路径生成器、compare 脚本和 Node smoke 中均仍以 20ms 为当前采样周期。
4. 修改以下文件,将当前采样周期统一调整为 50ms
- `tools/collect-native-xyzbc-trt-evidence.py`
- `tools/collect-web-xyzbc-trt-evidence.mjs`
- `app/src/runtime/axis-preview-path.js`
- `tools/compare-xyzbc-trt-evidence.mjs`
- `tests/node/verify_xyzbc_trt_web_app.mjs`
5. 先运行 `npm --prefix app run evidence:web`,确认 Web evidence 可生成并读取新样本规模Web `previewPath.sampleCount=1300``executionPath.sampleCount=228``semanticExecutionPath.sampleCount=1300`
6. 运行 `python3 -m py_compile tools/collect-native-xyzbc-trt-evidence.py`,确认 native 采集器语法通过。
7. 运行 `/home/mes123456/cnc_wams/linuxcnc/scripts/rip-environment python3 tools/collect-native-xyzbc-trt-evidence.py --run --timeout 80`,重新生成 native evidence。
8. 重新运行:
- `npm --prefix app run evidence:web`
- `npm --prefix app run evidence:compare`
- `npm --prefix app run smoke:node`
- `npm --prefix app run build`
- `npm --prefix app run smoke:browser`
9. 验证结果全部通过:
- native evidence 生成成功;
- Web evidence 生成成功;
- compare 输出 `compare_xyzbc_trt_status=pass`
- Node smoke 输出 `xyzbc_trt_web_app_smoke=ok`
- build 输出 `gmoccapy_static_build=ok`
- browser smoke 输出 `xyzbc_trt_browser_smoke=ok`
10. 当前 JSON 关键结果:
- `native.pathSampling.samplePeriodMs=50`
- `native.previewPath.sampleCount=1300`
- `native.executionPath.sampleCount=4`
- `native.executionPath.taskHal.completed=true`
- `native.semanticExecutionPath.sampleCount=1300`
- `web.pathSampling.samplePeriodMs=50`
- `web.previewPath.sampleCount=1300`
- `web.executionPath.sampleCount=228`
- `web.executionPath.taskHal.completed=true`
- `web.semanticExecutionPath.sampleCount=1300`
- `lineExecutionTrace.length=64`
- `axisValuesByLine.length=29`
- `gcodeExecutionProcess.executionStepCount=128`
- `gcodeExecutionProcess.sourceLineCoverage.length=65`
- `compare.summary.checkCount=35`
- `compare.summary.passCount=35`
- `compare.summary.failCount=0`
- `compare.summary.blockers=[]`
- `compare.pathComparison.samplePeriodMs=50`
11. 更新 `working` 文档当前规范和验收摘要使采样周期、样本数、compare 结果与新生成 evidence 一致,主要涉及:
- `working/01-项目功能内容.md`
- `working/02-项目程序开发详细步骤.md`
- `working/03-推进台账.md`
- `working/04-任务矩阵.md`
- `working/05-验收证据.md`
- `working/06-决策记录.md`
- `working/07-全量对标追踪矩阵.md`
- `working/09-设计任务书与技术方案整合.md`
- `working/README.md`
12. 搜索确认源码、采集脚本、测试和当前规范文档中没有剩余以 20ms 作为当前采样规范的硬编码或描述。
13. 检查 4174 端口可用后,在 `app` 目录启动本地 Web 服务:`python3 -m http.server 4174`,访问地址为 `http://127.0.0.1:4174/`
结论:
当前项目已按用户本轮要求,把 LinuxCNC 源程序与 Web 数控系统仿真程序的 G 代码完整执行过程采样周期统一为 50ms。native/Web evidence 与 compare evidence 已重新生成并全部通过。完整记录内容覆盖刀具预览路径、真实执行反馈路径、源程序语义执行路径、逐行 G 代码 trace、每行轴值、主轴/进给/刀具/冷却等运行字段承载结构,以及完整动态执行步骤和源行覆盖。
## 2026-07-03 web-rtcp-5axis-sim-plan按 working1 验收并修复 G93 G 代码执行计时
本轮用户提问:按 `/home/mes123456/cnc_wams/web-rtcp-5axis-sim-plan/working1` 完成“G代码执行”任务。
执行过程:
1. 读取根目录 `AGENTS.md`,确认每次 Codex 执行完毕后需要将提问、结论和完整执行过程用中文追加到 `gptlog-process/gpdlog.md`
2. 读取 `备忘/备忘G代码执行过程.txt`,确认用户关注点是完整记录 LinuxCNC 源程序和 Web 数控系统仿真程序的 G 代码执行过程,包括逐行执行、真实速度、轴位置、主轴、进给、换刀、冷却和 JSON 记录。
3. 读取 `web-rtcp-5axis-sim-plan/working1/README.md``01-problem-review.md``02-repair-plan.md``03-implementation-steps.md``04-traceability-matrix.md``05-acceptance-test-plan.md`,确认 working1 的主要验收点为:
- D1RTCP frame 自动进入 LinuxCNC kinematics WASM 边界;
- D23D 预览首屏和运行态可见;
- D3HOME 后 JOG 坐标连续;
- 相关 G-code 执行反馈、预览路径、执行路径和 task/HAL 状态不能回归。
4. 检查 git 工作树,发现已有其他项目和日志相关未提交改动;本轮只修改 `web-rtcp-5axis-sim-plan/app/src/runtime/execution-timing.js``web-rtcp-5axis-sim-plan/app/src/runtime/linuxcnc-interpreter-runtime.js` 和本日志文件,未回退任何用户已有改动。
5. 搜索并检查当前实现,确认 `desiredFrameSourceMode``pendingJogCommand``axisPoseFrame`、可见 Three.js/fallback 预览模型等 working1 D1/D2/D3 关键修复已经存在。
6. 先执行 working1 验收中的构建和核心 Node 测试:
- `npm --prefix web-rtcp-5axis-sim-plan/app run build`,结果 `gmoccapy_static_build=ok`
- `node web-rtcp-5axis-sim-plan/tests/node/verify_rtcp_store.mjs`,结果 `rtcp_store_smoke=ok`
- `node web-rtcp-5axis-sim-plan/tests/node/verify_five_axis_session.mjs`,结果 `five_axis_session_smoke=ok`
- `node web-rtcp-5axis-sim-plan/tests/node/verify_linuxcnc_kinematics_runtime.mjs`,结果 `linuxcnc_kinematics_runtime_smoke=ok`
- `node web-rtcp-5axis-sim-plan/tests/node/verify_linuxcnc_task_hal_runtime.mjs`,结果 `linuxcnc_task_hal_runtime_smoke=ok`
- `node web-rtcp-5axis-sim-plan/tests/node/verify_full_execution_boundary.mjs`,结果 `full_execution_boundary_smoke=ok`
7. 执行浏览器 smoke`npm --prefix web-rtcp-5axis-sim-plan/app run smoke`,结果 `gmoccapy_shell_smoke=ok``gmoccapy_dist_smoke=ok`。浏览器 smoke 覆盖首屏 kinematics worker、Three.js 预览 dataset、canvas 非空、G-code 行执行显示、profile 切换和多项 UI 状态。
8. 为贴近“G代码执行”要求补跑执行链路相关测试
- `node web-rtcp-5axis-sim-plan/tests/node/verify_run_feedback_loop.mjs`,通过;
- `node web-rtcp-5axis-sim-plan/tests/node/verify_real_linuxcnc_5axis_program_cases.mjs`,通过;
- `node web-rtcp-5axis-sim-plan/tests/node/verify_machine_file_staging.mjs`,通过;
- `node web-rtcp-5axis-sim-plan/tests/node/verify_impeller_feed_task_hal_run.mjs`,首次失败。
9. 分析失败测试,发现 `verify_impeller_feed_task_hal_run.mjs` 期望 G93 inverse-time 程序中 `F159``F636` 对应的 timing segment 使用源程序 F 字计算持续时间,即 `60 / F`;但当前 `execution.motion.feedRate` 保存的是 LinuxCNC canonical 输出的实际速度值,例如 `283.917``59.1226`,不是源程序 F 字,导致 timing segment 找不到 `feedRate === 159``feedRate === 636`
10. 编写临时 Node 检查脚本读取 `working_run/test_linuxcnc_source/impeller-7bl-xyzac.ngc`,确认:
- 程序第 5 行为 `G93`
- 源程序中存在大量 `F 159``F 636`
- 解释器 motion 的 `feedMode` 已经正确识别为 `inverse-time`
- 解释器 motion 的 `feedRate` 当前是 canonical 速度值,不应直接改成源 F 字,否则会破坏已有 interpreter 测试。
11. 采用兼容修复方案:
-`linuxcnc-interpreter-runtime.js``parseLinuxCncCanonicalMotion()` 中新增 `activeSourceFeedRate`,按源 G-code 行追踪最近的 F 字,并在每个 motion 事件上输出 `sourceFeedRate`
- 保留原有 `feedRate` 语义继续表示 LinuxCNC canonical feed 输出;
-`execution-timing.js``buildProgramExecutionTiming()` 中,若当前 motion 为 `feedMode="inverse-time"`,优先使用 `sourceFeedRate` 作为计时用进给;普通 G94/units-per-minute 仍使用原有 `feedRate`
- 在 timing segment 中增加 `canonicalFeedRate``sourceFeedRate` 字段,便于后续 JSON 审计区分 canonical 速度和源程序 F 字。
12. 修改后复跑失败测试:
- `node web-rtcp-5axis-sim-plan/tests/node/verify_impeller_feed_task_hal_run.mjs` 通过;
- 输出 `impeller_f159_duration_seconds=0.37735849056603776`,等于 `60 / 159`
- 输出 `impeller_f636_duration_seconds=0.09433962264150944`,等于 `60 / 636`
- 输出 `impeller_feed_task_hal_run=ok`
13. 为确认没有破坏已有语义,复跑:
- `node web-rtcp-5axis-sim-plan/tests/node/verify_linuxcnc_interpreter_runtime.mjs`,通过,说明 canonical feed 语义仍保留;
- `node web-rtcp-5axis-sim-plan/tests/node/verify_linear_unit_conversion.mjs`,通过,说明 G20/G21 和 G93 单位换算计时未回归。
14. 复跑 working1 核心验收:
- `npm --prefix web-rtcp-5axis-sim-plan/app run build` 通过;
- `verify_rtcp_store.mjs` 通过;
- `verify_five_axis_session.mjs` 通过;
- `verify_linuxcnc_kinematics_runtime.mjs` 通过;
- `verify_linuxcnc_task_hal_runtime.mjs` 通过;
- `verify_full_execution_boundary.mjs` 通过。
15. 复跑浏览器和 G-code 执行回归:
- `npm --prefix web-rtcp-5axis-sim-plan/app run smoke` 通过;
- `verify_run_feedback_loop.mjs` 通过;
- `verify_real_linuxcnc_5axis_program_cases.mjs` 通过;
- `verify_machine_file_staging.mjs` 通过。
16. 最后整理 `execution-timing.js` 中参数缩进,再次复跑:
- `node web-rtcp-5axis-sim-plan/tests/node/verify_impeller_feed_task_hal_run.mjs` 通过;
- `npm --prefix web-rtcp-5axis-sim-plan/app run build` 通过。
结论:
本轮已按 `working1` 完成并验证 G 代码执行相关闭环。working1 的 D1/D2/D3 关键验收点保持通过;同时修复了 G93 inverse-time G-code 执行计时中源程序 F 字丢失的问题。现在 Web 执行计时既保留 LinuxCNC canonical feed 输出,又能用源 G-code 的 `F159/F636` 正确计算每段真实执行时间,并能继续传递到 task/HAL motion plan 和运行反馈测试中。