TeCoEd (Teaching Computing Education)
  • Home
    • Freelance
    • Book
    • Downloading
  • Python
    • Learn Python >
      • Python Modules
    • PyGame Zero
    • Python Programs >
      • Higher or Lower
      • Magic Calculator
      • Password Checker
      • Python Pit
    • What's News App
    • Pixels to Cells
    • Python Mosaics
    • Python OCR
    • L-1-AM
    • Web Scraping >
      • Scraping Trains
    • Weather App
    • Snakes and Windows
    • Python Web Server >
      • Flask
    • Python Picks
  • Raspberry Pi
    • All About the Pi
    • Getting Started
    • Remote Desktop and VNC
    • Static IP Address
    • Sonic Pi >
      • 3.14
    • Twitter Feed >
      • Tweepy
    • Android & Pi >
      • Advanced Apps
      • Odds
    • A.I on the the Pi
    • CRON
    • Pick Your Own
  • Pi Hardware
    • Pi HATS >
      • Sense Hat Hacks
      • AstroPi HAT
      • Unicorn-HAT >
        • Unicorn Alphabet Disco
        • Uni Codes / Programs
      • Skywriter
      • Piano HAT
    • STS Pi
    • Pi Camera >
      • Pi-Cam, Python & Email >
        • Time Lapse
      • Pi Noir
    • Pipsta >
      • Flask, Input & Printers
    • Raspberry Pi Power >
      • Energenie IR power
    • Pibrella
    • Distance Sensor
    • LCD Screen
    • Pi-Tooth
    • Robot Arm
    • PiGlow
    • PiFM
    • Accelerometer
    • PiFace >
      • Installing PiFace >
        • Python Commands
  • Pi-Hacks
    • Drone Hacks
    • Pi Glue Gun Hack
    • Blinkt!
    • Sonic Pixels
    • R2D2
    • Get to the chopper
    • Astro Bird
    • Twitter Translator
    • Hacking a Robot
    • Nature_Box >
      • Best Nature Photos
    • Wearable Tech >
      • Project New York
      • P.N.Y Part 2 Health
      • P.N.Y Part 3 Games
      • P.N.Y Part 4 Translation
    • Dino-Tweet
    • Other Links
  • Pi-Hacks 2
    • The Joker
    • Hologram Machine
    • Google Vision: Camera Tell
    • Yoda Tweets
    • Pi Phone
    • Darth Beats
    • Twitter Keyword Finder
    • Crimbo Lights Hack
    • Xmas Elf
    • Halloween 2016
    • Halloween Hack 2015
    • Socrative Zombie
    • Voice Translation
    • The Blue-Who Finder
    • GPIO, Twitter
    • Pi Chat Bot >
      • Dictionary Definitions
    • PiGlow & Email
    • Pibrella Alarm System
    • SMS with Python >
      • Spooking a Mobile
  • Pi-Hacks 3
    • David Bowie
    • Lamp Prank >
      • TEST
    • Yoda FM
    • Retro Player
    • LED Pixel Art
    • TARDIS
    • Battleships
    • LED Board
    • Night Vision
    • Enviro+ Weather
  • Minecraft
    • Minecraft API
    • Minecraft Sweeper
    • PiGlove: Minecraft Power Up
    • Minecraft Photo-booth
    • Rendering Pixels
    • Speed Cube
    • Lucky Dip
  • Computing
    • Why Computing?
    • Can You Compute
    • micro:bit
    • Coding Resources
    • Learn to Code >
      • Coding with iPads
      • Apps Creation Tools
      • sKratchInn
      • Sound Editing
    • Cheat Sheets
    • Theory
    • HOUR OF CODING
    • BEBRAS Computing Challange
    • Computer Facts
    • Free Software and Links
  • Contact Me

1. Getting Set Up

Using the Raspi. to Fly the Drone


As a teacher I am always looking for new ways to engage students in learning and make it exciting and different.  I remember LOGO from my school days and it was fairly dull.  We then discovered you could upload a bitmap image so we created race courses and coded the turtle to drive round in the quickest time.  Now in 2016 why not take the same activity and learning concepts and apply them to a Drone?  The Parrot Drones use a Python API which means you can access and control the Drone directly with Python Code.  This excites students and opens up a load of learning possibilities.  
  1. To get started, you need a Parrot AR.Drone 2.0, Download the software library from here 
  2. Or open the LX Terminal and type:  sudo clone git https://github.com/venthur/python-ardrone.git
  1. ​You may need to update the Drone's firmware    

2. ​Basic Flight Controls


One of the great features of using Python to interact with the Drone is that you can pre-program a flight path.  The commands are very simple and pretty self explanatory.  To get started try:

​import libardrone
from time import sleep
drone = libardrone.ARDrone()
drone.takeoff()
sleep(3)
drone.move_forward()
sleep(2)
drone.land()
sleep(3)
drone.halt()

A full list of controls is avaiable in the demo.py library

3b. Getting the Camera feed


If you have installed openCV and still have the patience to carry on then the next step is to install a different Drone API.  This one ' PS-Drone' offers a more extensive selection of code to control every element of your Drone from the sensors to the Navigation.  The PS-Drone-API is a full featured SDK, written in and for Python, for Parrot's AR.Drone 2.0.  It was designed to be easy to learn, but it offers the full set of the possibilities of the AR.Drone 2.0, including Sensor-Data (aka NavData), Configuration and full Video-support.

Download the API from here: 

3. Using the Camera


To access the Drone's camera you will require openVC which is an advanced image processing library.  This enables you to stream the video and also manipulate the images.  The install process is fairly lengthy and requires a good few hours of your time. Luckily there is an excellent step by step guide available from pyimagesearch  which breaks down the whole process into simple stages and provides a detailed commentary on what each stage is doing and how to check you have completed it correctly.  

Head over to pyimagesearch  and follow the guide

3a. Install openCV



LANDING THE DRONE WITH THE RASPBERRY PI

Drone Glove Test One


Copyright 2020 TeCoEd @dan_aldred