完善 gmoccapy XYZAB 参考功能

This commit is contained in:
2026-06-26 17:53:45 -04:00
parent 4e4f1462f5
commit a81b40447d
154 changed files with 17194 additions and 51 deletions

View File

@@ -0,0 +1,174 @@
# gmoccapy XYZAB Reference
Date: 2026-06-26
This document records how the LinuxCNC `gmoccapy_XYZAB.ini` simulation maps into
the Web RTCP 5-axis simulator. It is a reference boundary, not a browser port of
the native gmoccapy GTK runtime.
## Source Inputs
Primary input:
```text
work/working3/gmoccapy_XYZAB_execution_analysis.md
linuxcnc/configs/sim/gmoccapy/gmoccapy_XYZAB.ini
linuxcnc/configs/sim/gmoccapy/core_sim_XYZAB.hal
linuxcnc/configs/sim/gmoccapy/spindle_sim.hal
linuxcnc/configs/sim/gmoccapy/simulated_home.hal
linuxcnc/configs/sim/gmoccapy/gmoccapy_postgui.hal
work/working3/gmoccapy_button_icons/button_icon_inventory.csv
work/working3/gmoccapy_button_icons/files/
```
Project assets generated from those inputs:
```text
app/src/ui-reference/gmoccapy-button-icons.json
app/src/assets/gmoccapy-icons/
app/src/profiles/gmoccapy-xyzab.js
app/src/runtime/gmoccapy-communication-model.js
app/src/runtime/gmoccapy-hal-model.js
```
## Native LinuxCNC Configuration
`gmoccapy_XYZAB.ini` defines a simulated five-axis machine:
- UI: `[DISPLAY] DISPLAY = gmoccapy`.
- UI poll cycle: `[DISPLAY] CYCLE_TIME = 100` ms.
- Task process: `[TASK] TASK = milltask`.
- Motion module: `[EMCMOT] EMCMOT = motmod`.
- Realtime periods: `BASE_PERIOD = 100000` ns, `SERVO_PERIOD = 1000000` ns.
- Coordinates: `[TRAJ] COORDINATES = X Y Z A B`.
- Kinematics: `[KINS] KINEMATICS = trivkins coordinates=xyzab`.
- Joint count: `[KINS] JOINTS = 5`.
- Homing policy: `[TRAJ] NO_FORCE_HOMING = 0`.
- HALUI: `[HAL] HALUI = halui`.
The native profile is a `trivkins` simulation. It is not a TCP/RTCP proof and
must not be promoted as source-derived table-rotary-tilting kinematics.
## Native Startup Order
The native command is:
```bash
linuxcnc linuxcnc/configs/sim/gmoccapy/gmoccapy_XYZAB.ini
```
The LinuxCNC script performs these stages:
1. Parse INI and export `CONFIG_DIR`, `INI_FILE_NAME`, and config-local `PATH`.
2. Start `linuxcncsvr -ini <ini>` for NML buffers.
3. Start realtime, RTAPI, and HAL.
4. Load task process with `halcmd loadusr -Wn inihal milltask -ini <ini>`.
5. Load `halui` with `halcmd loadusr -Wn halui halui -ini <ini>`.
6. Execute normal `[HAL] HALFILE` entries:
`core_sim_XYZAB.hal`, `spindle_sim.hal`, and `simulated_home.hal`.
7. Run `halcmd start`.
8. Start the display with `gmoccapy -ini <ini>`.
9. After gmoccapy creates `gmoccapy.*` pins and calls `halcomp.ready()`, execute
`[HAL] POSTGUI_HALFILE = gmoccapy_postgui.hal`.
The postgui file is order-sensitive because it references `gmoccapy.*` pins that
do not exist during ordinary HALFILE loading.
## Native Communication Model
gmoccapy talks to LinuxCNC through local LinuxCNC mechanisms:
- Command path: `gmoccapy -> linuxcnc.command() -> NML emcCommand -> milltask`.
- Status path: `milltask -> NML emcStatus/emcError -> linuxcnc.stat()/error_channel()`.
- HAL path: `gmoccapy.* pins <-> HAL shared memory`.
- HALUI path: `halui` exposes LinuxCNC commands and status as HAL pins.
- REMAP path: `[RS274NGC] REMAP` and `[PYTHON]` run inside the task/interpreter
side, not inside the GUI.
The Web application does not connect to native NML buffers, HAL shared memory, or
realtime threads. Web buttons dispatch through `store.dispatch`, task policy
gates, source-derived runtimes where available, and UI status snapshots.
## HAL Topology
`core_sim_XYZAB.hal` loads `trivkins` and `motmod`, then loops commanded joint
positions directly back to feedback:
```text
joint.0 X command -> joint.0 feedback
joint.1 Y command -> joint.1 feedback
joint.2 Z command -> joint.2 feedback
joint.3 A command -> joint.3 feedback
joint.4 B command -> joint.4 feedback
```
It also creates the simulation loops:
- `iocontrol.0.user-enable-out -> iocontrol.0.emc-enable-in`.
- `iocontrol.0.tool-prepare -> iocontrol.0.tool-prepared`.
- `iocontrol.0.tool-change -> iocontrol.0.tool-changed`.
- `spindle.0.forward`, `spindle.0.reverse`.
- `iocontrol.0.coolant-flood`, `iocontrol.0.coolant-mist`.
`spindle_sim.hal` simulates speed feedback:
```text
spindle.0.speed-out -> limit2 -> sim_encoder -> encoder -> spindle.0.speed-in
near_speed.out -> spindle.0.at-speed
```
`simulated_home.hal` creates simulated X/Y/Z home switches at X=1, Y=0.5, Z=2.
`gmoccapy_postgui.hal` maps native HAL state into GUI pins:
- `gmoccapy.spindle_feedback_bar`.
- `gmoccapy.spindle_at_speed_led`.
- `gmoccapy.tooloffset-x`.
- `gmoccapy.tooloffset-z`.
It also re-establishes the simulated tool-change loop after unlinking conflicting
pins.
## G-code Gates
Because `NO_FORCE_HOMING = 0`, MDI and Auto require the normal LinuxCNC sequence:
```text
reset estop
machine on
home all axes
load a program or MDI command
switch to the correct mode
interpreter idle
run MDI or AUTO_RUN
```
The native stack enforces this in three layers:
1. gmoccapy widget sensitivity and page state.
2. gladevcp actions and gmoccapy callback checks.
3. LinuxCNC task, interpreter, motion, IO, and HAL validation.
The Web project mirrors this as UI disabled reasons, `linuxcnc-task-policy`
gates, and runtime preconditions. The `gmoccapy-xyzab` profile is allowed as a
reference selection, but full LinuxCNC 5-axis source-derived RUN proof remains
limited to profiles that have project runtime support.
## Button Icon Boundary
The icon inventory from `working3/gmoccapy_button_icons` was converted into a
project-local manifest:
```text
app/src/ui-reference/gmoccapy-button-icons.json
```
The copied icons live in:
```text
app/src/assets/gmoccapy-icons/
```
These assets prove UI origin and visual mapping only. Button correctness still
depends on the Web store, task policy, runtime state, and browser interaction
evidence.

