A self-driving car built with raspberry pi and C++ 17.
Below are some other videos of the Robocar in action
The following table contains the basic components necessary for the car.
Item | Approx. Price | Link |
---|---|---|
Raspberry Pi | $100 | amazon |
Car chassi | $25 | amazon |
Actuator | $7 | amazon |
Wires | $5 | amazon |
Camera | $8 | amazon |
USB Power Supply | $12 | amazon |
Power bank | $35 | amazon |
Item | Approx. Price | Link |
---|---|---|
Additional wires | $10 | amazon |
Soldering Iron | $15 | amazon |
Traffic Signs | $12 | amazon |
Tape (for making lanes) | $10 | amazon |
sudo apt install gcc g++
sudo apt install gcc
$ wget https://github.com/google/googletest/archive/release-1.10.0.tar.gz && \
tar zxf release-1.10.0.tar.gz && \
rm -f release-1.10.0.tar.gz && \
cd googletest-release-1.10.0 && \
cmake . && \
make -j && \
sudo make install
# First install dependencies
$ sudo apt-get -y install build-essential cmake pkg-config \
libjpeg-dev libtiff-dev libjasper-dev libpng12-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev \
libatlas-base-dev gfortran
# Build opencv from source
$ wget -O opencv.tar.gz https://github.com/opencv/opencv/archive/4.1.2.tar.gz && \
wget -O opencv_contrib.tar.gz https://github.com/opencv/opencv_contrib/archive/4.1.2.tar.gz && \
tar zxf opencv.tar.gz && \
tar zxf opencv_contrib.tar.gz && \
mv opencv-4.1.2/ opencv && \
mv opencv_contrib-4.1.2/ opencv_contrib && \
cd opencv && \
mkdir build && \
cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D BUILD_TESTS=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D BUILD_EXAMPLES=OFF .. && \
make -j4 && \
sudo make install && \
sudo ldconfig && \
sudo apt-get update
# Clean up downloads
$ cd ~/
$ rm opencv.tar.gz && rm opencv_contrib.tar.gz
$ rm -r opencv && rm -r opencv_contrib
# Reboot
$ sudo reboot
Before running the following, make sure you are at the root of this project.
# Make sure you are at robocar root before running this.
$ sudo apt-get -y install build-essential && \
cd third_party && \
git clone https://github.com/tensorflow/tensorflow && \
cd tensorflow && \
./tensorflow/lite/tools/make/download_dependencies.sh && \
./tensorflow/lite/tools/make/build_rpi_lib.sh
Note: Tensorflow folder is in .gitignore to avoid having it checked-in nto this repo. In the future we might consider having it as submodule.
$ cmake .
$ make
$ cmake . -DBUILD_TESTS=ON
$ make
$ make test
The binary will be in the bin/
directory:
$ sudo bin/robocar