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]) data = np.append(data, newdata[1]) print acsc.readReal(hc, acsc.NONE, "foo") acsc.printLastError()
def axis_state(self): """Returns axis state dict.""" return acsc.getAxisState(self.controller.hc, self.axisno)
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]) data = np.append(data, newdata[1]) print(acsc.readReal(hc, acsc.NONE, "foo")) acsc.printLastError()