This is the Python code for a Halloween dispensing robot head, optionally covered by a scary mask.
When someone at a distance is detected, the head will whisper a phrase like one of the following:
- “Come closer”
- “Hey you. Yeah. Over here”
- “I have something for you”
When someone gets very close the head will make a regurgitating sound + dispense a candy pack for each person detected at this range, once the candy is dispensed it will say something like one of the following:
- “Those are fresh, I ate them with the last trick-or-treater”
- “You should dry that off before you eat”
- “Hope you enjoy those more than I did”
Valid alwaysAI credentials to use the alwaysAI computer vision platform. This allows for rapid development and deployment of the app onto an edge device (like a raspberry pi) without requiring it to have internet access.
To sign up, goto this page
amixer scontrols
amixer sset 'Master' 100%
alwaysAI
npm install -g alwaysai
Simple Audio
pip3 install simpleaudio
sudo apt-get install libasound2-dev
To get a list of available packages by name
apt-cache search something
When adding dependencies, additional info most be provided for the resultant docker image to build correctly. See this page for more info. Note that you'll need valid beta credentials to log into the alwaysai docs.
To get versions of the pip dependencies to add the requirements.txt
file
pip3 list --format columns
ERROR:
WARNING: The directory '/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
SOLUTION:
Make sure you're using the ==
symbol in your requirements.txt
file. ie simpleaudio==1.0.2
and not simpleaudio=1.0.2
ERROR:
✖ Install python dependencies
Error: Process exited with non-zero status code 1
$ ssh -i /Users/jason.koo/.ssh/alwaysai.id_rsa [email protected] docker run --rm --privileged --interactive --network=host --volume /dev:/dev --volume ~/alwaysai/halloween-candy-dispenser:/app --user $(id -u ${USER}):$(id -g ${USER}) --workdir /app sha256:add648aafec43e7ee457cfd6e3306bacb662b19647b2a54a5c5befb687533ecb venv/bin/pip install --requirement requirements.txt
Traceback (most recent call last):
File "/app/venv/bin/pip", line 6, in <module>
from pip._internal.cli.main import main
ImportError: No module named 'pip._internal.cli.main'
SOLUTION: