Accepted is not executed: measure readiness at the layer that will do the work

Domain: fanuc · Evidence E1 — Maintainer reviewed
readinessautomationcontrollerkarelmotion

Summary

Two automations against the same kind of controller failed the same way: the command they sent was

Problem

Two automations against the same kind of controller failed the same way: the command they sent was accepted, and nothing happened.

Root Cause

The controller has layers, and they come up at different times:

So "the command returned 0" is a statement about the command layer. Readiness has to be measured at the layer that will do the work.

Fix

Pick the readiness signal from the target layer, and treat the command layer's success as necessary only:

def wait_ready(ctl, timeout=120):
    # The copy step echoes its own result: that echo is the first point where the runtime is up.
    for _ in range(timeout // 3):
        if "Copied" in ctl.console("COPY UD1:PROBE.PC MD: OVERWRITE"):
            return True
        sleep(3)
    raise TimeoutError("runtime never reached the copy layer")

# Motion needs its own probe, not the command layer's success.
def motion_ready(ctl):
    ctl.reset()                      # clear a latched error state before trying to move
    return ctl.probe_position() is not None

And read the table you are about to write through, instead of trusting the document:

slots = ctl.show_array("CMDS")        # print all entries, compare with the doc, then write

When a motion error survives reset, relaunch the workcell instead of retrying: on this device the clean window after a relaunch is 30–90 s, which is the right budget for a short burst of motion work rather than a long poll that burns it.

Verification

$ python3 bringup_and_run.py --expect-host ROBOT
ready (copy echo: Copied)          <- runtime layer answered
CMDS[12] = ''                      <- read back, not assumed
run X -> accepted
program state -> DONE (not ABORTED)
position delta -> non-zero

Before the fix the same script printed accepted for every step and a zero position delta.

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons