Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
client control flow mostly works, but parts of the main loop are unte…
Browse files Browse the repository at this point in the history
…sted. Be warned.
  • Loading branch information
avg-lebesgue-enjoyer committed Sep 5, 2024
1 parent 4b3e06a commit 07b3aca
Show file tree
Hide file tree
Showing 15 changed files with 1,253 additions and 153 deletions.
70 changes: 70 additions & 0 deletions client/drivers/ai_bros.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
## SECTION: Imports

from typing import Tuple
from PiicoDev_Switch import PiicoDev_Switch
from PiicoDev_SSD1306 import *
import threading
from datetime import datetime

#from PiicoDev_Unified import sleep_ms

from data_structures import ControlledData, HardwareComponents, Picture, Face


def ai_bros_face_recogniser(underlying_picture : "UNDERLYING_PICTURE") -> Face: # TODO: Refine type signature
"""
Recognise a face, powered by AI.
Args:
underlying_picture : UNDERLYING_PICTURE
The picture to pass to the face recogniser. This data passing may be handled differently
in the final version.
Returns:
(Face): Failed, matched or unmatched Face
TODO: Convert this into an external API call. Currently returns debug data.
"""
# DEBUG:
print("<!> ai_bros_face_recogniser()")
DEBUG_failed = False
DEBUG_matched = True
DEBUG_user_id = -42
# :DEBUG
if DEBUG_failed:
return Face.make_failed()
if not DEBUG_matched:
return Face.make_unmatched()
return Face.make_matched(DEBUG_user_id)

def ai_bros_posture_score(underlying_picture : "UNDERLYING_PICTURE") -> int: # TODO: Refine type signature
"""
Args:
underlying_picture : UNDERLYING_PICTURE
The picture of the person's posture
Returns:
int: score represtning how good the posture currently is???
TODO: Convert this into an external API call. Currently returns debug data.
NOTE: This will eventually be a database lookup. We're running the AI posture peeker
asynchronously to the controller code.
FIXME: This documentation is terrible
"""
return 1

def ai_bros_get_posture_data(last_snapshot_time : datetime) -> "POSTURE_DATA": # TODO: Refine type signature
"""
API call to get posture data from the SQLite database.
Gets all data from after last_snapshot_time until the current time.
Args:
last_snapshot_time : datetime
The last time we read the posture data.
Returns:
(POSTURE_DATA): Posture data returned from the API call.
TODO: Actually implement this method. Currently prints a debug method and returns an empty list.
"""
# DEBUG:
print("<!> ai_bros_get_posture_data()")
DEBUG_return_value = []
# :DEBUG
return DEBUG_return_value
Loading

0 comments on commit 07b3aca

Please sign in to comment.