From ef43580bdc1e4840b3b473d796e9915d42428be3 Mon Sep 17 00:00:00 2001 From: sfop Date: Tue, 5 Jul 2016 15:59:57 +0200 Subject: [PATCH] Script execution --- script/camtool.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/script/camtool.py b/script/camtool.py index a48af38..3898ac5 100644 --- a/script/camtool.py +++ b/script/camtool.py @@ -1,45 +1,45 @@ class CamTool: - def __init__(self, prefix = "cam:", latch = False) + def __init__(self, prefix = "cam:", latch = False): self.prefix = prefix self.latch = latch self.mode = "latch" if latch else "pipeline" - self.data_prefix = prefix + mode + "." + self.data_prefix = prefix + self.mode + "." self.cam_run = Channel(prefix + "camera.run", alias = "cam_run") self.cam_latch = Channel(prefix + "latch.capture", alias = "cam_latch") - self.timestamp = Channel(data_prefix + "timestamp", alias = "timestamp") #[D1, D2, ...] + self.timestamp = Channel(self.data_prefix + "timestamp", alias = "timestamp") #[D1, D2, ...] - self.cam_x = Channel(data_prefix + "x_stats.com", alias = "cam_x") - self.cam_y = Channel(data_prefix + "y_stats.com", alias = "cam_y") - self.profile_x = Channel(data_prefix + "profile.x", alias = "profile_x") - self.profile_y = Channel(data_prefix + "profile.y", alias = "profile_y") - self.cam_image = Channel(data_prefix + "image", alias = "cam_image") - self.cam_image_shape = Channel(data_prefix + "image.shape", alias = "cam_image_shape") #[D1, D2, ...] - self.cam_bg_image = Channel(data_prefix + "bg_image", alias = "cam_bg_image") #[D1, D2, ...] + self.cam_x = Channel(self.data_prefix + "x_stats.com", alias = "cam_x") + self.cam_y = Channel(self.data_prefix + "y_stats.com", alias = "cam_y") + self.profile_x = Channel(self.data_prefix + "profile.x", alias = "profile_x") + self.profile_y = Channel(self.data_prefix + "profile.y", alias = "profile_y") + self.cam_image = Channel(self.data_prefix + "image", alias = "cam_image") + self.cam_image_shape = Channel(self.data_prefix + "image.shape", alias = "cam_image_shape") #[D1, D2, ...] + self.cam_bg_image = Channel(self.data_prefix + "bg_image", alias = "cam_bg_image") #[D1, D2, ...] - self.cam_bg_en = Channel(prefix + "bg.enable", alias = "cam_bg_en") - self.cam_bg_capture = Channel(prefix + "bg.capture", alias = "cam_bg_capture") - self.cam_bg_capture_remain = Channel(prefix + "bg.capture", alias = "cam_bg_capture_remain") + self.cam_bg_en = Channel(self.prefix + "bg.enabled", alias = "cam_bg_en") + self.cam_bg_capture = Channel(self.prefix + "bg.capture", alias = "cam_bg_capture") + self.cam_bg_capture_remain = Channel(self.prefix + "bg.capture", alias = "cam_bg_capture_remain") if latch: - start_cam() - else - stop_cam() + self.start_cam() + else: + self.stop_cam() - def start_cam(self) + def start_cam(self): self.cam_run.write(-1) - def stop_cam(self) + def stop_cam(self): self.cam_run.write(0) - def capture(self) + def capture(self): timestamp = self.timestamp.read() - if mode == "latch": + if self.latch: self.cam_latch.write(1) else: self.cam_run.write(1) while(timestamp == self.timestamp.read()): - time.sleep(1) + time.sleep(0.001) camera_tool = CamTool() camera_tool.capture() -print camera_tool.cam_x, camera_tool.cam_x, +print camera_tool.cam_x.read(), camera_tool.cam_y.read()