This repository has been archived by the owner on Dec 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client control flow mostly works, but parts of the main loop are unte…
…sted. Be warned.
- Loading branch information
1 parent
4b3e06a
commit 07b3aca
Showing
15 changed files
with
1,253 additions
and
153 deletions.
There are no files selected for viewing
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
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 |
Oops, something went wrong.