I am a bit separated from the execution of the actual program in Galil, and I am trying to discern if a program has completed execution. Here's some pseudocode of reading over sockets.
class Galil extends EventEmitter {
// ...
async execute(subroutine, timeout=60000) {
try {
await this._commands.send(`XQ#${subroutine}`); // sends the command and awaits : or ? in return
// okay, so the command successfully went through. What now?
} finally {}
}
}
It seems like the GalilTools software knows when a subroutine is complete, but how does it know? Is there some kind of message sent back? Do I poll every socket that can be executing? How is this managed?
edprochak on 03/31/2016 - 08:45
We use the unsolicited messages. At the end of your subroutine just add an MG command with a string indication completion. We use a style of routine name followed by the state like
#MOVETO
<the motion code>
MG "MOVETO COMPLETED"
EN
You then need the unsolicited message event handler.
There may also be a way to handle this with the Data Record.but I have not used that yet.