Sebastien, one of the things you have to be aware of is the the units between the camera and UR are different. Camera will be in meters for X, Y, and Z and the UR is in mm. Also the rotation angle is in degrees in the camera and Rads in the UR. I run the camera loop in a thread so that it finds the part and holds the coordinates until they are asked for. I use this thread on 3 Cognex cameras now and will be adding a 4th. Here is my thread.
Thread_4
'Camera 1 Program Start'
If Thread_1≟1
Set Camera_1_Trig=Off
Zero_Pos≔[0,0,0,0]
Socket_Test_1≔ False
Wait: 0.3
Loop Socket_Test_1≟ False
Socket_Test_1=socket_open("192.168.1.18",3010,"socket_1")
Wait: 1.0
Set Camera_1_Trig=On
Wait: 0.2
Set Camera_1_Trig=Off
Wait: 0.2
If Socket_Test_1≟ True
Result_1≔socket_read_ascii_float(3,"socket_1")
Wait: 0.2
Set Pic_Cntr=Pic_Cntr+1
Wait: 0.2
If Result_1[0]≟3
Pic_Cntr≔0
new_pos_1≔p[((Result_1[2]+25)/1000),((Result_1[1]+50)/1000),0,0,0,((-Result_1[3]+180)*3.14159/180)]
socket_close("socket_1")
Socket_Test_1≔ False
'Thread_1≔0'
The Pic_Cntr is a variable I use to prevent the camera and robot from sitting there and trying to find a part forever. If it goes above 20 tries, I trigger a popup and lights on an andon stack.
I hope this helps.
The Pic_Cntr is a variable I use to prevent the camera and robot from sitting there and trying to find a part forever. If it goes above 20 tries, I trigger a popup and lights on an andon stack.
I hope this helps.
Hi Pros,
one quick question. We are working on a system that includes a UR and a smart camera. In the application we need to first locate the part, then do a barcode reading and bin the part based on the barcode value. We are thinking of setting up the camera with the robot using ethernetIP. The camera would send barcode value in the first place to the robot. Then when locating the object it would send XY position of the object. The camera will be a Cognex camera. It has a feature in its interface that allows us to calibrate the position of the camera such that XY positions returned are in the robot's coordinate system. My question is, on the robot side, what do you usually use in a program to update XY positions based on camera's feedback?