完善虚拟HAL仿真替代能力

This commit is contained in:
2026-06-17 19:45:51 +08:00
parent 656cddf73a
commit a4d449ad48
17 changed files with 5005 additions and 302 deletions

View File

@@ -66,11 +66,39 @@ import {
createIniPanelShellWorkflowOverviewReleaseReadinessArtifactValidationActionPlanDomReadiness,
createIniPanelShellWorkflowOverviewReleaseReadinessArtifactValidationActionPlanRenderState,
createIniPanelShellWorkflowOverviewReleaseReadinessArtifactValidationSummaryViewModel,
VIRTUAL_HAL_COVERAGE_STATES,
VIRTUAL_HAL_PROJECT_PIN_GROUPS,
VIRTUAL_HAL_SIMULATION_REPLACEMENT_TARGETS,
VIRTUAL_HAL_SIMULATION_RUNTIME_CAPABILITIES,
VIRTUAL_HAL_SOURCE_FILES,
VIRTUAL_HAL_SYSTEM_PIN_FAMILIES,
VIRTUAL_HAL_WASM_BRIDGE_FUNCTIONS,
applyVirtualHalAction,
applyVirtualHalPinUpdates,
applyVirtualHalToInterpSdk,
createLinuxCncIniSdk,
createLinuxCncInterpSdk,
createLinuxCncVirtualHalRuntime,
createMachineSessionPersistenceDisplayViewModel,
createMachineSessionPersistenceRenderState,
createMachineSessionPersistenceSummary,
createVirtualHalBridgeActionPlan,
createVirtualHalBridgeReadiness,
createVirtualHalIntegrityReport,
createVirtualHalPinInventory,
createVirtualHalPinRegistry,
createVirtualHalProjectReport,
createVirtualHalSimulationReplacementReport,
createVirtualHalSimulationRuntimeReport,
createVirtualHalState,
createVirtualHalSystemCoverageReport,
createVirtualHalWasmBridgeSnapshot,
executeVirtualHalCommand,
executeVirtualHalcmd,
readVirtualHalPin,
stepVirtualHalMotion,
stepVirtualHalMotionController,
writeVirtualHalPin,
createMachineSessionSnapshotPayload,
createProjectReleaseGateActionPlan,
createProjectReleaseGateExecutionManifest,
@@ -241,6 +269,78 @@ path but keeps the runner loop going after LinuxCNC reports an error, matching
upstream `rs274 -n 0` regression tests such as `tests/interp/oword-unwind`.
It does not implement or reinterpret LinuxCNC error semantics.
## Project-level virtual HAL boundary
The SDK exposes a project-level browser/Node virtual HAL boundary for UI,
session, diagnostics, and standalone interpreter bridge workflows. It is shared
through `runtime/sdk/src/index.js`, so simulation pages, INI-panel shells,
Node smokes, and external dashboards can use the same objects instead of
private page state.
- `createVirtualHalState()` creates the normalized browser virtual HAL state.
- `applyVirtualHalAction()` applies stable manual-control actions such as
ESTOP, power, home, jog, spindle, coolant, brake, touch-off, and limit
override.
- `createLinuxCncVirtualHalRuntime()` wraps that state in a small runtime with
`dispatch()`, `getDroState()`, `getLimitsHomeState()`,
`getMachineStatusState()`, `getWasmBridgeSnapshot()`, `getPinRegistry()`,
`readPin()`, `writePin()`, `applyPinUpdates()`, `executeHalCommand()`,
`executeHalcmd()`, `stepMotion()`, `stepMotionController()`,
`getSimulationRuntimeReport()`, `getSimulationReplacementReport()`,
`getIntegrityReport()`, `getPinInventory()`, `getProjectReport()`, and
`applyToInterpSdk()`.
- `VIRTUAL_HAL_SIMULATION_RUNTIME_CAPABILITIES`,
`VIRTUAL_HAL_SIMULATION_REPLACEMENT_TARGETS`,
`executeVirtualHalCommand()`, `executeVirtualHalcmd()`,
`stepVirtualHalMotion()`, `stepVirtualHalMotionController()`,
`createVirtualHalSimulationRuntimeReport()`, and
`createVirtualHalSimulationReplacementReport()` expose a simulation-grade
replacement for the host LinuxCNC realtime HAL, `halcmd`, and motion
controller runtime. It supports HAL pin/signal/param storage, `setp`,
`sets`, `newsig`, `net`, `show`, `getp`, `gets`, `loadrt`/`loadusr` stubs,
`addf`, thread start/stop, and servo-period motion stepping for browser
simulation and Node dashboards.
- `createVirtualHalWasmBridgeSnapshot()` returns the pin/value rows that can be
applied through the interpreter SDK HAL bridge. It includes AXIS internal pin
names such as `jog.x`, full HAL names such as `axisui.jog.x`, task/power
names such as `halui.machine.is-on`, and spindle/coolant names such as
`spindle.0.speed-out` and `iocontrol.0.coolant-flood`.
- `createVirtualHalPinRegistry()`, `readVirtualHalPin()`,
`writeVirtualHalPin()`, and `applyVirtualHalPinUpdates()` expose the project
virtual HAL as a source-derived pin service. Callers can read/write HAL names
such as `halui.machine.on`, `spindle.0.speed-out`,
`motion.tooloffset.z`, or `joint.0.homed` without duplicating pin mapping.
- `createVirtualHalIntegrityReport()` verifies registry completeness, duplicate
pin absence, required project pins, and source coverage in one machine
readable report.
- `createVirtualHalPinInventory()` returns a stable project inventory grouped
by `VIRTUAL_HAL_PROJECT_PIN_GROUPS`.
- `VIRTUAL_HAL_SYSTEM_PIN_FAMILIES`, `VIRTUAL_HAL_SOURCE_FILES`, and
`VIRTUAL_HAL_COVERAGE_STATES` expose the source-derived coverage model for
AXIS, HALUI, iocontrol, motion, axis, joint, spindle, coolant, and tool pins.
- `createVirtualHalSystemCoverageReport()` expands that source-derived model
into a machine-readable completeness report. It records the LinuxCNC source
files used as evidence, concrete declared pin rows, represented bridge pins,
and explicit `bridge-only` / `runtime-boundary` rows.
- `createVirtualHalBridgeReadiness()` checks that a snapshot has required
bridge pins and that caller-provided WASM function evidence covers
`VIRTUAL_HAL_WASM_BRIDGE_FUNCTIONS`.
- `createVirtualHalBridgeActionPlan()` turns blocked bridge readiness into the
next build/verify commands.
- `createVirtualHalProjectReport()` packages state, DRO, limits/home, machine
status, pin inventory, pin registry, integrity, system coverage, simulation
runtime evidence, bridge snapshot, bridge readiness, and action plan into one
stable report for dashboards or release artifacts.
- `applyVirtualHalToInterpSdk()` applies a virtual HAL state to any interpreter
SDK instance exposing `applyVirtualHalState()` or `applyVirtualHalSnapshot()`.
For simulation, this replaces the host `halcmd`, HAL object store, and basic
motion feedback loop. It is a virtual realtime HAL runtime replacement for
browser workflows, but still not a Linux kernel hard-realtime ABI: kernel
realtime scheduling, external device drivers, native HAL module ABI behavior,
HALUI process behavior, and Tcl/Python process integration remain explicit
boundaries.
## Project release readiness export
`createProjectReleaseGateManifest()` returns the required release gate IDs,