Skip to content

This is Mario Bartolome's Final Year Project for Computer Science BS.

License

Notifications You must be signed in to change notification settings

MarioBartolome/GII_0_17.02_SNSI

Repository files navigation

GII_0_17.02_SNSI

Status maintainability TechDebt Reliability

Coverage Bugs

Lines DuplicatedLines

This project aims to design a semi-autonomous navigation system for indoor use, destined to aid security vigilance using drones.

Given an enclosed space, the drone should be able to make its path through it recording video, which will be streamed to a server, and updating its position inside of it to the security guard in charge.

This project comprises two distributed systems:

  • A backend system. Usually a RaspberryPi-like computer. Small, not so power hungry and most importantly, lightweight.
  • A frontend system. Giving the user a WebUI to access the backend system.

Drone Image

BackEnd

Files under the backend directory are supposed to be deployed on a Raspberry Pi. They contain the main wrapper system to control a drone making use of the implementation made of the MultiWii Serial Protocol. Also they will create a socket server to handle the remote controller connection.

Sending those files to a *nix like system can be done with ease:

scp -r backend USER@raspberry:/home/USER/

Or you can make use of any GUI tool of your choice, like WinSCP.

Obviously you must have access to the Raspberry Pi.

Dependencies

The Raspberry Pi must have installed the following Python >=3.5 packages:

  • Numpy
  • PySerial
  • PyCamera
  • Bluetin_Echo
  • SciPy
  • PyTest

All the dependencies can be installed making use of the installer script. It takes only two arguments:

  • The name of the Virtual Environment to create.
  • The name of the setup script to run.

It can be run as follows:

user@frontend~> chmod +x installer.sh

user@frontend~> ./installer.sh backEndVenv setupBackend.py

The installer will start the installation process, it may take a while as it needs to download, build and install.

The Raspberry Pi is going to act as a WebRTC server to provide a real-time video feed to the client. So you will need to install also UV4L.

sudo apt-get install uv4l uv4l-raspicam uv4l-raspicam-extras uv4l-server uv4l-webrtc

UV4L places its configuration files under /etc/uv4l/uv4l-raspicam.conf

May you edit those as you please. A full reference manual can be found here. But keep on mind to edit the database at frontend/model/database.db according to the changes you made, such as ports or hostnames.

FrontEnd

The FrontEnd is the ugly cute part of this project, it conforms a WebUI that should be deployed on a system ready to become a web server.

Dependencies

The server must have installed the following Python >=3.5 packages:

  • Numpy
  • Flask
  • Flask_login
  • Flask_socketio
  • Flask_sqlalchemy
  • Flask_migrate
  • Flask_wtf
  • wtforms
  • eventlet

All the dependencies can be installed making use of the installer script. It takes only two arguments:

  • The name of the Virtual Environment to create.
  • The name of the setup script to run.

It can be run as follows:

user@frontend~> chmod +x installer.sh

user@frontend~> ./installer.sh frontEndVenv setupWebUI.py

The installer will start the installation process, it may take a while as it needs to download, build and install.

Putting everything together

You will need to connect a flight controller that supports MultiWiiSerialProtocol to the RaspberryPi. Just make use of any of the USB ports on the RaspberryPi.

Once you have everything on its right place is time to run it!

But first, make sure to define PYTHONPATH. Open a terminal and navigate to the root folder of this project, cd command will come in handy here, and then define the var with user@somewhere/GII_0_17.02_SNSI~> export PYTHONPATH=$(pwd)

On the RaspberryPi:

user@raspberry~> sudo service uv4l start Will get us the WebRTC video feed.

user@raspberry~> python3 -m backend.systemControl.ctrlWrapper Will run the remote controller receiver and the comunication services with the drone, making use of backend/comms/MultiWiiProtocol.py

On the web server:

Remember, WebRTC only works through HTTPS so you will need to get those fancy certs and keys to run this. Once you got them place them under root folder of the project, on a folder named private.

Note: You can also play with the frontend/droneControlWebUI.py code to change the folders and names of the key-cert files.

user@webserver~> python3 -m frontend.droneControlWebUI

And now, if everything is working fine, you could point to your host and access the Drone Control System.

To remote-control the drone, you need to connect a joystick or radio with, at least, 5 axis:

  • Channel 1: Throttle
  • Channel 2: Aileron (Roll)
  • Channel 3: Elevation (Pitch)
  • Channel 4: Rudder (Yaw/Heading)
  • Channel 5: Arm/Disarm
- Make sure all your readings are correct prior to enabling manual control

About

This is Mario Bartolome's Final Year Project for Computer Science BS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published