Hello friends. I’m wondering if there’s a way to trigger some code to run whenever my program is paused/stopped to “clean up”/ensure a safe pause, similar to how in other programming languages you would catch the “kill” SIG and flush any IO or close sockets to gracefully shut the program down and ensure you leave the system in the same state as it was before your program started running. In this case, I’d be resetting an output signal and maybe a couple other operations.
Is there some sort of event that is triggered that I could use?
It’s not possible to execute code or commands like that. You do have the option to set outputs high or low when the program is stopped, though.
That’s done in the Installation → I/O Setup and then selecting an output and picking an action.
I see, thanks for the insights @WattsUp and @efn . I’m already using rtde to enable other functionality so I’ll end up going with your suggestions which can notify my rtde client of a program ending and perform the clean-up over there.