Script execution

This commit is contained in:
sfop
2016-07-05 15:59:57 +02:00
parent 08931d5531
commit ef43580bdc

View File

@@ -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()