Skip to content

newinst in opcua_postgui.hal does not work on stock LinuxCNC (silently dead OPC UA wiring) #1

Description

@grandixximo

newinst in opcua_postgui.hal silently breaks the OPC UA wiring on stock LinuxCNC

The file linuxcnc-configs/opcua_postgui.hal contains:

newinst or2 opcua_estop_or
addf opcua_estop_or servo-thread

newinst only exists in Machinekit and in very old experimental LinuxCNC branches. On stock LinuxCNC (which this project builds from source, unmodified, per the Dockerfile) the newinst command has been compiled out of halcmd since version 2.2 (#if 0 in halcmd_commands.c).

What happens at runtime

  1. halcmd processes the file top-down. loadusr succeeds and the OPC UA client loads.
  2. The newinst line fails with an unknown-command error, and halcmd -f aborts the rest of the file.
  3. All net commands below it never execute.

Because this is a POSTGUI_HALFILE, the GUI is already up, so the sim appears to run — but the opcua component is loaded-yet-unwired, and the whole SCADA data bridge is silently dead (the only trace is an error in the LinuxCNC log). The validation steps in the README (dashboard status updates, SCADA-triggered E-Stop) cannot pass as written.

Suggested fix

Use a plain counted instance instead, and rename the pins accordingly:

loadrt or2 count=1
addf or2.0 servo-thread

net int-estop-active  halui.estop.is-activated => or2.0.in0
net ext-estop-trigger opcua.trigger-estop      => or2.0.in1
net estop-is-active   or2.0.out                => opcua.emergency-stop

(With count=1 the pins are or2.0.in0/in1/out.)

Context: we ran into this while auditing newinst usage for an upcoming LinuxCNC HAL API change — see LinuxCNC/linuxcnc#4259.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions