def run(self): """Start the run""" if not acsc.getOutput(self.hc, 1, 16): acsc.setOutput(self.hc, 1, 16, 1) self.daqthread.start() self.msleep(2000) # Wait for NI to start waiting for trigger self.start_motion()
def run(self): """Start the run. Comms should be open already with the controller.""" if acsc.getOutput(self.hc, 1, 16): acsc.setOutput(self.hc, 1, 16, 0) if self.vectrino: acsc.enable(self.hc, 0) acsc.enable(self.hc, 1) while not acsc.getMotorState(self.hc, 0)["enabled"] or not \ acsc.getMotorState(self.hc, 1)["enabled"]: self.msleep(100) acsc.toPoint(self.hc, None, 0, self.y_R * self.R) acsc.toPoint(self.hc, None, 1, self.z_H * self.H) while not acsc.getMotorState(self.hc, 0)["in position"] or not \ acsc.getMotorState(self.hc, 1)["in position"]: self.msleep(300) print("y- and z-axes in position") acsc.disable(self.hc, 0) acsc.disable(self.hc, 1) self.vec.serial_port = "COM2" self.vec.connect() tstart = time.time() self.timeout = False self.vecstatus = "Connecting to Vectrino..." while not self.vec.connected: self.msleep(300) if time.time() - tstart > 10: print("Vectrino timed out") self.timeout = True break if not self.timeout: self.vec.stop() self.setvecconfig() if self.recordvno: self.vec.start_disk_recording(self.vecsavepath) self.vec.start() self.vecstatus = "Vectrino connected " while self.vec.state != "Confirmation mode": self.msleep(100) print("Vectrino in data collection mode") print("Waiting 6 seconds") self.sleep(6) self.daqthread.start() if self.fbg: self.fbgthread.start() self.start_motion() elif self.nidaq: self.daqthread.start() if self.fbg: self.fbgthread.start() self.start_motion() else: # Start motion self.start_motion()
def run(self): """Start the run. Comms should be open already with the controller.""" if acsc.getOutput(self.hc, 1, 16): acsc.setOutput(self.hc, 1, 16, 0) if self.vectrino: acsc.enable(self.hc, 0) acsc.enable(self.hc, 1) while not acsc.getMotorState(self.hc, 0)["enabled"] or not \ acsc.getMotorState(self.hc, 1)["enabled"]: self.msleep(100) acsc.toPoint(self.hc, None, 0, self.y_R*self.R) acsc.toPoint(self.hc, None, 1, self.z_H*self.H) while not acsc.getMotorState(self.hc, 0)["in position"] or not \ acsc.getMotorState(self.hc, 1)["in position"]: self.msleep(300) print("y- and z-axes in position") acsc.disable(self.hc, 0) acsc.disable(self.hc, 1) self.vec.serial_port = "COM2" self.vec.connect() tstart = time.time() self.timeout = False self.vecstatus = "Connecting to Vectrino..." while not self.vec.connected: self.msleep(300) if time.time() - tstart > 10: print("Vectrino timed out") self.timeout = True break if not self.timeout: self.vec.stop() self.setvecconfig() if self.recordvno: self.vec.start_disk_recording(self.vecsavepath) self.vec.start() self.vecstatus = "Vectrino connected " while self.vec.state != "Confirmation mode": self.msleep(100) print("Vectrino in data collection mode") print("Waiting 6 seconds") self.sleep(6) self.daqthread.start() if self.fbg: self.fbgthread.start() self.start_motion() elif self.nidaq: self.daqthread.start() if self.fbg: self.fbgthread.start() self.start_motion() else: # Start motion self.start_motion()