Hi,
I want to create a setup where I command a robot through an OPC-UA server. The configuration of the OPC-UA server itself is not the issue, but I have questions about the actual control of the robot itself.
I currently have the following setup:
-
I have a UR10e model in Visual Components that I want to command from outside.
-
In the component graph, I created properties that I connect to an OPC-UA server in order to pass a joint target to the robot model:
-
In the component graph, I created a Python script behaviour that keeps on doing nothing, until the connected signal is activated through the OPC-UA server. At that moment, the OnSignal() event is triggered, which sets a boolean value to ‘True’ and consequently triggers the motion of the robot which is implemented in the OnRun() method. The reason of the above is a workaround for the fact that the OnSignal() method cannot contain time consuming functionality, that’s why I use the boolean value, and replace the time consuming functionality to the OnRun() method. (see also this topic: ReferenceError: Time taking statements cannot be run in this scope.)
from vcScript import *
from vcHelpers.Robot2 import *
import math
def OnSignal( signal ):
comp.getProperty('MoveJointTarget').Value = True
def OnRun():
while True:
delay(0.1)
if comp.getProperty('MoveJointTarget').Value == True:
comp.getProperty('MoveJointTarget').Value = False
# Read the joint values populated through OPC-UA
j = []
for i in range(1, 7):
j.append(comp.getProperty('JointTarget' + str(i)).Value * 180 / 3.14)
robot.driveJoints(j[0], j[1], j[2], j[3], j[4], j[5], 5)
robot = getRobot()
comp = getComponent()
rc = comp.findBehavioursByType(VC_ROBOTCONTROLLER)[0]
At first sight, this is working. The values propagate to the robot model through the OPC-UA server, and the robot moves using the driveJoints method. However, I notice that the robot control does not work if I bring a duplicate of the robot model in the scene (listening to another OPC-UA server). Also, I want to implement other functionality as well, for instance moving towards a Cartesian target.
So my feeling is that there must be a better way to realise this robot motion towards a variable waypoint…
Could you confirm if my current solution is an authorized method or not?
- Am I right to create custom value properties to pass the variables from the OPC-UA server? Wouldn’t the list of variables grow too large if I implement different functionalities as well?
- Is the Python script connected to a signal the right way to command the robot to move to a target?
Can you point me in the right direction to implement this properly?
Regards,
Toon D.
Robotics Engineer at Flanders Make, Belgium
tldr;
I want to have a robot model repeatedly waiting until I command to move to a target that is different every time.