完善 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,169 @@
export const gmoccapyCommunicationModel = {
apiName: "web-rtcp-5axis-gmoccapy-communication-model",
profileId: "gmoccapy-xyzab",
nativeConfigPath: "linuxcnc/configs/sim/gmoccapy/gmoccapy_XYZAB.ini",
cycleTimeMs: 100,
semanticBoundary: "native_gmoccapy_nml_hal_reference_web_store_runtime_mapping",
nativePaths: {
command: {
label: "NML command",
path: ["gmoccapy", "linuxcnc.command()", "NML emcCommand", "milltask"],
notes: "GUI commands are written to the NML command buffer and consumed by milltask.",
},
status: {
label: "NML status/error",
path: ["milltask", "NML emcStatus/emcError", "linuxcnc.stat()", "linuxcnc.error_channel()", "gmoccapy"],
notes: "gmoccapy polls status and error channels at DISPLAY CYCLE_TIME.",
},
hal: {
label: "HAL shared memory",
path: ["gmoccapy.* pins", "HAL shared memory", "halui/iocontrol/motmod/spindle_sim"],
notes: "postgui HAL connects gmoccapy pins after halcomp.ready().",
},
remap: {
label: "Interpreter REMAP",
path: ["milltask", "RS274NGC", "Python remap prolog/ngc/epilog"],
notes: "M6/M61 remap executes on the task/interpreter side, not inside the GUI event loop.",
},
},
webPath: {
label: "Web simulation",
path: ["button", "store.dispatch", "linuxcnc-task-policy", "runtime/status snapshot", "UI/Three.js"],
notes: "The browser does not attach to native NML buffers or HAL shared memory.",
},
startupStages: [
{ order: 1, id: "parse-ini", nativeStep: "linuxcnc script parses gmoccapy_XYZAB.ini", webEquivalent: "profile/source map selection" },
{ order: 2, id: "linuxcncsvr", nativeStep: "linuxcncsvr -ini <ini>", webEquivalent: "not connected; reference only" },
{ order: 3, id: "realtime-hal", nativeStep: "start realtime/RTAPI/HAL", webEquivalent: "task/HAL runtime simulation boundary where available" },
{ order: 4, id: "milltask", nativeStep: "halcmd loadusr -Wn inihal milltask -ini <ini>", webEquivalent: "store task policy and optional task/HAL runtime" },
{ order: 5, id: "halui", nativeStep: "halcmd loadusr -Wn halui halui -ini <ini>", webEquivalent: "HALUI pins listed as reference diagnostics" },
{ order: 6, id: "halfiles", nativeStep: "run core_sim_XYZAB.hal, spindle_sim.hal, simulated_home.hal", webEquivalent: "HAL model diagnostics" },
{ order: 7, id: "hal-start", nativeStep: "halcmd start", webEquivalent: "not a browser realtime thread" },
{ order: 8, id: "gmoccapy", nativeStep: "gmoccapy -ini <ini>", webEquivalent: "gmoccapy Web shell" },
{ order: 9, id: "postgui", nativeStep: "halcomp.ready(), then gmoccapy_postgui.hal", webEquivalent: "postgui model shown after gmoccapy pins exist" },
],
actionMappings: [
{
actionId: "estop",
webAction: "ESTOP",
nativeCommand: "command.state(STATE_ESTOP)",
nativeStatus: "task_state STATE_ESTOP",
gate: "always available as abortive safety action",
},
{
actionId: "estop-reset",
webAction: "RESET",
nativeCommand: "command.state(STATE_ESTOP_RESET)",
nativeStatus: "task_state STATE_ESTOP_RESET",
gate: "allowed from estop",
},
{
actionId: "power-on",
webAction: "TOGGLE_POWER",
nativeCommand: "command.state(STATE_ON)",
nativeStatus: "task_state STATE_ON",
gate: "blocked while STATE_ESTOP",
},
{
actionId: "mode-manual",
webAction: "SET_MODE manual",
nativeCommand: "command.mode(MODE_MANUAL)",
nativeStatus: "task_mode MODE_MANUAL",
gate: "blocked when AUTO interpreter is not idle",
},
{
actionId: "mode-mdi",
webAction: "SET_MODE mdi",
nativeCommand: "command.mode(MODE_MDI)",
nativeStatus: "task_mode MODE_MDI",
gate: "machine on and homed when NO_FORCE_HOMING=0",
},
{
actionId: "mode-auto",
webAction: "SET_MODE auto",
nativeCommand: "command.mode(MODE_AUTO)",
nativeStatus: "task_mode MODE_AUTO",
gate: "machine on and homed when NO_FORCE_HOMING=0",
},
{
actionId: "jog",
webAction: "JOG",
nativeCommand: "command.jog(JOG_CONTINUOUS/JOG_INCREMENT/JOG_STOP)",
nativeStatus: "motion/joint feedback",
gate: "machine on, manual mode, not running",
},
{
actionId: "home",
webAction: "HOME",
nativeCommand: "command.home(-1) or command.home(joint)",
nativeStatus: "all-homed",
gate: "machine on, manual mode, no conflicting homing command",
},
{
actionId: "mdi",
webAction: "RUN_MDI",
nativeCommand: "command.mdi(command)",
nativeStatus: "interp reading/idle",
gate: "machine on, MDI mode, homed when NO_FORCE_HOMING=0",
},
{
actionId: "auto-run",
webAction: "RUN",
nativeCommand: "command.auto(AUTO_RUN, start_line)",
nativeStatus: "interp reading/waiting/idle",
gate: "INI loaded, program loaded, machine on, homed, AUTO, interpreter idle, runtime ready",
},
{
actionId: "auto-pause",
webAction: "PAUSE",
nativeCommand: "command.auto(AUTO_PAUSE)",
nativeStatus: "interp paused",
gate: "AUTO or MDI with machine on",
},
{
actionId: "auto-resume",
webAction: "RESUME",
nativeCommand: "command.auto(AUTO_RESUME)",
nativeStatus: "interp reading",
gate: "interpreter paused",
},
{
actionId: "abort",
webAction: "STOP/ABORT",
nativeCommand: "command.abort()",
nativeStatus: "interp idle after abort",
gate: "available across most states",
},
{
actionId: "spindle",
webAction: "spindle controls",
nativeCommand: "command.spindle(direction, rpm)",
nativeStatus: "spindle.0.forward/reverse/speed-out/speed-in",
gate: "blocked in estop/off and restricted during interpreter reading/waiting",
},
{
actionId: "coolant",
webAction: "TOGGLE_COOLANT",
nativeCommand: "command.flood()/command.mist()",
nativeStatus: "iocontrol.0.coolant-flood/mist",
gate: "blocked in estop/off",
},
],
};
export function createGmoccapyCommunicationSummary(model = gmoccapyCommunicationModel) {
return {
apiName: `${model.apiName}-summary`,
profileId: model.profileId,
nativeConfigPath: model.nativeConfigPath,
nativePathCount: Object.keys(model.nativePaths).length,
startupStageCount: model.startupStages.length,
actionCount: model.actionMappings.length,
postguiAfterHalcompReady: model.startupStages.findIndex((stage) => stage.id === "postgui") >
model.startupStages.findIndex((stage) => stage.id === "gmoccapy"),
hasNativeNmlCommandPath: model.nativePaths.command.path.includes("NML emcCommand"),
hasNativeHalPath: model.nativePaths.hal.path.includes("HAL shared memory"),
hasWebStorePath: model.webPath.path.includes("store.dispatch"),
semanticBoundary: model.semanticBoundary,
};
}