接入 task HAL Web 仿真运行时

This commit is contained in:
2026-06-22 06:11:55 +08:00
parent 3771b9eafe
commit bd11a5f8d6
42 changed files with 5574 additions and 50 deletions

View File

@@ -39,8 +39,9 @@ CNC 语义必须来自 LinuxCNC source/WASM/source-derived boundary
| `xyzbc-trt` profile | `app/src/profiles/xyzbc-trt.js` | `configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini` | source/config reference + runtime module switch | profile node smoke + browser profile switch smoke |
| SWITCHKINS panel | `app/src/panel-schema/xyzac-trt-pyvcp.js` | `xyzac-trt.xml`, `switchkins_postgui.hal` | UI/HAL binding reference | profile boundary node smoke + browser DOM smoke |
| M428/M429/M430 state | `app/src/profiles/xyzac-trt.js`, `app/src/panel-schema/xyzac-trt-pyvcp.js` | `remap_subs/428remap.ngc`, `429remap.ngc`, `430remap.ngc` | LinuxCNC remap/source reference only until runtime adapter is connected | profile boundary node smoke |
| LinuxCNC boundary adapter | `app/src/runtime/linuxcnc-boundary-adapter.js` | LinuxCNC interpreter/kinematics/TP WASM adapter point | kinematics + interpreter + TP timing runtime connected; native task/realtime HAL still not ported | profile boundary node smoke + browser DOM smoke |
| Full execution boundary audit | `app/src/runtime/full-execution-boundary.js`, `app/src/state/store.js`, `app/src/ui/gmoccapy-shell.js` | LinuxCNC kinematics WASM, interpreter WASM, TP WASM, `runSimConfigProgram({ executionMode: "fiveAxisRemap" })`, TRT remap files | machine-file remap and TP timing ready; native task/realtime HAL blocked | full execution boundary node smoke + browser DOM smoke |
| LinuxCNC boundary adapter | `app/src/runtime/linuxcnc-boundary-adapter.js` | LinuxCNC interpreter/kinematics/TP WASM adapter point | kinematics + interpreter + TP timing runtime connected; task/motion/HAL simulation runtime connected separately | profile boundary node smoke + browser DOM smoke |
| Full execution boundary audit | `app/src/runtime/full-execution-boundary.js`, `app/src/state/store.js`, `app/src/ui/gmoccapy-shell.js` | LinuxCNC kinematics WASM, interpreter WASM, TP WASM, task/motion/HAL WASM, `runSimConfigProgram({ executionMode: "fiveAxisRemap" })`, TRT remap files | machine-file remap, TP timing, and task/motion/HAL ready for Web simulation boundary; hardware/realtime kernel/external processes still false | full execution boundary node smoke + browser DOM smoke |
| Native task / realtime HAL sync runtime | `docs/native-task-hal-sync-implementation-steps.md`, `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`, `app/src/runtime/linuxcnc-task-hal-runtime.js` | `src/emc/task/emctaskmain.cc`, `src/emc/task/emctask.cc`, `src/emc/task/taskintf.cc`, `src/emc/task/emccanon.cc`, `src/emc/motion/control.c`, `src/emc/motion/command.c`, `src/emc/motion/motion.c`, `src/hal/hal_lib.c`, `src/hal/hal_priv.h` | task/motion/HAL deterministic WASM simulation runtime; host realtime/hardware out of scope | source manifest, native opt-in probe, HAL runtime smoke, motion/HAL sync smoke, task/HAL WASM SDK smoke, Web store/browser smoke |
| Five-axis kinematics | `core/linuxcnc_kinematics_wasm` | `trtfuncs.c`, `xyzac-trt-kins.c`, `xyzbc-trt-kins.c`, `5axiskins.c` | LinuxCNC source-derived WASM | Node roundtrip smoke |
| RTCP/TCP frame | `app/src/runtime/rtcp-frame.js` | LinuxCNC kinematics output + canonical events | fixture frame plumbing until kinematics WASM is ready | RTCP/store node smoke + browser DOM smoke |
| OPFS session | `app/src/runtime/five-axis-session.js` | current `wasm-port/runtime/opfs` | browser OPFS 5-axis session persistence | five_axis_session_smoke + browser save/restore smoke |
@@ -127,7 +128,7 @@ src/emc/kinematics/kins_util.c
| RTCP frame UI plumbing | implemented_fixture_and_kinematics_wasm | fixture fallback 仍为 `linuxCncKinematicsReady=false`browser/node kinematics proof 为 `source-derived-kinematics-wasm` / `linuxcnc_kinematics_wasm_c_abi` |
| Operator workflow | implemented_linuxcnc_task_policy_with_canonical_motion | 上电/急停/复位/模式/JOG/MDI/RUN/PAUSE/RESUME/STOP/HOME 通过 `linuxcnc_task_state_mode_command_gate`;普通程序执行来自 LinuxCNC canonical motion |
| LinuxCNC boundary adapter | kinematics_and_interpreter_connected | `web-rtcp-5axis-linuxcnc-boundary-adapter` 可区分 kinematics-only ready 与 interpreter/remap missing |
| Full execution boundary audit | implemented_remap_ready_planner_task_hal_blocked | `web-rtcp-5axis-full-linuxcnc-execution-boundary` 汇总 kinematics/interpreter/machine-file-remap evidence仍明确 `plannerRuntimeReady=false``nativeTaskReady=false``nativeHalSyncReady=false``fullLinuxCncProgramExecutionReady=false` |
| Full execution boundary audit | implemented_task_motion_hal_simulation_runtime | `web-rtcp-5axis-full-linuxcnc-execution-boundary` 汇总 kinematics/interpreter/machine-file-remap/TP/task-HAL evidenceWeb simulation boundary 可提升,仍明确 `hardwareDrive=false``hostRealtimeKernel=false``externalUserMProcessReady=false``toolDbProcessReady=false` |
| PyVCP/HAL panel schema | implemented_reference_only | `xyzac-trt-switchkins-pyvcp` 已整理 SWITCHKINS 控件与 HAL nets不执行 native HAL |
| Python GUI runtime | not_ported | 只参考,不运行 |
| Python remap runtime | blocked | 不在第一版实现 |
@@ -958,6 +959,182 @@ Next:
trajectory_planner_wasm_boundary_or_native_task_hal_port
```
## 22. Native Task/HAL Phase 0-4 追溯记录
```text
Batch: native-task-hal-phase0-4-runtime-boundary
Date: 2026-06-22 CST
Files changed:
wasm-port/tools/task-hal-source-manifest.txt
wasm-port/tools/verify_task_hal_source_manifest.sh
wasm-port/tests/native/probe_trt_task_hal_runtime.sh
wasm-port/runtime/core/shims/hal.h
wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_hal_runtime.hh
wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_hal_runtime.cpp
wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_hal_runtime_probe.cpp
wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_motion_runtime.h
wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_motion_runtime.c
wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.hh
wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp
wasm-port/tools/build_task_hal_wasm.sh
wasm-port/runtime/sdk/src/linuxcnc-task-hal.js
wasm-port/runtime/sdk/src/index.js
wasm-port/tests/wasm/node/verify_hal_runtime.sh
wasm-port/tests/wasm/node/verify_motion_hal_sync.sh
wasm-port/tests/wasm/node/verify_task_hal_wasm.sh
wasm-port/tests/wasm/node/verify_task_hal_sdk.sh
Feature:
Establishes the unpromoted native task/HAL implementation path through
phase 0 source manifest evidence, phase 1 opt-in native TRT task/HAL probe,
phase 2 C/C++ HAL runtime registry, and phase 3 minimal motion/HAL servo-cycle
C ABI. The HAL runtime owns pin/signal/param/net/thread state and blocks
`loadusr`; the motion runtime accepts LinuxCNC-style command JSON and
synchronizes `motion.*`, `axis.*`, and `joint.*` HAL pins on deterministic
servo cycles. Phase 4 adds the planned `lctask_*` C ABI as an in-process
task shim that stages files, opens a program, tracks task state/mode/interp
and exec status, and forwards RUN/PAUSE/RESUME/ABORT/MDI/JOG into motion/HAL
runtime snapshots. It also adds the SDK wrapper needed for later Worker
integration.
LinuxCNC references:
src/emc/task/task.hh
src/emc/task/emctask.cc
src/emc/task/emctaskmain.cc
src/emc/task/taskintf.cc
src/emc/task/emccanon.cc
src/emc/nml_intf/emc.hh
src/emc/motion/motion.h
src/emc/motion/command.c
src/emc/motion/control.c
src/emc/motion/mot_priv.h
src/hal/hal_lib.c
src/hal/hal_priv.h
src/hal/components/threads.c
Boundary:
taskHalSourceManifestReady=true
nativeTaskHalProbe=opt_in_ready_disabled_by_default
halRuntimeBoundary=linuxcnc_hal_runtime_phase2_minimal
motionHalBoundary=linuxcnc_motion_runtime_phase3_minimal
taskHalBoundary=linuxcnc_task_motion_hal_wasm_phase4_minimal
nativeTaskReady=false
nativeHalSyncReady=false
fullLinuxCncProgramExecutionReady=false
promotionAllowed=false
Tests:
wasm-port/tools/verify_task_hal_source_manifest.sh
wasm-port/tests/native/probe_trt_task_hal_runtime.sh
wasm-port/tests/wasm/node/verify_hal_runtime.sh
wasm-port/tests/wasm/node/verify_motion_hal_sync.sh
wasm-port/tests/wasm/node/verify_task_hal_wasm.sh
wasm-port/tests/wasm/node/verify_task_hal_sdk.sh
Result:
task_hal_source_manifest_ready=1
native_probe_status=ready_disabled_by_default
hal_runtime_registry=ok
hal_net_signal_propagation=ok
hal_thread_scheduler=ok
loadusr_blocked_evidence=ok
motion_hal_servo_cycle=ok
motion_program_line_hal_sync=ok
switchkins_type_hal_sync=ok
jog_motion_status_sync=ok
linuxcnc_task_runtime_smoke=ok
task_status_from_linuxcnc_runtime=ok
task_commands_drive_motion_runtime=ok
mdi_jog_task_motion_hal_sync=ok
linuxcnc_task_hal_sdk=ok
Remaining risk:
Phase 4 is still a narrow deterministic runtime-edge adapter. Full LinuxCNC
task loop, in-process NML queue sourced from `emc.hh`, canonical queue,
real `emcmotController()`, machine-file session integration, native/WASM
comparison artifacts, and browser Worker/store wiring are still required
before promotion.
Next:
task_hal_machine_file_session_and_worker_wiring
```
## 20. M20 追溯记录
```text
Batch: M20-task-hal-machine-file-worker-boundary
Date: 2026-06-22 CST
Files changed:
app/src/runtime/linuxcnc-task-hal-runtime.js
app/src/runtime/linuxcnc-task-hal-worker.js
app/src/runtime/linuxcnc-task-hal-worker-client.js
app/src/runtime/linuxcnc-machine-file-staging.js
app/src/runtime/full-execution-boundary.js
app/src/state/store.js
app/src/ui/gmoccapy-shell.js
app/scripts/build-static.mjs
tests/node/verify_linuxcnc_task_hal_runtime.mjs
tests/node/verify_full_execution_boundary.mjs
Feature:
Connects the task/motion/HAL WASM runtime to the Web simulator boundary.
Machine-file staging now emits a task/HAL session descriptor. The Web runtime
can init/stage/open files, send task commands, run deterministic task/servo
cycles, read task/motion/HAL status, and map `motion.program-line` plus
`motion.switchkins-type` back into gmoccapy current line, DRO, RTCP state, and
diagnostics. Full boundary promotion now depends on task runtime, motion
runtime, HAL runtime, HAL sync, and task/HAL cycle artifact evidence.
LinuxCNC references:
src/emc/task/task.hh
src/emc/task/emctask.cc
src/emc/task/emctaskmain.cc
src/emc/task/taskintf.cc
src/emc/task/emccanon.cc
src/emc/nml_intf/emc.hh
src/emc/motion/motion.h
src/emc/motion/command.c
src/emc/motion/control.c
src/hal/hal_lib.c
src/hal/hal_priv.h
src/hal/components/threads.c
Boundary:
taskHalBoundary=linuxcnc_task_motion_hal_wasm_simulation_runtime
nativeTaskReady=true for Web simulation boundary
nativeHalSyncReady=true for Web simulation boundary
fullLinuxCncProgramExecutionReady=true when kinematics/interpreter/machine-file-remap/TP/task-HAL gates pass
hardwareDrive=false
hostRealtimeKernel=false
externalUserMProcessReady=false
toolDbProcessReady=false
Tests:
bash wasm-port/tools/build_task_hal_wasm.sh
bash wasm-port/tools/verify_task_hal_source_manifest.sh
bash wasm-port/tests/native/verify_task_hal_phase0.sh
bash wasm-port/tests/native/probe_trt_task_hal_runtime.sh
bash wasm-port/tests/wasm/node/verify_hal_runtime.sh
bash wasm-port/tests/wasm/node/verify_motion_hal_sync.sh
bash wasm-port/tests/wasm/node/verify_task_hal_wasm.sh
bash wasm-port/tests/wasm/node/verify_task_hal_sdk.sh
node web-rtcp-5axis-sim-plan/tests/node/verify_linuxcnc_task_hal_runtime.mjs
npm --prefix web-rtcp-5axis-sim-plan/app run smoke:node
npm --prefix web-rtcp-5axis-sim-plan/app run build
npm --prefix web-rtcp-5axis-sim-plan/app run smoke
Result:
linuxcnc_task_hal_wasm_build=ok
task_hal_source_manifest_ready=1
task_hal_phase0_native_probe_gate=ok
native_probe_status=ready_disabled_by_default
hal_runtime_registry=ok
motion_hal_sync_smoke=ok
linuxcnc_task_runtime_smoke=ok
linuxcnc_task_hal_sdk=ok
linuxcnc_task_hal_runtime_smoke=ok
task_hal_machine_file_smoke=ok
switchkins_remap_hal_sync_smoke=ok
browser_task_hal_worker_smoke=ok
gmoccapy_static_build=ok
gmoccapy_shell_smoke=ok
gmoccapy_dist_smoke=ok
Remaining risk:
The promoted boundary is deterministic Web simulation only. It does not run
a host LinuxCNC realtime kernel, hardware IO, Mesa/parallel-port drivers,
arbitrary external user-M processes, or the full tool DB process.
Next:
hardware_realtime_external_processes_if_required
```
## 16. M12 追溯记录
```text