示例#1
0
ecmcSlitDemoLib.triggHomeAxis(rightMotor, 3)

print 'Wait for homing sequences to finish:',
done = ecmcSlitDemoLib.waitForAxis(leftMotor, 180)
if not done:
    print "%s failed to home." % leftMotor
    sys.exit()
done = ecmcSlitDemoLib.waitForAxis(rightMotor, 180)
if not done:
    print "%s failed to home." % rightMotor
    sys.exit()

ecmcSlitDemoLib.setAxisEnable(masterMotor, 1)
#run master axis motor to 0
print 'Move master axis to position 0.'
done = ecmcSlitDemoLib.moveAxisPosition(masterMotor, 0, 1000)
if not done:
    print "%s failed to position." % masterMotor
    sys.exit()
ecmcSlitDemoLib.setAxisEnable(masterMotor, 0)

#disable amplifier of left and right motor
print 'Disable amplifiers on all axes.'
ecmcSlitDemoLib.setAxisEnable(leftMotor, 0)
ecmcSlitDemoLib.setAxisEnable(rightMotor, 0)
ecmcSlitDemoLib.setAxisEnable(gapMotor, 0)
ecmcSlitDemoLib.setAxisEnable(centerMotor, 0)
ecmcSlitDemoLib.setAxisEnable(masterMotor, 0)
time.sleep(1)  #ensure that enabled goes down
error = ecmcSlitDemoLib.getAxisError(leftMotor, 1)
error = ecmcSlitDemoLib.getAxisError(rightMotor, 1)
ecmcSlitDemoLib.setAxisReset(motorPvName, 0)

print('Enable amplifier')
ecmcSlitDemoLib.setAxisEnable(motorPvName, 1)
time.sleep(0.2)  #ensure that enabled goes down
error = ecmcSlitDemoLib.getAxisError(motorPvName, 1)
counter = 0

timeOut = 50

while counter < testLoops:
    #run gap and center motorPvName to 0

    print('Move axis to position ' + str(fromPos) + ' (cycles = ' +
          str(counter) + ').')
    done = ecmcSlitDemoLib.moveAxisPosition(motorPvName, fromPos, velo,
                                            timeOut)
    if not done:
        print(motorPvName + " failed to position.")
        sys.exit()
    timeOut = 5
    print('Move axis to position ' + str(toPos) + ' (cycles = ' +
          str(counter) + ').')
    done = ecmcSlitDemoLib.moveAxisPosition(motorPvName, toPos, velo, timeOut)
    if not done:
        print(motorPvName + " failed to position.")
        sys.exit()
    counter = counter + 1
    time.sleep(1)
    testPv.put(testNumberBase + counter)

time.sleep(1)
ecmcSlitDemoLib.setAxisReset(motorPvName, 1)
time.sleep(0.2)
ecmcSlitDemoLib.setAxisReset(motorPvName, 0)

print('Enable amplifier')
ecmcSlitDemoLib.setAxisEnable(motorPvName, 1)
time.sleep(.2)  #ensure that enabled goes down
error = ecmcSlitDemoLib.getAxisError(motorPvName, 1)
counter = 0

timeOut = 2

while counter < steps:
    #run gap and center motorPvName to 0
    counter = counter + 1
    print('Move axis to position ' + str(startPos + counter * stepSize) +
          ' (cycles = ' + str(counter) + ').')
    done = ecmcSlitDemoLib.moveAxisPosition(motorPvName,
                                            startPos + counter * stepSize,
                                            velo, timeOut)
    if not done:
        print(motorPvName + " failed to position.")
        sys.exit()
    time.sleep(1)
    testPv.put(testNumberBase + counter)

time.sleep(.2)
testPv.put(testNumberBase)

print("Test done!")
示例#4
0
ecmcSlitDemoLib.setAxisReset(Mtr1, 1)
ecmcSlitDemoLib.setAxisReset(Mtr2, 1)
#ecmcSlitDemoLib.setAxisReset(Mtr3, 1)
#ecmcSlitDemoLib.setAxisReset(Mtr4, 1)
#ecmcSlitDemoLib.setAxisReset(Mtr5, 1)
#ecmcSlitDemoLib.setAxisReset(Mtr6, 1)
ecmcSlitDemoLib.setAxisReset(gapMotor, 1)
ecmcSlitDemoLib.setAxisReset(centerMotor, 1)
time.sleep(0.5)

while True:
    mov = 10
    if mov == 10:
        print "Moving gap to %s" % mov
        done = ecmcSlitDemoLib.moveAxisPosition(gapMotor, mov)
        if not done:
            print "%s failed to position." % gapMotor
            sys.exit()
        done = ecmcSlitDemoLib.waitForAxis(gapMotor, 1800)
        if not done:
            print "%s failed waiting" % gapMotor
            sys.exit()
        mov = 60
        time.sleep(2)
    if mov == 60:
        print "Moving gap to %s" % mov
        done = ecmcSlitDemoLib.moveAxisPosition(gapMotor, mov)
        if not done:
            print "%s failed to position" % gapMotor
            sys.exit()
示例#5
0
    if not limitVal:
        print('Reached switch')
        wait_for_done = 0
    else:
        wait_for_done -= polltime
        if wait_for_done == 0:
            print('timeOut! Did not reach switch..')
            sys.exit()

print('Now at switch')

startPos = ecmcSlitDemoLib.getActPos(
    motorPvName) + stepSize  # Now in the limit
print('Move axis to position startposition just before switch: ' +
      str(startPos))
done = ecmcSlitDemoLib.moveAxisPosition(motorPvName, startPos, velo, timeOut)
while counter < testLoops:
    print('Engage switch')
    error = ecmcSlitDemoLib.moveAxisVelocity(motorPvName, -velo)
    polltime = 1
    counter += 1
    wait_for_done = timeOut
    while wait_for_done > 0:
        time.sleep(polltime)
        limitVal = limitPv.get()
        if not limitVal:
            print('Reached switch')
            wait_for_done = 0
        else:
            wait_for_done -= polltime
            if wait_for_done == 0:
示例#6
0
   ecmcSlitDemoLib.setAxisReset(leftMotor, 1)
   ecmcSlitDemoLib.setAxisReset(rightMotor, 1)
   time.sleep(0.5)
   ecmcSlitDemoLib.setAxisReset(leftMotor, 0)
   ecmcSlitDemoLib.setAxisReset(rightMotor, 0)

   #ensure of all axis are enable 
   print 'Enable Axes'
   ecmcSlitDemoLib.setAxisEnable(leftMotor, 1)
   ecmcSlitDemoLib.setAxisEnable(rightMotor, 1)
   time.sleep(0.5) #ensure that axes are enabled 
   error=ecmcSlitDemoLib.getAxisError(leftMotor,1)
   error=ecmcSlitDemoLib.getAxisError(rightMotor,1);
   #run right Motor to pos 10
   print 'Move right axis to pos 10, turn: %d'%(x)
   done=ecmcSlitDemoLib.moveAxisPosition(rightMotor,10,10)
   if not done:
    print "%s failed to position." % rightMotor
    sys.exit()
   time.sleep(10)
   #run right Motor to pos 0
   #Reset error on all axis
   print 'Reset error on all axes.'
   ecmcSlitDemoLib.setAxisReset(leftMotor, 1)
   ecmcSlitDemoLib.setAxisReset(rightMotor, 1)
   time.sleep(0.5)
   ecmcSlitDemoLib.setAxisReset(leftMotor, 0)
   ecmcSlitDemoLib.setAxisReset(rightMotor, 0)

   #ensure of all axis are enable 
   print 'Enable Axes'