hi.
I’m trying to change the robot’s control box IO in a C# program.
This should be possible even while the robot is running.
I tried using the urscript execution function of the client interface.
ex) set_digital_out(1,True)
This changed the IO, but the robot stopped.
Are there any other functions that can change IO while the robot is running?
You can set the URScript command to run as Secondary instead of primary, which will prevent the program execution from stopping. I haven’t worked in C#, I’ve only done CAP development via Java, but there is an API provided by UR for accessing the digital/configurable outputs from there.
Yes, you can set an output while a program is running. The trick is to use a secondary program.
You can have a look at the documentation of this library that provides this feature in C# :
https://underautomation.com/universal-robots/documentation/remote-send-script
using UnderAutomation.UniversalRobots;
using UnderAutomation.UniversalRobots.PrimaryInterface;
var robot = new UR();
robot.Connect("192.168.0.1");
robot.PrimaryInterface.Script.Send(@"
sec secondaryProgram():
set_digital_out(1, True)
end
");