Skip to content

Instantly share code, notes, and snippets.

@jeffbass
Last active August 24, 2018 00:22
Show Gist options
  • Save jeffbass/0e0a05040ef79f3587f673f964177e0a to your computer and use it in GitHub Desktop.
Save jeffbass/0e0a05040ef79f3587f673f964177e0a to your computer and use it in GitHub Desktop.
A snipped of imagenode.py
#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