A similar approach would be to connect to a TCP or XML-RPC server to notify the end of the movement. In your case, the server would be a parallel thread or a function within your C#.
movej(goal_point_q)
server = rpc_factory("xmlrpc", "http://PC_IP_ADDR:PC_PORT")
end = server.notify_finish()
And in your C# side (I don’t know C# so this is in Python):
import sys
import urlib
from xmlrpc.server import SimpleXMLRPCServer
global ROBOT_FINISHED
ROBOT_FINISHED = False
def notify_finish():
global ROBOT_FINISHED
ROBOT_FINISHED = True
return True # <- send this to the robot
def run_server():
server = SimpleXMLRPCServer(("", PC_PORT), allow_none=True)
server.RequestHandlerClass.protocol_version = "HTTP/1.1"
print(f"Listening on port {PC_PORT}...")
server.register_function(notify_finish, "notify_finish")
server.serve_once()
# Example of one movement with notification:
ROBOT_FINISHED = False
send_URscript_code()
run_server()
if ROBOT_FINISHED:
print("Movement sucessful")
I have developed on C# something similar and once had the same problem as you now have. programState will not give you info on that because, technically, no program is running. You need to use the Dasboard running command. This command verifies whether a script/program is being run or not. Even if the robot is still (like if you have a timer or a while condition), since the script is running, this will signal you the robot is working. If you need anymore information don’t hesitate to ask.