Last active
August 24, 2018 00:22
-
-
Save jeffbass/0e0a05040ef79f3587f673f964177e0a to your computer and use it in GitHub Desktop.
A snipped of imagenode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#imagenode.py snippet | |
# (all the imports, logging setup hidden for now) | |
settings = Settings() # get settings for node cameras, ROIs, GPIO | |
node = ImageNode(settings) # start ZMQ, cameras and other sensors | |
# forever event loop | |
while True: | |
node.get_sensor_data() # grab camera images and other sensor data | |
node.process_sensor_data() # detect motion, etc. | |
while len(node.msg_q) > 0: | |
try: | |
with Patience(settings.patience): # wait for hub response | |
text, image = node.msg_q.popleft() | |
hub_reply = node.send_frame(text, image) | |
except Patience.Timeout: # except no timely response from hub | |
hub_reply = node.fix_comm_link() | |
node.process_hub_reply(hub_reply) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment