Example #1
0
 def on_goPlatform(self):
     vel = self.ui.velSpinBox.value()
     acc = self.ui.accSpinBox.value()
     acsc.setVelocity(self.hcomm, self.axis, vel)
     acsc.setAcceleration(self.hcomm, self.axis, acc)
     acsc.setDeceleration(self.hcomm, self.axis, acc)
     acsc.setJerk(self.hcomm, self.axis, acc*10)
     acsc.toPoint(self.hcomm, None, self.axis, self.platform)
Example #2
0
 def on_go(self):
     target = self.ui.posSpinBox.value()
     vel = self.ui.velSpinBox.value()
     acc = self.ui.accSpinBox.value()
     acsc.setVelocity(self.hcomm, self.axis, vel)
     acsc.setAcceleration(self.hcomm, self.axis, acc)
     acsc.setDeceleration(self.hcomm, self.axis, acc)
     acsc.setJerk(self.hcomm, self.axis, acc*10)
     if self.ui.rbRelative.isChecked() == True:
         flags = acsc.AMF_RELATIVE
     else:
         flags = None
     acsc.toPoint(self.hcomm, flags, self.axis, target)
Example #3
0
# Create an ACSPL+ program to load into the controller
prg = prgs.ACSPLplusPrg()
prg.declare_2darray("global", "real", "data", 2, dblen)
prg.addline("global real foo")
prg.addline("foo = 6.5")
prg.addline("ENABLE 0")
prg.add_dc("data", dblen, sr, "TIME, FVEL(0)", "/c")
for n in xrange(3):
    prg.addptp(0, 10000, "/e")
    prg.addptp(0, 0, "/e")
prg.addline("WAIT 10000")
prg.addline("STOPDC")
prg.addstopline()

acsc.setAcceleration(hc, 0, 10000)
acsc.loadBuffer(hc, 0, prg, 1024)
acsc.runBuffer(hc, 0)

astate = acsc.getAxisState(hc, 0)
#print astate

for n in xrange(3):
    time.sleep(sleeptime)
    newdata = acsc.readReal(hc, acsc.NONE, "data", 0, 1, 0, dblen/2-1)
    print acsc.readInteger(hc, acsc.NONE, "S_DCN")
    t = np.append(t, newdata[0])
    data = np.append(data, newdata[1])
    time.sleep(sleeptime)
    newdata = acsc.readReal(hc, acsc.NONE, "data", 0, 1, dblen/2, dblen-1)
    t = np.append(t, newdata[0])
Example #4
0
 def acc(self, accel):
     """Sets axis velocity."""
     acsc.setAcceleration(self.controller.hc, self.axisno, accel)
Example #5
0
 def on_pbJogPlus_press(self):
     acsc.setAcceleration(self.hcomm, self.axis, 0.2, acsc.SYNCHRONOUS)
     acsc.setDeceleration(self.hcomm, self.axis, 0.2, acsc.SYNCHRONOUS)
     acsc.setJerk(self.hcomm, self.axis, 2, acsc.SYNCHRONOUS)
     acsc.jog(self.hcomm, acsc.AMF_VELOCITY, self.axis, 0.2)
