The purpose of this project is to create a cheap autonomous turret, capable of detecting motion and targetting objects.
These instructions were written for constructing the robot with RPi2+RaspiCam+servos, but you may try it out on a desktop with a webcam (after installing required python packages).
The basic structure of the program follows:
See CONFIG.INI for settings
python-dev
libopencv-dev
python-opencv
open-cv
dlib (see note below)
configobj
python-smbus
webcolors
bluez python-bluetooth python-gobject (for bluetooth)
pyttsx (for speech)
Installing dlib While "sudo apt-get install" works for opencv, dlib (used for object tracking) requires compilation. Here are basic steps to do that:
sudo apt-get install cmake
Install boost from: http://sourceforge.net/projects/boost
sudo apt-get install libboost-python-dev
wget http://dlib.net/files/dlib-18.18.tar.bz2
tar jxf dlib-18.18.tar.bz2
cd dlib*
sudo python setup.py install
pip install dlib
$ python main.py
See HELP.TXT for commands
Camera:
For using raspicam with opencv, add bcm2835-v4l2 with sudo modprobe bcm2835-v4l2
(read here and here).
Turret/Servos: Here is a good tutorial on connecting servos with your RPi. (Also read about setting I2C permissions).
Speech: (Optional)
If you connect a speaker, robot will speak modes and actions. Make sure volume is up the first time: $ amixer sset PCM,0 100%
.
Controller : Send commands by either: keyboard (direct USB) or bluetooth (USB dongle + android app, such as BlueMCU). Read about bluetooth setup and helpful commands.
E.g. To enable serial port, and connect bluetooth to your phone
$ sdptool add SP
$ sudo rfcomm bind rfcomm0 XX:XX:XX:XX:XX:XX 1 (<-your address here)
You see a lot of output on start which may be ignored.
Bluetooth may need reset before restarting bot.
$ sudo hciconfig hci0 reset
Stdin may stop showing what you type after running. Reset with:
$ stty sane
Contributions are welcome to improve accuracy and movement of the robot!
This project licensed under GNU GENERAL PUBLIC LICENSE https://www.gnu.org/licenses/gpl.txt