Skip to content

This is the official repository for the Monash Human Powered team. We are a team of students attempting to break the land speed record for human powered propulsion.

Notifications You must be signed in to change notification settings

monash-human-power/raspicam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MHP Raspicam

All Contributors

This repo contains code used to run the Monash Human Power camera system. The master branch is write protected to ensure it is always left in a working state.

Installation

  1. Setup .env file

    Duplicate .env.example into .env and alter the environment variables accordingly. This file is how the overlay knows whether it is primary or secondary, the bike it is on, the broker IP and the screen resolution.

  2. Configure config.json

    Optionally, you may set the overlay to run when the physical switch on the display is toggled by modifying config.json. An example of this file's contents could be { "activeOverlay": "overlay_all_stats.py" }.

  3. Install Python 3.7 with pyenv

    At this point in time, you'll also need Python 3.7 installed, as currently, the OpenCV version we are using does not have a build available for Python 3.8. pyenv may be used to quickly switch between python versions. To do this,

    • Install pyenv.
      • Linux installation (including Pi) here. You may need to install these dependencies from here (use Debian dependencies fo the Raspbery Pi)
      • macOS installation: See pyenv's github
      • Windows installation: See pyenv-win
    • Install Python 3.7 with pyenv install 3.7.7,
    • and finally, set it as your current python version with pyenv local 3.7.7.
  4. Install OpenCV dependencies

    You will likely need to install some dependencies for OpenCV to run, especially if you are on a Raspberry Pi. To do this, run

    sudo apt install libgtk-3-0 libavformat58 libtiff5 libcairo2 libqt4-test libpango-1.0-0 libopenexr23 libavcodec58 libilmbase23 libatk1.0-0 libpangocairo-1.0-0 libwebp6 libqtgui4 libavutil56 libjasper1 libqtcore4 libcairo-gobject2 libswscale5 libgdk-pixbuf2.0-0
  5. Install poetry and python dependencies

    To install dependencies, you will need poetry installed on your computer.

    With that done, raspicam dependencies may be installed using poetry install --dev.

  6. Install and enable systemd services (optional)

    If you are setting up raspicam on the actual display Pis, enable and start the raspicam services so that raspicam begins on startup.

    # Install the raspicam services
    ./service/install.sh
    # Enable running on boot, and start running now
    systemctl --user enable --now raspicam-orchestrator
    systemctl --user enable --now raspicam-switch

Usage

Important: You must be in a poetry shell to run any scripts/tests. To start a poetry shell, run poetry shell. You may exit the shell at any time with exit.

Overlay development

Any overlay (e.g. overlay_top_strip.py) may be run from the terminal with Python. If your computer does not have a webcam, you may replace the video feed with a static background specified with the --bg option. The --host argument can be used to specify an MQTT broker.

Running on Raspberry Pi displays

If you are trying run an overlay over VNC, you will need to enable direct capture mode on the Pi's VNC server. Right click on the VNC logo in the Pi's system tray, click Options -> Troubleshooting -> Enable direct capture mode -> OK.

Overlays may be run from the terminal, as before. However, for use on the bike, you should have switch.py and orchestrator.py running on startup using systemd services as described in Installation. Once this is setup, you can view the output of the two scripts with

systemctl --user status raspicam-orchestrator

You may also find systemctl's start, stop, restart and disable commands useful.

Tests

Located under tests. Enter pytest in the terminal to run all tests.

Utilities

mqtt_message_test.py: Script that sends messages to the camera overlay. First, run mqtt_message_test.py along with mqtt_test.py from the DAS repo, Finally run overlay_all_stats.py.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

pdgra1
pdgra1

💻
Angus Lee
Angus Lee

💻
Harsil Patel
Harsil Patel

💻
Laksh Jaisinghani
Laksh Jaisinghani

💻
Christopher Hall
Christopher Hall

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

About

This is the official repository for the Monash Human Powered team. We are a team of students attempting to break the land speed record for human powered propulsion.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published