Example 2, trigger example with additional robot information This
example is as Example 1 with one exception - two values are transfered to
Scorpion before CameraTrigger.
MOTOMAN program:
0022 ...
0023 ...
0024 SET B014 1 'set register B014 to 1 to signal robot in position
0025 SET I017 12 'set register I017 to 12 as robot
height
0026 SET D024 16.23 'set register D024 to 16.23 as robot delta
0027 SAVEV B014 'notify Scorpion robot in position
0028 SAVEV I017 'transfer robot height
0029 SAVEV D024 'transfer robot delta
0030 LOADV B015 'wait for Scorpion inspection result
0031 LOADV P005 'wait for Scorpion position results
0032 ...
0033 ...
Motoman_Trigger script
def Handle_MOTOMAN_Trigger(value):
#this is called from robot by instuction SAVEV BXXX
print 'Handle_MOTOMAN_Trigger',value
h=ExtractResult(MOTOMAN.GetInt('varno=17')) # reads height
value
print 'Robot Height ',d
SetValue('Height.Value',h) # set value to Height tool in Toolbox
d=ExtractResult(MOTOMAN.GetDouble('varno=24'))
print 'Robot Delta ',d
SetValue('Delta.Value',d)
#capture image
print 'CameraTrigger',ExecuteCmd('CameraTrigger','')
# this function extracts the value from the Getxxx methods
def ExtractResult(str):
import string
res=0
t0=string.split(str,';')
n=len(t0)
if n>0:
t1=string.split(t0[n-1],'=')
n=len(t1)
if n==2:
res=int(t1[1])
return res
|