I am new to UR Cobot. I have to mount a camera on the Cobot to perform inspection of four different angles of a part, What is the proper code to take a picture of a part everytime that i have a new waypoint? Do I insert the following instructions after each waypoint?:
camera = rpc_factory(“xmlrpc”, “http://127.0.0.1/RPC2”)
if (! camera.initialize(“RGB”)):
popup(“Camera was not initialized”)
camera.takeSnapshot()
target = camera.getTarget()
Your help is greatly appreciated.
There is an article from UR regarding a simple vision from UR articles and i modified the program to trigger a camera, since i do not have a picking application, is this the correct method to trigger the camera?
Program
Move(J or L)
camera = rpc_factory(“xmlrpc”, “http://127.0.0.1/RPC2”)
if (! camera.initialize(“RGB”)):
popup(“Camera was not initialized”)
refrence point
GetCameraData Folder
'#Read Data from Cognex Camera
x:=coordenate x from camera
y:= coordenate y from camera
rz:=coordenate z from camera
Calculate folder
'# Conversion mm to m and deg to rad
offset:=p[(x/1000), (y/1000), 0 , 0, 0, d2r(rz)]
target=pose_trans(refrence_point, offset)
MoveToCamPose
Move (J or L)
camera.takeSnapshot()
target = camera.getTarget()
I think that I would have to repeat the sequence for every point that I want to take a snapshot.
Is my assumption correct? What happen to the waypoints? are those points replaced by the coordinates x,y, rz?
Thanks to Daniel271 posting in a different conversation and also some postings from matthewd92 I was able to modify the program once more. I am entering this comment to track the changes of the original program and to help others as we find the correct answer for our application: one camera, inspection, VIDI or insight, 4 positions around a piece of hardware. the challenge is that we do not have a pick in place, but inspection all around a part. The program that we will try as follows:
Program
Init Variables
BeforeStart
conn≔ False
Loop conn≟ False
conn≔socket_open(“10.10.10.10”,3000,“socket0”)
Robot Program
Socket send_byte(15,“socket0”)
socket_send_byte(10,“socket0”)
socket_send_string(“r”,“socket0”)
socket_send_byte(13,“socket0”)
var_1≔socket_read_string(“socket0”)
Wait: 0.2
Move(J or L)
camera = rpc_factory(“xmlrpc”, “http://127.0.0.1/RPC2”)
if (! camera.initialize(“RGB”)):
popup(“Camera was not initialized”)
refrence point
GetCameraData Folder
'#Read Data from Cognex Camera
x:=coordenate x from camera
y:= coordenate y from camera
rz:=coordenate z from camera
Calculate folder
'# Conversion mm to m and deg to rad
offset:=p[(x/1000), (y/1000), 0 , 0, 0, d2r(rz)]
target=pose_trans(refrence_point, offset)
MoveToCamPose
Move (J or L)
camera.takeSnapshot()
target = camera.getTarget()
I will add comments as we advance in our research. This program maybe duplicating the effort with two different methods? Any help is greatly appreciated.
Are there any manuals detailing the different functions that can be called for the “camera” variable in your code?