OSU CSE 5911 Capstone Project: Elephant Vending Machine in coordination with Cincinnati Zoo. Designed to facilitate automated behavioral psychology experiments.
- Navigate to the root directory of this project
- Run
python3 -m venv .venv
to create a virtual environment - Activate your virtual environment
- On Windows run
.venv\Scripts\activate.bat
- On Unix or MacOS run
source .venv/bin/activate
- To deactivate run
deactivate
- NOTE: You will need to activate your virtual environment every time you close and reopen your terminal
- On Windows run
- Use
pip install -r requirements.txt
to install all required dependencies
NOTE: See section "Running in Production" if you intend to make calls from the front-end
- Tell Flask where to find application instance
- On Windows run
set FLASK_APP=elephant_vending_machine
- On Unix or MacOS run
export FLASK_APP=elephant_vending_machine
- If outside the project directory be sure to include the full path to the application directory
- OPTIONAL: To enable development features run
export FLASK_ENV=development
on Unix orset FLASK_ENV=development
on Windows
- On Windows run
pip install -e .
flask run
- Follow this reference: https://tutorials-raspberrypi.com/connect-control-raspberry-pi-ws2812-rgb-led-strips/
- For our purposes, we did not use an external power source and found the power provided by the pi to be sufficient.
- Image display is done by utilizing feh: https://linux.die.net/man/1/feh
- To install feh, run
sudo apt install feh
while connected via SSH to the pi.
- Note, this will need to be done on each of the remote pis only, the web server does not require installion of feh.
- To execute the test suite run
coverage run -m pytest
- To view coverage report after tests have been run use
coverage report
- Navigate to the root directory of this project
- To check your code style, run
pylint elephant_vending_machine
- Navigate to
docs
directory make html
to build API documentation- Open
index.html
underdocs/_build/html/
in a browser to view documentation- The master branch documentation can be viewed on Read the Docs by clicking the "docs" badge at the top of this README
NOTE: This step is necessary to allow the front-end to make API calls. If you don't run the project using Docker it uses a port that the front-end is not expecting and API calls will fail. If running on a device without the sonar sensors connected (such as your dev machine),
you'll have to remove the devices
line from the docker-compose.yml
file. You'll also need to add a file called id_rsa
to the project
folder. If using the image syncing, this must be a passwordless SSH key that has been set up with the remote machines to sync images to. Otherwise, it can be an empty file.
- Connect to your Raspberry Pi
- Clone this repo to the Pi
- Navigate to the cloned directory
- Install docker and docker-compose
- Run
docker-compose up --build
to start the containers- This will ensure the containers automatically restart in case of error or reboots.
- To stop the containers, and avoid auto-restarting, use
docker-compose down
- Container storage is persisted between runs