Skip to content

Creating a Raspberry Pi controlled two wheeled robot to patrol the house.

License

Notifications You must be signed in to change notification settings

bradleynull/patrolbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PatrolBot

Creating a Raspberry Pi controlled two wheeled robot to patrol the house.

Patrolbot breadboard setup

The current setup consists of:

Currently, to drive the PiTFT display the software needs to be run as root in order to write directly to the frame buffer at /dev/fb1:

$ sudo su
# . ./venv/bin/activate
(venv) # python ./main.py

Prerequisites

This project requires OpenCV 3.4 and the contribution libraries or higher compiled for Python3. The scripts/build_opencv.sh is provided to help build OpenCV specifically for this project.

To install the pip requirements:

$ virtualenv ./venv -p python3
...
$ . ./venv/bin/activate
(venv) $ pip install -r ./requirements.txt

Now you'll need to copy the cv2.so from OpenCV's library to the virtualenv

$ cp /path/to/opencv/lib/cv2.cpython-35m-arm-linux-gnueabihf.so \
./venv/lib/python3.4/site-packages/cv2.so

Unit Tests

This project uses the Python unittest library. To run a single test:

(venv) $ python -m unittest tests.name_of_unit_tests.TestFixture.test_name

where name_of_unit_tests matches a file in the tests/ directory, TestFixture matches the class name in that file, and test_name matches the member function of TestFixture to run.

To run the entire suite of unit tests:

(venv) $ python -m unittest discover -s tests -p "*_unit_tests.py"

Project Organization

The patrolbot library consists of:

  • flask_app/ - Contains an implementation of web UI using Flask
  • gui/ - Contains the onboard GUI implementation using PyGame
  • sensors/camera - Interface to the Raspberry Pi camera using OpenCV