Hi all.
In the URCap I am currently developping, I would like to know what the best way would be for me to send some script when necessary when a program is stopped whilst running. Frustratingly, this is still only a feature request and so i am looking for a workaround.
The current problem I am facing, is that at the URCaps program node, a command is sent over a socket, for some external equipment to begin some motion, and the script generated then waits for the equipment to send back a “movement finished” signal, before continuing with the rest of the program. Because of this, if a program is stopped whilst the peripheral equipment is moving, it will continue to move until it has reached the position it was told to reach.
As a result, I am on the hunt for advice about the best way to trigger the sending of a few lines of URScript when a program is stopped, I am wondering if this can be accomplished with the use a daemon? Perhaps there are better ways to go about this, any advice would be appreciated.
Sam
Hey,
A possible work around here is to monitor the robot state (available through RTDE for example) and detect a switch in state, from running to stopped / paused / …
A daemon is best suited for this as it can keep monitoring the robot state in the background and even send a socket command required to stop the motion if a switch is detected. It might even be best to have all your socket commands run through the daemon (single control point) with the program nodes making remote calls to the daemon.
kind regards,
Gunther
So you are using the generateScript portion to utilize the URScript commands for the socket communication?
I would try to do the communication in the background on the java side, it can monitor when the program starts through the dashboard server and also when the program stops, when either of those conditions are meet you can send commands to the equipment on the java side. There are a few other methods such as the Daemon server that @gunther.moors references.
So you are using the generateScript portion to utilize the URScript commands for the socket communication?
I am at the moment, and this is required for the application, as each program node needs to generate its own script.
I will look into the dashboard server as a solution. This is a preferable solution to using a daemon, since it doesn’t require me relearning python/C++
I ended up using a java thread which polled the dashboard server to monitor the running state of the program , with help from the implementation of the dashboard server from the sample in this this topic