Example 1, simple trigger example: In Scorpion-Central we have created a page MOTOMAN and inserted the
MotoMan plugin. We have activated the plugin event OnTrigger where
we will tell Scorpion to grab a new image, do an inspection and give the robot a position and a
result due to the inspection result when the robot is in position.
Robot Program
0022 ...
0023 ...
0024 SET B014 1 'set register B014 to 1 to signal robot in position
0025 SAVEV B014 'notify Scorpion robot in position
0026 LOADV B015 'wait for Scorpion inspection result
0027 LOADV P005 'wait for Scorpion position results
0028 ...
0029 ...
Scorpion Events
Central.Start
print MOTOMAN.Connect('comport=1;path=c:\\')
'BeforeStart' - System Event
MOTOMAN.Trigger
print 'CameraTrigger',ExecuteCmd('CameraTrigger','')
'AfterInspect' - System Event
In the Scorpion 'AfterInspect' system event, the SetResult script
sends the position to be robot
Script.SetResult
def Motoman_SetResult():
#get vision result from toollist
ok=str(GetIntValue('VisionStatus.Value'))
dx=str(GetValue('Position.Point_x'))
dy=str(GetValue('Position.Point_y'))
a = str(GetValue('PickReference.Angle'))
#send data to robot
print MOTOMAN.SetByte('varno=18;value='+ok)
print MOTOMAN.SetPosition('varno=5;dx='+dx+';dy='+dy+';angle='+a)
#reactivate robot
Motoman_Activate()
'AfterStop' - System Event
|