socket = create_connection((hostname, port)) line = Line(socket) #line = DebugLine(line) piv = Piv(line) kshd = Kshd(piv, address) kshd.stop() if True: kshd.setCoordinate(0) conf = kshd.getConfiguration() conf.moveCurrent = 1 conf.holdDelay = 0.5 kshd.setConfiguration(conf) print(kshd.getConfiguration()) print(kshd.getSpeed()) def wait(): while True: s = kshd.status() # print(s) #print("To go:",kshd.getStepsToGo()) if s.ready: print("Coordinate", kshd.getCoordinate()) break wait() def benchmark(f): start = datetime.now() f() stop = datetime.now()
if key == "-h": printHelp() exit(1) if len(args) != 1: printHelp() exit(1) value = float(args[0]) socket = create_connection((hostname, port)) line = Line(socket) dac = Adam4024(line, address) for ch in range(4): dac.setChannel(ch, 0) dac.setChannelOutputRange(channel, 1) piv = Piv(line) kshd = Kshd(piv, 1) s = kshd.getSpeed() s.max = 2000 kshd.setSpeed(s) kshd.go(-400000) while value > 4: dac.setChannel(ch, value) sleep(0.1) value -= 0.1 dac.setChannel(channel, 0) kshd.stop()