Book Image

Raspberry Pi Robotic Projects - Third Edition

By : Richard Grimmett, Jon Witts
Book Image

Raspberry Pi Robotic Projects - Third Edition

By: Richard Grimmett, Jon Witts

Overview of this book

This book will allow you to take full advantage of Raspberry Pi Zero and Raspberry Pi 3 by building both simple and complex robotic projects. The book takes a mission-critical approach to show you how to build amazing robots and helps you decide which board to use for which type of robot. The book puts a special emphasis on designing mobile (or movable) robots using the Raspberry Pi Zero. The projects will show inexpensive, yet powerful, ways to take full advantage. It will teach you how to program Raspberry Pi, control the movement of your robot, and add features to your robots.
Table of Contents (13 chapters)
Raspberry Pi Robotic Projects - Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Connecting to the hardware


Connecting to Parrot 2.0 is also quite easy; you'll just need to connect to its WLAN access point. However, to add control via a programming language, such as Python, you'll need to install some libraries for the Raspberry Pi. First, let's download the libraries. You'll get these from https://github.com/venthur/python-ardrone. Download the files to your Raspberry Pi by typing wget https://github.com/venthur/python-ardrone. Now create a simple program to demonstrate that the system works. Here is the code:

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

This program is quite simple. You import the library and create an instance of your quadcopter as a drone. Then you issue a command to have your quadcopter take off and hover for three seconds, after which you move forward for two seconds, then...