From 6d66dbdf6d5201ce400293063e777e1254ad2081 Mon Sep 17 00:00:00 2001 From: sfop Date: Tue, 30 Aug 2016 15:32:35 +0200 Subject: [PATCH] Closedown --- script/Alignment/Laser_gun_alignment.py | 2 +- script/camtool.py | 48 +++++++++++++------------ 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/script/Alignment/Laser_gun_alignment.py b/script/Alignment/Laser_gun_alignment.py index f1e1507..4ca84a7 100755 --- a/script/Alignment/Laser_gun_alignment.py +++ b/script/Alignment/Laser_gun_alignment.py @@ -114,7 +114,7 @@ gsa_log_msg = gsa_log_msg + "\n\n" + r.print() if do_elog: elog("Gun solenoid current scan", gsa_log_msg , get_plot_snapshots()) -#_=[r, hx, hy] +_=[r, hx, hy] set_return([r, hx, hy]) diff --git a/script/camtool.py b/script/camtool.py index 152a6d2..0bb44b8 100644 --- a/script/camtool.py +++ b/script/camtool.py @@ -127,28 +127,32 @@ class CamTool(DeviceBase): self.cam_run.write(0) def capture(self): - timestamp = self.timestamp.read() - print "Current timestamp: ", timestamp - if not self.latch: - self.cam_run.write(1) - else: - self.cam_latch.write(1) - start = time.time() + retries = 3 while(True): - val = self.timestamp.read() - if timestamp != val: - print "New timestamp: ", val - self.setCache(val) - break - #if self.latch: - # self.cam_latch.write(1) - time.sleep(0.001) - if (time.time()-start) > self.grab_timeout: - #if not self.latch: - # self.cam_run.write(1) - #else: - raise Exception("Grab Timeout") - + timestamp = self.timestamp.read() + print "Current timestamp: ", timestamp + if not self.latch: + self.cam_run.write(1) + else: + self.cam_latch.write(1) + start = time.time() + while(True): + val = self.timestamp.read() + if timestamp != val: + print "New timestamp: ", val + self.setCache(val) + break + #if self.latch: + # self.cam_latch.write(1) + time.sleep(0.001) + if (time.time()-start) > self.grab_timeout: + #if not self.latch: + # self.cam_run.write(1) + #else: + retries = retries -1 + if retries<=0: + raise Exception("Grab Timeout") + def doUpdate(self): self.com_x_samples, self.com_y_samples = [], [] for i in range(self.num_images): @@ -192,7 +196,7 @@ class CamTool(DeviceBase): if __name__ == "__builtin__": - camera_tool = CamTool("camtool", latch = False) + camera_tool = CamTool("camtool", prefix = "SINEG01-DSCR190:", latch = False, camera = "SINEG01-DSCR190") add_device(camera_tool, True) #camera_tool.enableBackground(False) camera_tool.enableBackground(False)