Book Image

Python Robotics Projects

By : Prof. Diwakar Vaish
Book Image

Python Robotics Projects

By: Prof. Diwakar Vaish

Overview of this book

Robotics is a fast-growing industry. Multiple surveys state that investment in the field has increased tenfold in the last 6 years, and is set to become a $100-billion sector by 2020. Robots are prevalent throughout all industries, and they are all set to be a part of our domestic lives. This book starts with the installation and basic steps in configuring a robotic controller. You'll then move on to setting up your environment to use Python with the robotic controller. You'll dive deep into building simple robotic projects, such as a pet-feeding robot, and more complicated projects, such as machine learning enabled home automation system (Jarvis), vision processing based robots and a self-driven robotic vehicle using Python. By the end of this book, you'll know how to build smart robots using Python.
Table of Contents (24 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Making the guard robot


Now that we have understood how the learning works and how the learned data can be used to identify people, it's time to put it to use. As the name of the chapter suggests, we will be making a guard robot using this technology. Now, let's have a look at the following program. Before you start programming, take out the robotic vehicle you had and make the connection like we did before in Chapter 6Bluetooth-Controlled Robotic Car. Attach the motor, motor driver, and Raspberry Pi. Once you have done that, then write the following code. This code is utilizing all the learning of the previous programs in the chapter and we would be able to distinguish between an intruder and a resident of the house based on vision processing. So let's get going:

import numpy as np
import cv2
Import RPi.GPIO as GPIO

Motor1F = 20
Motor1R = 21
Motor2F = 2
Motor2R = 3
Buzzer = 24

GPIO.setmode(GPIO.BCM)  
GPIO.setwarnings(False)
GPIO.setup(Motor1a,GPIO.OUT)
GPIO.setup(Motor1b,GPIO.OUT)
GPIO...