From ad14b5f67f233348b4ecc1799ac68c1caef8a1af Mon Sep 17 00:00:00 2001 From: sfop Date: Wed, 10 Aug 2016 17:12:15 +0200 Subject: [PATCH] Closedown --- script/camtool.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/script/camtool.py b/script/camtool.py index c997e26..beaf7c6 100644 --- a/script/camtool.py +++ b/script/camtool.py @@ -26,8 +26,25 @@ class CamToolImage(ReadableMatrix): class CamTool(DeviceBase): - def __init__(self, name, prefix = "cam:", latch = False): + def __init__(self, name, prefix = "cam:", latch = False, camera = "~/Simulation.json"): DeviceBase.__init__(self, name) + run_channel = prefix + "camera.run" + try: + caget(run_channel) + except: + cmd = "camtool --casprefix " + prefix + " " + camera #--nogui --run -1 + fork( (exec_cmd,(cmd,)),) + start = time.time() + while(True): + try: + caget(run_channel) + time.sleep(5.0) + break + except: + if time.time() - start > 20.0: + raise Exception("Camtool application not started") + time.sleep(0.5) + self.prefix = prefix self.latch = latch self.mode = "latch" if latch else "pipeline" @@ -152,9 +169,9 @@ class CamTool(DeviceBase): if __name__ == "__builtin__": camera_tool = CamTool("camtool") - print camera_tool.com_x_mean.read() + #print camera_tool.com_x_mean.read() + camera_tool.enableBackground(False) camera_tool.enableBackground(False) - camera_tool.enableBackground(True) camera_tool.captureBackground(5) for i in range (100): camera_tool.capture()