Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Robotics Programming

You're reading from   Learn Robotics Programming Build and control autonomous robots using Raspberry Pi 3 and Python

Arrow left icon
Product type Paperback
Published in Nov 2018
Publisher Packt
ISBN-13 9781789340747
Length 472 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Danny Staple Danny Staple
Author Profile Icon Danny Staple
Danny Staple
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Introduction to Robotics 2. Exploring Robot Building Blocks - Code and Electronics FREE CHAPTER 3. Introducing the Raspberry Pi - Starting with Raspbian 4. Preparing a Raspberry Pi for a Robot - Headless by Default 5. Backing Up the Code with Git and SD Card Copies 6. Building Robot Basics - Wheels, Power, and Wiring 7. Drive and Turn - Moving Motors with Python 8. Programming Line-Following Sensors Using Python 9. Programming RGB Strips in Python 10. Using Python to Control Servo Motors 11. Programming Distance Sensors with Python 12. Programming Encoders with Python 13. Robot Vision - Using a Pi Camera and OpenCV 14. Voice Communication with a Robot Using Mycroft 15. Programming a Gamepad on Raspberry Pi with Python 16. Taking Your Robot Programming Skills Further 17. Planning Your Next Robot Project - Putting It All Together 18. Assessments 19. Other Books You May Enjoy Appendix

Robots in the home

Many robots have already infiltrated our homes. They are overlooked as robots because on first glance they appear commonplace and mundane. However, they are more sophisticated than they seem.

The washing machine

Let's start with the washing machine. This is used every day in some homes, with a constant stream of clothes to wash, spin, and dry. But how is this a robot? Let us understand this by referring to the following diagram:

The humble washing machine as a robot

The preceding diagram represents a washing machine as a block diagram. There is a central controller connected to the display, and with controls to select a program. The lines going out of the controller are outputs, and the lines going into the controller are data coming in from sensors. The dashed lines from outputs to the sensors show a closed loop of output actions in the real world causing sensor changes; this is feedback, an essential concept in robotics.

The washing machine uses the display and buttons to let the user choose the settings and see the status. After the start button is pressed, the machine will check the door sensor and sensibly refuse to start if the door is open. Once the door is closed and the start button is pressed, it will output to lock the door. After this, it uses heaters, valves, and pumps to fill the drum with heated water, using sensor feedback to regulate the water level and temperature.

Each process could be represented by a set of statements like these, which simultaneously fill the drum and keep it heated:

start water pump
turn on water heater
while water is not filled and water is not at the right temperature:
if water filled then
stop water pump
if water is at the right temperature then
turn off heater
else
turn on water heater

Note the else there, which is in case the water temperature drops below the right temperature a bit. The washing machine then starts the drum spinning sequence: slow turns, fast spins, sensing the speed to meet the criteria. It will drain the drum, spin the clothes dry, release the door lock, and stop.

This washing machine is in every respect a robot. A washing machine has sensors and outputs to affect its environment. Processing allows it to follow a program and use sensors with feedback to reach and maintain conditions. A washing machine repair person may be more of a roboticist than I.

Other household robots

A gas central heating boiler has sensors, pumps, and valves and uses feedback mechanisms to maintain the temperature of the house, water flow through heating, gas flow, and ensure that the pilot light stays lit.

Smart fans use sensors to detect room temperature, humidity, and air quality, then output through the fan speed and heating elements.

A computer printer is also a robot, with moving part outputs and sensors to detect all those pesky paper jams.

Perhaps the most obvious home robot is the robot vacuum cleaner. Refer to the following diagram:

A robotic vacuum cleaner (PicaBot By Handitec)

This wheeled mobile robot is like the one we will build here, but prettier. They are packed with sensors to detect walls, bag levels, and barrier zones, and avoid collisions. They most represent the type of robot we are looking at.

As we build our robot, we will explore how to use its sensors to detect things and react to them, forming the same feedback loops we saw in the washing machine.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime