controlling parrot ar drone 2.0 using docker containerhuilu/slides580ksp20/demo3.pdf · parrot...

16
Controlling Parrot AR.Drone 2.0 using Raspberry PI 3 & Docker By Ihab AbuHilal [email protected] B00624202

Upload: others

Post on 07-Jul-2020

26 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Controlling Parrot AR.Drone 2.0

using Raspberry PI 3 & Docker

By Ihab AbuHilal

[email protected]

B00624202

Page 2: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Agenda

Overview

Raspberry Pi 3 Model B+

Parrot AR.Drone 2.0

PYARDRONE Library

Python Code

Create the Docker Container for Raspberry Pi

Demo

Conclusion

Future Work

Notes

Questions

Page 3: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Overview

In this project we will develop docker container that runs on Raspberry PI 3

and remote-control Parrot AR.Drone 2.0 using keyboard

Using

Raspberry Pi 3 Model B+

Parrot AR.Drone 2.0

Docker

Python 3

Page 4: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Raspberry Pi 3 Model B+

Tiny credit card size computer, single board computer

quad core 64 bit ARMv8 CPU operating at 1.4GHz

1GB LPDDR2 SDRAM

Wireless LAN, Bluetooth, Ethernet, USB, HDMI

SD card support microSD format for OS and data storage

40 GPIO (general-purpose input/output) pins

Raspbian Stretch OS

Price $35

Page 5: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Parrot AR.Drone 2.0

AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

hotspot

high-definition Camera

Can be controlled using an iOS or Android smartphone or tablet

Processor: ARM 1GHz 32 bit, RAM: 1GB, OS: Linux 2.6.32

USB 2.0, WIFI

UDP is using to communicate with the drone

AT Commands are sent to specific ports

Price $90

Page 6: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Communication With the Drone

the AR.Drone creates a WIFI network called adrone2_xxx 192.168.1.1

the client device connects to the network & requests an IP address from the

drone DHCP server.

the AR.Drone DHCP server grants the client with an IP address which is

192.168.1.2

the client device can start sending requests the AR.Drone IP address and its

services ports

Page 7: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Main Communication AR.Drone Ports

Controlling and configuring the drone is done by sending AT commands on

UDP port 5556.

navdata - Information about the drone (like its status, its position, speed

etc.), sent by the drone to its client on UDP port 5554

A video stream is sent by the AR.Drone to the client device on port 5555 TCP.

Page 8: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

PYARDRONE Library

library written in Python3 and it provides a high-level API to communicate

with the AR.Drone

requires Python 3.4 or later and OpenCV 3.0 or later (for video support).

to install the library run:

pip install pyardrone

class pyardrone.ARDrone(*, host='192.168.1.1', at_port=5556, navdata_port=5554,

video_port=5555, watchdog_interval=0.5, timeout=0.01, bind=True, connect=True)

import time

from pyardrone import ARDrone

drone = ARDrone()

drone.navdata_ready.wait() # wait until NavData is ready

while not drone.state.fly_mask:

drone.takeoff()

time.sleep(20) # hover for a while

while drone.state.fly_mask:

drone.land()

Page 9: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi
Page 10: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Create the Docker Container for

Raspberry Pi

Installing Raspbian Stretch

Install python3 and OpenCV4

Install Docker

Create folder and add all the needed files

Create Dockerfile “Dockerfile”

FROM python:3

ADD control_ardrone.py /

ADD start.sh / -- > Shell script file to run the python file

RUN chmod +x start.sh

RUN pip install pyardrone

Page 11: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Create Docker Image from Dockerfile

docker build --tag "ardrone_remotecontrol:v1" .

Running the docker container

$docker run --privileged -it ardrone_remotecontrol:v1 /bin/bash

$./start.sh

Page 12: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Demo

https://youtu.be/ck2lkFNhaaE

Key Action

Enter Takeoff

Space Land

CTRL+z Exit

Up Arrow Move up

Down Arrow Move Down

Right Arrow Rotate Right

Left Arrow Rotate Left

h Hover

w Move forward

s Move backward

a Move left

d Move right

Page 13: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Conclusion

using docker container will save time and effort by using base images withneeded libraries and frameworks

Docker provide standardization and improve productivity, so for any futurework this new image can be built on top of this one and used for newapplications

Compatibility and maintainability this docker container will work on any Linuxmachine that support such base images and libraries

Docker is easy to create

Connecting to a drone with an API will make hacking on drone becomes easy,and with ability to capture images , videos , using docker containers andconnecting to cloud services will open the space for more Internet of Thingsapplications

Page 14: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Future work

Adding more keys such as changing speed, perform automatic flying such as fly in a polygonshape or a triangle etc.

Running face recognition on the drone images

Running speech recognition to drive the drone

Objects recognition to perform certain tasks

Perform computation and processing on the cloud such as Microsoft Azure Face API

Use more than one docker container to perform microservices on images and info captured bythe drone

Using ardrone-wpa2 (wpa2 support for AR.Drone 2.0) project , to secure the WiFi connectionand let the drone join an existing WiFi connection , that will make connecting to internet andhave more than one device in the network more easy.

The parrot AR.Drone 2.0 doesn’t fly quite as stably as the much more expensive new parrotbebop 2 drone, it is better to use the new drone which also provide better images and videoquality.

Page 15: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Notes

Parrot AR actually flies a lot better without the safety hull

The batterie take hours to charge and then last for about 10-15 minutes of

flying. I recommend buying two additional batteries.

By default, the Parrot AR.Drone 2.0 serves a wireless network that clients

connect to. Every time you want to try something, you need to disconnect

from your network and get on the drone’s network it was annoying.

A major security issue of the Parrot AR.Drone is it can be easily hacked since

they are using an open network infrastructure.

It is better to work wide and safe space

Page 16: Controlling Parrot AR Drone 2.0 using Docker containerhuilu/slides580ksp20/demo3.pdf · Parrot AR.Drone 2.0 AR.Drone 2.0 is a small quadcopter with a WiFi interface acts as a WiFi

Thank You

Questions?