View File

@@ -39,6 +39,10 @@ CNC 语义必须来自 LinuxCNC source/WASM/source-derived boundary
| `xyzac-trt` profile | `app/src/profiles/xyzac-trt.js` | `configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini` | source/config reference | profile boundary node smoke |
| `xyzac-trt` source reference map | `app/src/profiles/source-reference-map.js` | `xyzac-trt.ini`, `xyzac-trt.xml`, `switchkins_postgui.hal`, `xyzac-trt_cmds.hal`, `xyzac-trt-kins.c`, `trtfuncs.c`, `switchkins.c` | profile/source map only, not runtime proof | profile boundary node smoke |
| `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 |
| `gmoccapy-xyzab` reference profile | `app/src/profiles/gmoccapy-xyzab.js` | `linuxcnc/configs/sim/gmoccapy/gmoccapy_XYZAB.ini`, `core_sim_XYZAB.hal`, `spindle_sim.hal`, `simulated_home.hal`, `gmoccapy_postgui.hal` | gmoccapy/trivkins reference profile only; not RTCP proof | gmoccapy XYZAB profile node smoke |
| gmoccapy_XYZAB NML/HAL communication model | `app/src/runtime/gmoccapy-communication-model.js`, `docs/gmoccapy-xyzab-reference.md` | `gmoccapy.py`, `linuxcnc.command/stat/error_channel`, `milltask`, HALUI, POSTGUI_HALFILE startup order | native communication reference mapped to Web store/task policy; browser does not attach to NML/HAL shared memory | gmoccapy communication model node smoke |
| gmoccapy_XYZAB HAL/postgui diagnostics model | `app/src/runtime/gmoccapy-hal-model.js`, `docs/gmoccapy-xyzab-reference.md` | `core_sim_XYZAB.hal`, `spindle_sim.hal`, `simulated_home.hal`, `gmoccapy_postgui.hal` | HAL pin/postgui reference and Web diagnostics only | gmoccapy HAL model node smoke |
| gmoccapy button icon manifest | `app/src/ui-reference/gmoccapy-button-icons.json`, `app/src/assets/gmoccapy-icons/` | `work/working3/gmoccapy_button_icons/button_icon_inventory.csv`, copied classic theme and macro image files | UI asset provenance only; button semantics still require task policy/runtime evidence | gmoccapy icon manifest node 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; task/motion/HAL simulation runtime connected separately | profile boundary node smoke + browser DOM smoke |
@@ -77,6 +81,11 @@ src/hal/user_comps/vismach/5axisgui.py
src/hal/user_comps/vismach/xyzac-trt-gui.py
src/hal/user_comps/vismach/xyzbc-trt-gui.py
configs/sim/gmoccapy/gmoccapy_XYZAC.ini
configs/sim/gmoccapy/gmoccapy_XYZAB.ini
configs/sim/gmoccapy/core_sim_XYZAB.hal
configs/sim/gmoccapy/spindle_sim.hal
configs/sim/gmoccapy/simulated_home.hal
configs/sim/gmoccapy/gmoccapy_postgui.hal
configs/sim/qtvcp_screens/qtdragon/README
```