Function call in Thread causes "NO CONTROLLER"

Hi,

The following code snippet runs fine as a Script in a Program but causes a crash when run as a Script in a SubProgram. Running URSim 5.11.0.108249. The Robot Status becomes “NO CONTROLLER” when the program fails.

def my_fun():
end

thread my_thrd():
    while True:
        my_fun()
        sync()
    end

    return False
end

run my_thrd()

Declaring the function within the scope of the thread solves the issue. However, in my current application I need to call the function both inside and outside of the thread.

Is this expected behavior? If so, why? Any suggestion for a workaround?

Best regards,
Charlie

See if the error still occurs on v5.12 of the software. They added some bug fixes for the no controller error.

Thanks for the suggestion. I tried with the latest available version (5.12.2) and the result was the same.

The log doesn’t report anything other than “Program starting” followed by “Disconnected from Controller”.
Same behavior in “real” and Simulation modes. It manages to reestablish connection to controller after a few seconds.

1 Like