Tested on real system, working:
Calibrate.py Motor Test 1.py
This commit is contained in:
@@ -20,7 +20,7 @@ def startTest(testName, DEVICE, params):
|
||||
######### WRITE YOUR CODE HERE BELOW #############
|
||||
scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)',
|
||||
'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)',
|
||||
'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)',
|
||||
'Diameter (DIAM:2)', 'Logical Position (IST:2)',
|
||||
'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)',
|
||||
'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
|
||||
scan.setPlotName(plotName)
|
||||
@@ -57,7 +57,6 @@ def startTest(testName, DEVICE, params):
|
||||
LogicalPosition = idLogicalPosition.get()
|
||||
PotiRaw = idPotiRaw.get()
|
||||
MotorPositionRaw = idMotorPositionRaw.get()
|
||||
Com = idCom.get()
|
||||
MotorPosition = idMotorPosition.get()
|
||||
PotiPosFromBeam = idPotiPosFromBeam.get()
|
||||
PotiPosition = idPotiPosition.get()
|
||||
@@ -67,11 +66,11 @@ def startTest(testName, DEVICE, params):
|
||||
Inkr = idInkr.get()
|
||||
InkrRb = idInkrRb.get()
|
||||
|
||||
scan.append([setpoint2], [setpoint2],
|
||||
[MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition,
|
||||
scan.append([setpoint1], [setpoint1],
|
||||
[MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, LogicalPosition,
|
||||
MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position])
|
||||
|
||||
if (MotorStatus & int('1',2))==0: #device finished calibration (bit#1)
|
||||
if (int(MotorStatus) & int('1',2))==0: #device finished calibration (bit#1)
|
||||
#give the device some time before stating that it has really finished
|
||||
countDeviceInModeIdle = countDeviceInModeIdle +1
|
||||
if countDeviceInModeIdle == 10:
|
||||
@@ -80,28 +79,28 @@ def startTest(testName, DEVICE, params):
|
||||
countDeviceInModeIdle = 0
|
||||
|
||||
#check if any error bit is raised
|
||||
if bool(MotorStatus & int('10000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000',2)): #error: abort test
|
||||
test.sendFeedback('Motor switched off (bit#4)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000',2)): #error: abort test
|
||||
test.sendFeedback('No motor link (bit#5)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000',2)): #error: abort test
|
||||
test.sendFeedback('No poti link (bit#6)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000',2)): #error: abort test
|
||||
test.sendFeedback('Calibration error (bit#7)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R1 (bit#8)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R2 (bit#9)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test
|
||||
test.sendFeedback('Position measurement mismatch (bit#10)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test
|
||||
test.sendFeedback('Movement timeout (bit#11)', False)
|
||||
return
|
||||
|
||||
@@ -110,7 +109,6 @@ def startTest(testName, DEVICE, params):
|
||||
idLogicalPosition.close()
|
||||
idPotiRaw.close()
|
||||
idMotorPositionRaw.close()
|
||||
idCom.close()
|
||||
idMotorPosition.close()
|
||||
idPotiPosFromBeam.close()
|
||||
idPotiPosition.close()
|
||||
|
||||
@@ -83,28 +83,28 @@ def startTest(testName, DEVICE, params):
|
||||
countDeviceInModeIdle = 0
|
||||
|
||||
#check if any error bit is raised
|
||||
if bool(MotorStatus & int('10000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000',2)): #error: abort test
|
||||
test.sendFeedback('Motor switched off (bit#4)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000',2)): #error: abort test
|
||||
test.sendFeedback('No motor link (bit#5)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000',2)): #error: abort test
|
||||
test.sendFeedback('No poti link (bit#6)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000',2)): #error: abort test
|
||||
test.sendFeedback('Calibration error (bit#7)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R1 (bit#8)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R2 (bit#9)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test
|
||||
test.sendFeedback('Position measurement mismatch (bit#10)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test
|
||||
test.sendFeedback('Movement timeout (bit#11)', False)
|
||||
return
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ def startTest(testName, DEVICE, params):
|
||||
######### WRITE YOUR CODE HERE BELOW #############
|
||||
#get parameters from the calling interface
|
||||
try:
|
||||
test.log( "Running test Motor Test 2 for device " + DEVICE)
|
||||
#test.log( "with the following parameters:\n" + str(params))
|
||||
#test.log( 'testpath: ' + testPath )
|
||||
#test.log( 'parameters:' + str( params) )
|
||||
|
||||
@@ -38,7 +38,7 @@ def startTest(testName, DEVICE, params):
|
||||
|
||||
scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)',
|
||||
'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)',
|
||||
'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)',
|
||||
'Diameter (DIAM:2)', 'Logical Position (IST:2)',
|
||||
'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)',
|
||||
'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
|
||||
p1 = plot(None, name = "Poti Pos From Beam - Motor Position", context = plotName + " pos difference")[0]
|
||||
@@ -65,16 +65,16 @@ def startTest(testName, DEVICE, params):
|
||||
test.sendFeedback(ret, success)
|
||||
return
|
||||
|
||||
end = 4 #go to R2
|
||||
start = 3 #go to R1
|
||||
end = 4.0 #go to R2
|
||||
start = 3.0 #go to R1
|
||||
setpoint2 = end
|
||||
count = 0
|
||||
test.log('Starting test sequence')
|
||||
for setpoint1 in range(0, loopTimes * 2):
|
||||
for setpoint1 in range(0, (loopTimes * 2)):
|
||||
p1.addSeries(LinePlotSeries("Run"+str(count)))
|
||||
sleep(delaySeconds) # Settling time between runs
|
||||
# RegionPositioner idInkr
|
||||
idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
|
||||
idCom.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
|
||||
count = count + 1
|
||||
# scan for changes
|
||||
for scanTimes in range(0, 100000):
|
||||
@@ -85,7 +85,6 @@ def startTest(testName, DEVICE, params):
|
||||
LogicalPosition = idLogicalPosition.get()
|
||||
PotiRaw = idPotiRaw.get()
|
||||
MotorPositionRaw = idMotorPositionRaw.get()
|
||||
Com = idCom.get()
|
||||
MotorPosition = idMotorPosition.get()
|
||||
PotiPosFromBeam = idPotiPosFromBeam.get()
|
||||
PotiPosition = idPotiPosition.get()
|
||||
@@ -97,15 +96,15 @@ def startTest(testName, DEVICE, params):
|
||||
|
||||
idDiff01 = PotiPosition - MotorPosition
|
||||
|
||||
scan.append([setpoint2], [setpoint2],
|
||||
[MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition,
|
||||
scan.append([currentTime], [currentTime],
|
||||
[MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, LogicalPosition,
|
||||
MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position])
|
||||
|
||||
p1.getSeries(count).appendData(currentTime, idDiff01)
|
||||
|
||||
#extract Status bits
|
||||
endH = bool(MotorStatus & 8) #Ref2 (high limit)
|
||||
endL = bool(MotorStatus & 4) #Ref1 (low limit)
|
||||
endH = bool(int(MotorStatus) & 8) #Ref2 (high limit)
|
||||
endL = bool(int(MotorStatus) & 4) #Ref1 (low limit)
|
||||
|
||||
#check if arrived to R1 or R2
|
||||
if endH:
|
||||
@@ -119,28 +118,28 @@ def startTest(testName, DEVICE, params):
|
||||
test.log('Reached R1 switch, changing target to R2')
|
||||
break
|
||||
#check if any error bit is raised
|
||||
if bool(MotorStatus & int('10000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000',2)): #error: abort test
|
||||
test.sendFeedback('Motor switched off (bit#4)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000',2)): #error: abort test
|
||||
test.sendFeedback('No motor link (bit#5)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000',2)): #error: abort test
|
||||
test.sendFeedback('No poti link (bit#6)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000',2)): #error: abort test
|
||||
test.sendFeedback('Calibration error (bit#7)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R1 (bit#8)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R2 (bit#9)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test
|
||||
test.sendFeedback('Position measurement mismatch (bit#10)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test
|
||||
test.sendFeedback('Movement timeout (bit#11)', False)
|
||||
return
|
||||
|
||||
@@ -148,14 +147,14 @@ def startTest(testName, DEVICE, params):
|
||||
idMotorStatus.close()
|
||||
idLogicalPosition.close()
|
||||
idPotiRaw.close()
|
||||
idMotorStepRaw.close()
|
||||
idCom.close()
|
||||
idMotorPositionRaw.close()
|
||||
idMotorPosition.close()
|
||||
idPotiPosFromBeam.close()
|
||||
idPotiPosition.close()
|
||||
idPotiRef1Position.close()
|
||||
idPotiRef2Position.close()
|
||||
idDiameter.close()
|
||||
idCom.close()
|
||||
idInkr.close()
|
||||
idInkrRb.close()
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ def startTest(testName, DEVICE, params):
|
||||
test.sendFeedback(ret, success)
|
||||
return
|
||||
|
||||
scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)',
|
||||
scan = ManualScan(['time [1/'+ str(1/settlingTime) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)',
|
||||
'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)',
|
||||
'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)',
|
||||
'Diameter (DIAM:2)', 'Logical Position (IST:2)',
|
||||
'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)',
|
||||
'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
|
||||
scan.setPlotName(plotName)
|
||||
@@ -55,7 +55,6 @@ def startTest(testName, DEVICE, params):
|
||||
idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm]
|
||||
idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm]
|
||||
idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm]
|
||||
idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm]
|
||||
idMotorPosition = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm]
|
||||
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm]
|
||||
idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm]
|
||||
@@ -85,7 +84,7 @@ def startTest(testName, DEVICE, params):
|
||||
countSteps = 0
|
||||
count = 0
|
||||
test.log('Moving around middle point (+-' + str(span) + ')')
|
||||
for setpoint1 in range(0, loopTimes * 2):
|
||||
for setpoint1 in range(0, (loopTimes * 2)):
|
||||
count = count + 1
|
||||
sleep(5) # Settling time
|
||||
p1.addSeries(LinePlotSeries("Run" + str(count)))
|
||||
@@ -100,7 +99,6 @@ def startTest(testName, DEVICE, params):
|
||||
LogicalPosition = idLogicalPosition.get()
|
||||
PotiRaw = idPotiRaw.get()
|
||||
MotorPositionRaw = idMotorPositionRaw.get()
|
||||
Com = idCom.get()
|
||||
MotorPosition = idMotorPosition.get()
|
||||
PotiPosFromBeam = idPotiPosFromBeam.get()
|
||||
PotiPosition = idPotiPosition.get()
|
||||
@@ -110,16 +108,12 @@ def startTest(testName, DEVICE, params):
|
||||
Inkr = idInkr.get()
|
||||
InkrRb = idInkrRb.get()
|
||||
|
||||
idDiff01 = potiPosition - inkrRb
|
||||
# Manipulation idDiff02
|
||||
# Variable Mappings
|
||||
idDiff02 = potiPosition - MotorPosition
|
||||
idDiff01 = PotiPosition - MotorPosition
|
||||
countSteps = countSteps + 1
|
||||
scan.append([setpoint2], [setpoint2],
|
||||
[MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition,
|
||||
[MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, LogicalPosition,
|
||||
MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position])
|
||||
p1.getSeries(count).appendData(setpoint2, idDiff01)
|
||||
p2.getSeries(count).appendData(setpoint2, idDiff02)
|
||||
if (direction > 0.0 and setpoint2 >= end - 1):
|
||||
# invert direction and swap start with end of translation
|
||||
end = startDefault - 1
|
||||
@@ -137,8 +131,8 @@ def startTest(testName, DEVICE, params):
|
||||
|
||||
|
||||
#extract Status bits
|
||||
endH = bool(MotorStatus & 8) #Ref2 (high limit)
|
||||
endL = bool(MotorStatus & 4) #Ref1 (low limit)
|
||||
endH = bool(int(MotorStatus) & 8) #Ref2 (high limit)
|
||||
endL = bool(int(MotorStatus) & 4) #Ref1 (low limit)
|
||||
|
||||
#check if arrived to R1 or R2; if so, invert direction
|
||||
if endH:
|
||||
@@ -156,28 +150,28 @@ def startTest(testName, DEVICE, params):
|
||||
test.log('Reached R1 switch, changing direction to ' + str(direction))
|
||||
break
|
||||
#check if any error bit is raised
|
||||
if bool(MotorStatus & int('10000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000',2)): #error: abort test
|
||||
test.sendFeedback('Motor switched off (bit#4)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000',2)): #error: abort test
|
||||
test.sendFeedback('No motor link (bit#5)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000',2)): #error: abort test
|
||||
test.sendFeedback('No poti link (bit#6)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000',2)): #error: abort test
|
||||
test.sendFeedback('Calibration error (bit#7)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R1 (bit#8)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R2 (bit#9)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test
|
||||
test.sendFeedback('Position measurement mismatch (bit#10)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test
|
||||
test.sendFeedback('Movement timeout (bit#11)', False)
|
||||
return
|
||||
|
||||
@@ -186,7 +180,6 @@ def startTest(testName, DEVICE, params):
|
||||
idLogicalPosition.close()
|
||||
idPotiRaw.close()
|
||||
idMotorPositionRaw.close()
|
||||
idCom.close()
|
||||
idMotorPosition.close()
|
||||
idPotiPosFromBeam.close()
|
||||
idPotiPosition.close()
|
||||
|
||||
@@ -35,7 +35,7 @@ def startTest(testName, DEVICE, params):
|
||||
|
||||
scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)',
|
||||
'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)',
|
||||
'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)',
|
||||
'Diameter (DIAM:2)', 'Logical Position (IST:2)',
|
||||
'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)',
|
||||
'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
|
||||
scan.setPlotName(plotName)
|
||||
@@ -50,7 +50,6 @@ def startTest(testName, DEVICE, params):
|
||||
idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm]
|
||||
idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm]
|
||||
idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm]
|
||||
idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm]
|
||||
idMotorPosition = Channel(DEVICE + ':IST3:2' , type = 'd') # current position as from motor step counter [mm]
|
||||
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2' , type = 'd') # current position from beam as from potentiometer [mm]
|
||||
idPotiPosition = Channel(DEVICE + ':IST2:1' , type = 'd') # current position as from potentiometer [mm]
|
||||
@@ -78,7 +77,7 @@ def startTest(testName, DEVICE, params):
|
||||
countSteps = 0
|
||||
test.log('Starting testing sequence')
|
||||
count = 0
|
||||
for setpoint1 in range(0, loopTimes*2):
|
||||
for setpoint1 in range(0, (loopTimes*2)):
|
||||
count = count + 1
|
||||
sleep( 2 ) # Settling time
|
||||
p1.addSeries(LinePlotSeries("Run"+str(count)))
|
||||
@@ -92,7 +91,6 @@ def startTest(testName, DEVICE, params):
|
||||
LogicalPosition = idLogicalPosition.get()
|
||||
PotiRaw = idPotiRaw.get()
|
||||
MotorPositionRaw = idMotorPositionRaw.get()
|
||||
Com = idCom.get()
|
||||
MotorPosition = idMotorPosition.get()
|
||||
PotiPosFromBeam = idPotiPosFromBeam.get()
|
||||
PotiPosition = idPotiPosition.get()
|
||||
@@ -105,53 +103,53 @@ def startTest(testName, DEVICE, params):
|
||||
idDiff01 = PotiPosition-MotorPosition
|
||||
countSteps = countSteps + 1
|
||||
scan.append([setpoint2], [setpoint2],
|
||||
[MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition,
|
||||
[MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, LogicalPosition,
|
||||
MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position])
|
||||
p1.getSeries(count).appendData(setpoint2, idDiff01)
|
||||
|
||||
#extract Status bits
|
||||
endH = bool(MotorStatus & 8) #Ref2 (high limit)
|
||||
endL = bool(MotorStatus & 4) #Ref1 (low limit)
|
||||
endH = bool(int(MotorStatus) & 8) #Ref2 (high limit)
|
||||
endL = bool(int(MotorStatus) & 4) #Ref1 (low limit)
|
||||
|
||||
#check if arrived to R1 or R2
|
||||
if endH:
|
||||
#invert direction and swap start with end of translation
|
||||
end = startDefault
|
||||
start = readback2 - direction
|
||||
start = readback2 - (10.0*direction)
|
||||
direction = -1.0
|
||||
test.log('Reached R2 switch, changing target to R1')
|
||||
break
|
||||
elif endL:
|
||||
#invert direction and swap start with end of translation
|
||||
end = endDefault
|
||||
start = readback2 - direction
|
||||
start = readback2 - (10.0*direction)
|
||||
direction = 1.0
|
||||
test.log('Reached R1 switch, changing target to R2')
|
||||
break
|
||||
|
||||
#check if any error bit is raised
|
||||
if bool(MotorStatus & int('10000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000',2)): #error: abort test
|
||||
test.sendFeedback('Motor switched off (bit#4)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000',2)): #error: abort test
|
||||
test.sendFeedback('No motor link (bit#5)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000',2)): #error: abort test
|
||||
test.sendFeedback('No poti link (bit#6)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000',2)): #error: abort test
|
||||
test.sendFeedback('Calibration error (bit#7)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R1 (bit#8)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R2 (bit#9)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test
|
||||
test.sendFeedback('Position measurement mismatch (bit#10)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test
|
||||
test.sendFeedback('Movement timeout (bit#11)', False)
|
||||
return
|
||||
|
||||
@@ -160,7 +158,6 @@ def startTest(testName, DEVICE, params):
|
||||
idLogicalPosition.close()
|
||||
idPotiRaw.close()
|
||||
idMotorPositionRaw.close()
|
||||
idCom.close()
|
||||
idMotorPosition.close()
|
||||
idPotiPosFromBeam.close()
|
||||
idPotiPosition.close()
|
||||
|
||||
@@ -84,28 +84,28 @@ def startTest(testName, DEVICE, params):
|
||||
countDeviceInModeIdle = 0
|
||||
|
||||
#check if any error bit is raised
|
||||
if bool(MotorStatus & int('10000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000',2)): #error: abort test
|
||||
test.sendFeedback('Motor switched off (bit#4)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000',2)): #error: abort test
|
||||
test.sendFeedback('No motor link (bit#5)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000',2)): #error: abort test
|
||||
test.sendFeedback('No poti link (bit#6)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000',2)): #error: abort test
|
||||
test.sendFeedback('Calibration error (bit#7)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R1 (bit#8)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R2 (bit#9)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test
|
||||
test.sendFeedback('Position measurement mismatch (bit#10)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test
|
||||
test.sendFeedback('Movement timeout (bit#11)', False)
|
||||
return
|
||||
|
||||
|
||||
@@ -84,28 +84,28 @@ def startTest(testName, DEVICE, params):
|
||||
countDeviceInModeIdle = 0
|
||||
|
||||
#check if any error bit is raised
|
||||
if bool(MotorStatus & int('10000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000',2)): #error: abort test
|
||||
test.sendFeedback('Motor switched off (bit#4)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000',2)): #error: abort test
|
||||
test.sendFeedback('No motor link (bit#5)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000',2)): #error: abort test
|
||||
test.sendFeedback('No poti link (bit#6)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000',2)): #error: abort test
|
||||
test.sendFeedback('Calibration error (bit#7)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R1 (bit#8)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('1000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('1000000000',2)): #error: abort test
|
||||
test.sendFeedback('Cannot get to R2 (bit#9)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('10000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('10000000000',2)): #error: abort test
|
||||
test.sendFeedback('Position measurement mismatch (bit#10)', False)
|
||||
return
|
||||
if bool(MotorStatus & int('100000000000',2)): #error: abort test
|
||||
if bool(int(MotorStatus) & int('100000000000',2)): #error: abort test
|
||||
test.sendFeedback('Movement timeout (bit#11)', False)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user