In this example automatic setting of the four local points in
ExternalReference tool is shown. The following tools are present in the
toolbox:
- Calibration - ExternalLogic - hold the calibration state - 1 is
calibration mode
- CalibStatus - ExternalText - holds a message that is updated when
running this tool
- Point1, Point2, Point3, Point4 - PointFromLines - the actual local
points to be added ExternalReference
- ProfileCalibration - ExternalReference
The located points in a laser profile calibration
Example: import SPB
def SetProfileCalibration():
robCoor = GetTool('ProfileCalibration')
calib = GetValue('Calibration.Value')
if not calib :
SetValue('CalibStatus.Text','Set Calibration Mode')
else:
ok = 1
for i0 in range(4):
status = GetValue('Point'+str(int(i0+1))+'.Status')
ok = ok and status == 1
if not ok :
SetValue('CalibStatus.Text','Calibration failure')
if ok :
spb=SPB.CreateSpb(robCoor.config)
for i0 in range(4):
indexStr = str(int(i0+1))
x = GetValue('Point'+indexStr+'.Point_x')
y = GetValue('Point'+indexStr+'.Point_y')
spb.setFloat('Local'+indexStr+'.x',x)
spb.setFloat('Local'+indexStr+'.y',y)
robCoor.config=spb.xml
SetValue('CalibStatus.Text','Calibration
Updated') |