Example #6
0
    def initialization(self):

        print "Waiting for Motorized Stage (ACS) Initialization"
        self.hc = acsc.openCommEthernetTCP(address="10.0.0.100",
                                           port=701)  ## craete comminucation

        acsc.runBuffer(self.hc, 0)
        acsc.runBuffer(self.hc, 1)
        acsc.runBuffer(self.hc, 2)
        acsc.runBuffer(self.hc, 4)
        acsc.runBuffer(self.hc, 5)
        acsc.runBuffer(self.hc, 6)

        time.sleep(30)

        ## Homing process

        ## Axis 6
        acsc.waitMotionEnd(self.hc, axis=6)  ## stop at left limit
        if acsc.setFPosition(self.hc, axis=6, fposition=0) != 0:
            print 'Axis 6 (Receiver Z): Homing completed'
        else:
            print 'Axis 6 (Receiver Z): Homing failed'

        ## Axis 0
        acsc.waitMotionEnd(self.hc, axis=0)
        acsc.toPoint(self.hc, flags=acsc.AMF_RELATIVE, axis=0, target=47.5)
        acsc.waitMotionEnd(self.hc, axis=0)
        if acsc.setFPosition(self.hc, axis=0, fposition=0) == 1:
            print 'Axis 0 (Sample X): Homing completed'
        else:
            print 'Axis 0 (Sample X): Homing failed'

        ## Axis 1
        acsc.waitMotionEnd(self.hc, axis=1)
        acsc.toPoint(self.hc, flags=acsc.AMF_RELATIVE, axis=1, target=19.51)
        acsc.waitMotionEnd(self.hc, axis=1)
        if acsc.setFPosition(self.hc, axis=1, fposition=0) == 1:
            print 'Axis 1 (Sample Y): Homing completed'
        else:
            print 'Axis 1 (Sample Y): Homing failed'

        ## Axis 2
        acsc.waitMotionEnd(self.hc, axis=2)  ## stop at left limit
        acsc.toPoint(self.hc, flags=0, axis=2, target=2.8915)
        print 'Axis 2 (Lens array): Homing completed'

        ## Axis 4
        acsc.waitMotionEnd(self.hc, axis=4)  ## stop at left limit
        acsc.toPoint(self.hc, flags=acsc.AMF_RELATIVE, axis=4, target=4.42)
        acsc.waitMotionEnd(self.hc, axis=4)
        if acsc.setFPosition(self.hc, axis=4, fposition=0) == 1:
            print 'Axis 4 (Receiver X): Homing completed'
        else:
            print 'Axis 4 (Receiver X): Homing failed'

        ## Axis5
        acsc.waitMotionEnd(self.hc, axis=5)  ## stop at left limit
        acsc.toPoint(self.hc, flags=acsc.AMF_RELATIVE, axis=5, target=23.8)
        acsc.waitMotionEnd(self.hc, axis=5)
        if acsc.setFPosition(self.hc, axis=5, fposition=0) == 1:
            print 'Axis 5 (Receiver Y): Homing completed'
        else:
            print 'Axis 5 (Receiver Y): Homing failed'

        ## parameter setting
        acsc.setVelocity(self.hc, 0, 30)  ## axis 0 (linear X)
        acsc.setAcceleration(self.hc, 0, 100)
        acsc.setDeceleration(self.hc, 0, 100)
        acsc.setJerk(self.hc, 0, 1000)

        acsc.setVelocity(self.hc, 1, 30)  ## axis1 (linear Y)
        acsc.setAcceleration(self.hc, 1, 100)

        acsc.setDeceleration(self.hc, 1, 100)
        acsc.setJerk(self.hc, 1, 1000)

        acsc.setVelocity(self.hc, 2, 30)  ## axis 2 (revolver)
        acsc.setAcceleration(self.hc, 2, 100)
        acsc.setDeceleration(self.hc, 2, 100)
        acsc.setJerk(self.hc, 2, 1000)

        acsc.setVelocity(self.hc, 4, 30)  ## axis4 (step X)
        acsc.setAcceleration(self.hc, 4, 100)
        acsc.setDeceleration(self.hc, 4, 100)
        acsc.setJerk(self.hc, 4, 1000)

        acsc.setVelocity(self.hc, 5, 30)  ## axis 5 (step Y)
        acsc.setAcceleration(self.hc, 5, 100)
        acsc.setDeceleration(self.hc, 5, 100)
        acsc.setJerk(self.hc, 5, 1000)

        acsc.setVelocity(self.hc, 6, 5)  ## axis 6 (step Z)
        acsc.setAcceleration(self.hc, 6, 50)
        acsc.setDeceleration(self.hc, 6, 50)
        acsc.setJerk(self.hc, 1, 100)
Example #7
0
 def acc(self, accel):
     """Sets axis velocity."""
     acsc.setAcceleration(self.controller.hc, self.axisno, accel)
Example #8
0
# Create an ACSPL+ program to load into the controller
prg = prgs.ACSPLplusPrg()
prg.declare_2darray("global", "real", "data", 2, dblen)
prg.addline("global real foo")
prg.addline("foo = 6.5")
prg.addline("ENABLE 0")
prg.add_dc("data", dblen, sr, "TIME, FVEL(0)", "/c")
for n in range(3):
    prg.addptp(0, 10000, "/e")
    prg.addptp(0, 0, "/e")
prg.addline("WAIT 10000")
prg.addline("STOPDC")
prg.addstopline()

acsc.setAcceleration(hc, 0, 10000)
acsc.loadBuffer(hc, 0, prg, 1024)
acsc.runBuffer(hc, 0)

astate = acsc.getAxisState(hc, 0)
#print astate

for n in range(3):
    time.sleep(sleeptime)
    newdata = acsc.readReal(hc, acsc.NONE, "data", 0, 1, 0, dblen / 2 - 1)
    print(acsc.readInteger(hc, acsc.NONE, "S_DCN"))
    t = np.append(t, newdata[0])
    data = np.append(data, newdata[1])
    time.sleep(sleeptime)
    newdata = acsc.readReal(hc, acsc.NONE, "data", 0, 1, dblen / 2, dblen - 1)
    t = np.append(t, newdata[0])
####stage calls###
##################
if load_stages:
    #initiate connection
    hcomm = acsc.openCommEthernetTCP(address="10.0.0.100", port=701)
    #z
    if scan_gain:
        acsc.enable(hcomm, 0)
        acsc.toPoint(hcomm, None, 0, 110)  #YIFU CHECK THIS
        acsc.setVelocity(hcomm, 0, 5)  #velocity in mm/sec
    #theta
    acsc.enable(hcomm, 1)
    acsc.setVelocity(hcomm, 1, 10)  #velocity in degrees/sec
    acsc.setJerk(hcomm, 1, 500)  #jerk, normal is 9000
    acsc.setDeceleration(hcomm, 1, 450)  #jerk, normal is 9000
    acsc.setAcceleration(hcomm, 1, 450)  #Acceleration, normal is 9000
    acsc.toPoint(hcomm, None, 1, 0)

#Actually do the imaging
if do_scan:
    for idx in range(degrees_array.shape[0]):
        q = time.time()
        set_degree = degrees_array[idx]
        move_stage(degrees_array[idx])
        # print("time it takes to moves")
        # print(time.time()-q)
        moving = True
        # while(abs(acsc.getFVelocity(hcomm, 1))>wait_ms): #check for stop event using other API call?
        # 1+1
        while (not acsc.getMotorState(hcomm, 1)['in position']
               ):  #check for stop event using other API call?