完善虚拟HAL仿真替代能力
This commit is contained in:
254
text16.txt
254
text16.txt
@@ -1179,3 +1179,257 @@ git diff --check ok
|
||||
- grid 和 labels 只使用当前 preview viewBox;
|
||||
- Three.js 仍只显示 LinuxCNC canonical motion;
|
||||
- pixel smoke 只验证渲染非空,不推导 CNC 语义。
|
||||
|
||||
### 十七、2026-06-17 Browser Virtual HAL for AXIS Manual Controls
|
||||
|
||||
接续“虚拟 HAL 业务”,本批把 AXIS 手动控制从静态未绑定状态推进为浏览器
|
||||
虚拟 HAL 状态模型,并接入 UI、SDK 和 WASM bridge。
|
||||
|
||||
本批新增实质能力:
|
||||
|
||||
- 新增 `wasm-port/runtime/sdk/src/linuxcnc-hal.js`:
|
||||
- `VIRTUAL_HAL_AXISUI_PINS` 对齐 `linuxcnc/bin/axis` 中的 axisui pins:
|
||||
`jog.x/y/z/a/b/c/u/v/w`、`jog.increment`、notification pins、
|
||||
`error`、`abort`;
|
||||
- `createVirtualHalState()` / `applyVirtualHalAction()` 管理 ESTOP、Power、
|
||||
Home、Jog、Touch Off、Spindle、Coolant、Limit Override、Brake 等状态;
|
||||
- `createVirtualHalDroState()` 输出 AXIS DRO 默认/实际位置;
|
||||
- `createVirtualHalLimitsHomeState()` 输出 home/limit/fault rows;
|
||||
- `createVirtualHalMachineStatusState()` 输出 spindle/coolant/tool/override state;
|
||||
- `createVirtualHalWasmBridgeSnapshot()` 生成可写入 standalone HAL adapter 的
|
||||
pin/value snapshot。
|
||||
|
||||
- SDK 入口新增 re-export:
|
||||
- virtual HAL 状态、action、DRO、limits/home、machine status、runtime、
|
||||
bridge snapshot、jog increment parser。
|
||||
|
||||
- Interpreter SDK 新增 HAL bridge API:
|
||||
- `hasWasmFunction(name)`;
|
||||
- `resetHal()`;
|
||||
- `setHalValue({ kind, name, type, value, connected })`;
|
||||
- `applyVirtualHalSnapshot(snapshot, options)`;
|
||||
- `applyVirtualHalState(halState, options)`;
|
||||
- `probeHalNamed(name)`。
|
||||
|
||||
- WASM wrapper 新增导出:
|
||||
- `lcinterp_hal_reset()`;
|
||||
- `lcinterp_hal_set_value()`;
|
||||
- `lcinterp_probe_hal_named()`;
|
||||
- `build_wasm_core.sh` 已把这些函数加入 `EXPORTED_FUNCTIONS`。
|
||||
|
||||
- Browser simulation UI 接入:
|
||||
- F1/F2 快捷键驱动 ESTOP/Power;
|
||||
- Ctrl-Home 驱动 Home All;
|
||||
- Manual jog 更新 `jog.*` pins 和 DRO;
|
||||
- spindle/coolant/brake/limit override 写入 virtual HAL state;
|
||||
- diagnostics artifact 新增 `virtualHal`;
|
||||
- machine control state 从“not bound”变为
|
||||
`browser virtual HAL active for jog/spindle/coolant/home simulation`。
|
||||
|
||||
- Bridge snapshot 同时输出:
|
||||
- AXIS Python component 内部 pin 名,例如 `jog.x`;
|
||||
- HAL 全名,例如 `axisui.jog.x`;
|
||||
- machine/task pins,例如 `halui.machine.is-on`;
|
||||
- spindle/coolant pins,例如 `spindle.0.speed-out`、
|
||||
`iocontrol.0.coolant-flood`。
|
||||
|
||||
新增/扩展验证:
|
||||
|
||||
- `verify_real_simulation_programs.mjs` 覆盖 virtual HAL SDK、runtime snapshot、
|
||||
`axisui.*` HAL 全名、DRO、home、spindle、coolant;
|
||||
- `real_simulation_page_smoke.html` 覆盖 F1/F2/Ctrl-Home/jog/spindle/coolant 的
|
||||
浏览器交互;
|
||||
- `verify_interp_wasm.mjs` 在新 WASM 导出存在时验证:
|
||||
`applyVirtualHalState()` 写入 HAL adapter 后,`probeHalNamed()` 能读到
|
||||
`_hal[jog.x]`、`_hal[axisui.jog.x]`、`_hal[halui.machine.is-on]`、
|
||||
`_hal[spindle.0.speed-out]`、`_hal[iocontrol.0.coolant-flood]`。
|
||||
|
||||
关键验证:
|
||||
|
||||
```text
|
||||
real_simulation_programs_node_smoke=ok
|
||||
interp_wasm_node_smoke=ok (SKIP_INTERP_BUILD=1)
|
||||
browser_real_simulation_page_smoke=ok (SKIP_INTERP_BUILD=1)
|
||||
sdk_surface_node_smoke=ok
|
||||
ui_node_smokes=ok
|
||||
git diff --check ok
|
||||
```
|
||||
|
||||
当前构建备注:
|
||||
|
||||
- 当前 Codex shell 的 `PATH` 未解析到 `emcc`,完整 `build_wasm_core.sh` 会停在
|
||||
`emcc: command not found`;
|
||||
- 这不是代码侧缺少 Emscripten 的结论,只是本 shell 未加载用户已有的
|
||||
Emscripten 环境;
|
||||
- 快速 smoke 已用现有 WASM 产物验证旧路径不回归,新导出的 HAL bridge smoke 会在
|
||||
重建后的 WASM 存在对应函数时自动执行。
|
||||
|
||||
语义边界:
|
||||
|
||||
- virtual HAL 只模拟 AXIS/manual UI 与 standalone HAL adapter 的状态桥;
|
||||
- 不在浏览器端实现 LinuxCNC realtime HAL、motion controller、planner、
|
||||
kinematics 或 G-code 语义;
|
||||
- G-code execution 和 canonical motion 仍来自 LinuxCNC interpreter WASM。
|
||||
|
||||
### 十八、2026-06-17 Project-level Virtual HAL SDK Boundary
|
||||
|
||||
按用户要求“虚拟 HAL 适合整个项目”,本批把上一节的 simulation/UI 虚拟 HAL
|
||||
提升为项目级 SDK host-boundary 能力,供 simulation、INI panel、Node/browser
|
||||
smoke、外部 dashboard 和 interpreter bridge 共用。
|
||||
|
||||
新增项目级 API:
|
||||
|
||||
- `VIRTUAL_HAL_WASM_BRIDGE_FUNCTIONS`:
|
||||
- `lcinterp_hal_reset`;
|
||||
- `lcinterp_hal_set_value`;
|
||||
- `lcinterp_probe_hal_named`;
|
||||
- `VIRTUAL_HAL_PROJECT_PIN_GROUPS`:
|
||||
- `axisui`;
|
||||
- `axis`;
|
||||
- `task`;
|
||||
- `spindle-coolant`;
|
||||
- `createVirtualHalPinInventory(halState)`:
|
||||
- 输出全部 bridge pin rows;
|
||||
- 按项目级 pin group 归类;
|
||||
- `createVirtualHalBridgeReadiness(options)`:
|
||||
- 检查 snapshot 是否包含 required pins;
|
||||
- 检查 caller-provided WASM function evidence 是否覆盖
|
||||
`VIRTUAL_HAL_WASM_BRIDGE_FUNCTIONS`;
|
||||
- 无 evidence 时显式 blocked:`wasm-function-evidence`;
|
||||
- `createVirtualHalBridgeActionPlan(readiness)`:
|
||||
- blocked 时给出下一步:
|
||||
`wasm-port/tools/build_wasm_core.sh`;
|
||||
`SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_interp_wasm.sh`;
|
||||
- ready 时返回空 command;
|
||||
- `createVirtualHalProjectReport(options)`:
|
||||
- 汇总 state、DRO、limits/home、machine status、pin inventory、
|
||||
WASM bridge snapshot、bridge readiness、bridge action plan;
|
||||
- `applyVirtualHalToInterpSdk(interpSdk, halState, options)`:
|
||||
- 对有 `applyVirtualHalState()` 或 `applyVirtualHalSnapshot()` 的 interpreter
|
||||
SDK 做统一适配;
|
||||
- `createLinuxCncVirtualHalRuntime()` 新增:
|
||||
- `getPinInventory()`;
|
||||
- `getProjectReport(options)`;
|
||||
- `applyToInterpSdk(interpSdk, options)`。
|
||||
|
||||
文档同步:
|
||||
|
||||
- `runtime/sdk/README.md` 新增 `Project-level virtual HAL boundary` 小节;
|
||||
- `docs/project-release-handoff.md` 把 project-level virtual HAL 纳入当前支持
|
||||
workflow;
|
||||
- `PROJECT_COMPLETION_TRACKER.md` 的 SDK/API surface 行记录 pin inventory、
|
||||
bridge readiness/action-plan、project report、interpreter apply adapter;
|
||||
- `verify_project_release_handoff_docs.mjs` 增加文档 gate,防止后续退回页面私有
|
||||
virtual HAL。
|
||||
|
||||
新增/扩展验证:
|
||||
|
||||
- `verify_sdk_surface.mjs` 覆盖:
|
||||
- SDK re-export;
|
||||
- constants discovery;
|
||||
- virtual HAL snapshot;
|
||||
- pin inventory;
|
||||
- blocked/ready bridge readiness;
|
||||
- bridge action plan;
|
||||
- project report;
|
||||
- runtime project report;
|
||||
- fake interpreter SDK apply wrapper;
|
||||
- `verify_project_release_handoff_docs.mjs` 覆盖 handoff/README 中的项目级
|
||||
virtual HAL API 和 realtime HAL runtime 边界声明。
|
||||
|
||||
关键验证:
|
||||
|
||||
```text
|
||||
sdk_surface_node_smoke=ok
|
||||
project_release_handoff_docs_node_smoke=ok
|
||||
real_simulation_programs_node_smoke=ok
|
||||
git diff --check ok
|
||||
```
|
||||
|
||||
语义边界:
|
||||
|
||||
- project-level virtual HAL 仍是 host-boundary adapter;
|
||||
- 它可服务 UI/session/diagnostics/dashboard 和 `_hal[...]` interpreter probe;
|
||||
- 它不是 LinuxCNC realtime HAL runtime;
|
||||
- 不提升 task、motion、HAL module loading、HALUI process、Tcl/Python process、
|
||||
external device semantics。
|
||||
|
||||
### 十九、2026-06-17 Simulation-grade LinuxCNC Realtime HAL / halcmd / Motion Replacement
|
||||
|
||||
按用户要求“在满足仿真方面,实现 LinuxCNC realtime HAL / halcmd / motion controller
|
||||
的完整替代,以虚拟 HAL 方式实现”,本批把上一节项目级 virtual HAL 从 bridge/readiness
|
||||
推进为仿真级 runtime replacement。
|
||||
|
||||
新增实质能力:
|
||||
|
||||
- `VIRTUAL_HAL_SIMULATION_REPLACEMENT_TARGETS`:
|
||||
- `linuxcnc-realtime-hal`;
|
||||
- `halcmd`;
|
||||
- `motion-controller`;
|
||||
- `VIRTUAL_HAL_SIMULATION_RUNTIME_CAPABILITIES` 新增:
|
||||
- `realtime-hal-simulation-replacement`;
|
||||
- `halcmd-simulation-replacement`;
|
||||
- `motion-controller-simulation-replacement`;
|
||||
- 新增 `executeVirtualHalcmd()`:
|
||||
- 作为 `executeVirtualHalCommand()` 的 halcmd 语义别名;
|
||||
- 支持当前仿真所需 `setp`、`sets`、`newsig`、`net`、`show`、`getp`、`gets`、
|
||||
`loadrt`、`loadusr`、`addf`、`start`、`stop`、`unlinkp`、`motion-step`;
|
||||
- 新增 `stepVirtualHalMotionController()`:
|
||||
- 多周期 servo step;
|
||||
- 输出每周期 position/motion frame;
|
||||
- 更新 target、velocity、distance-to-go、in-position;
|
||||
- 新增 `createVirtualHalSimulationReplacementReport()`:
|
||||
- 明确报告 realtime HAL、halcmd、motion controller 三类仿真替代 ready 状态;
|
||||
- 保留 `hardRealtime: false`、`realtimeKernelAbi: false`,避免伪装为 Linux kernel
|
||||
realtime ABI;
|
||||
- `createLinuxCncVirtualHalRuntime()` 新增:
|
||||
- `executeHalcmd()`;
|
||||
- `stepMotionController()`;
|
||||
- `getSimulationReplacementReport()`。
|
||||
|
||||
Browser simulation API 新增:
|
||||
|
||||
- `executeVirtualHalcmd()`;
|
||||
- `executeVirtualHalCommand()`;
|
||||
- `stepVirtualHalMotionController()`;
|
||||
- `getVirtualHalSimulationRuntimeReport()`;
|
||||
- `getVirtualHalSimulationReplacementReport()`;
|
||||
- `getVirtualRealtimeHalRuntimeReport()`;
|
||||
- diagnostics artifact 新增 `virtualHalSimulationReplacement`。
|
||||
|
||||
新增/扩展验证:
|
||||
|
||||
- `verify_sdk_surface.mjs` 覆盖:
|
||||
- replacement target constants;
|
||||
- runtime capability constants;
|
||||
- `executeVirtualHalcmd()`;
|
||||
- `stepVirtualHalMotionController()`;
|
||||
- `createVirtualHalSimulationReplacementReport()`;
|
||||
- runtime wrapper 的 `executeHalcmd()` / `stepMotionController()` /
|
||||
`getSimulationReplacementReport()`;
|
||||
- `real_simulation_page_smoke.html` 覆盖:
|
||||
- 页面 API 暴露 halcmd/motion/replacement report;
|
||||
- browser 中执行 `loadrt`、`addf`、`setp`、`show pin`;
|
||||
- browser 中执行 motion controller 多周期 step;
|
||||
- diagnostics artifact 携带 replacement report。
|
||||
|
||||
关键验证:
|
||||
|
||||
```text
|
||||
sdk_surface_node_smoke=ok
|
||||
project_release_gate_manifest_node_smoke=ok
|
||||
project_release_artifact_url_workflow_node_smoke=ok
|
||||
project_batch_acceptance_workflow_node_smoke=ok
|
||||
project_batch_acceptance_artifact_node_smoke=ok
|
||||
real_simulation_programs_node_smoke=ok
|
||||
browser_real_simulation_page_smoke=ok
|
||||
git diff --check ok
|
||||
```
|
||||
|
||||
语义边界:
|
||||
|
||||
- 本批实现的是 simulation-grade replacement;
|
||||
- Browser/SDK 仿真不再依赖 host `halcmd`、host realtime HAL process 或 host motion
|
||||
process 来完成页面/Node 仿真闭环;
|
||||
- 仍不声称提供 Linux kernel hard-realtime ABI、外部硬件驱动 ABI、native HAL module ABI;
|
||||
- G-code 执行、canonical event、planner/interpreter 语义仍来自 LinuxCNC-backed WASM。
|
||||
|
||||
Reference in New Issue
Block a user