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 AI-enabled autonomous robots using the Raspberry Pi and Python

Arrow left icon
Product type Paperback
Published in Feb 2021
Publisher Packt
ISBN-13 9781839218804
Length 602 pages
Edition 2nd 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 (25) Chapters Close

Preface 1. Section 1: The Basics – Preparing for Robotics
2. Chapter 1: Introduction to Robotics FREE CHAPTER 3. Chapter 2: Exploring Robot Building Blocks – Code and Electronics 4. Chapter 3: Exploring the Raspberry Pi 5. Chapter 4: Preparing a Headless Raspberry Pi for a Robot 6. Chapter 5: Backing Up the Code with Git and SD Card Copies 7. Section 2: Building an Autonomous Robot – Connecting Sensors and Motors to a Raspberry Pi
8. Chapter 6: Building Robot Basics – Wheels, Power, and Wiring 9. Chapter 7: Drive and Turn – Moving Motors with Python 10. Chapter 8: Programming Distance Sensors with Python 11. Chapter 9: Programming RGB Strips in Python 12. Chapter 10: Using Python to Control Servo Motors 13. Chapter 11: Programming Encoders with Python 14. Chapter 12: IMU Programming with Python 15. Section 3: Hearing and Seeing – Giving a Robot Intelligent Sensors
16. Chapter 13: Robot Vision – Using a Pi Camera and OpenCV 17. Chapter 14: Line-Following with a Camera in Python 18. Chapter 15: Voice Communication with a Robot Using Mycroft 19. Chapter 16: Diving Deeper with the IMU 20. Chapter 17: Controlling the Robot with a Phone and Python 21. Section 4: Taking Robotics Further
22. Chapter 18: Taking Your Robot Programming Skills Further 23. Chapter 19: Planning Your Next Robot Project – Putting It All Together 24. Other Books You May Enjoy

Discovering robots in the home

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

The washing machine

Let's start with the washing machine. It is used every day in some homes, with a constant stream of clothes to wash, spin, and dry. But how is this a robot?

Figure 1.5 – Components of a washing machine

Figure 1.5 shows a washing machine as a block diagram. There's a central controller connected to the display with controls to select a program. The lines going out of the controller are outputs. The connections coming into the controller are data 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 controller checks the door sensor and will 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 the water heater
while water is not filled and water is not hot enough:
  if water filled then
    stop water pump
  if the water is hot enough then
    turn off heater
  else
    turn on the water heater

Note the else there, which is in case the water temperature drops below the correct temperature slightly. 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. The boiler uses feedback mechanisms to maintain the temperature of the house, water flow through heating, gas flow, and ensuring that the pilot light stays lit. The boiler is automatic and has many robot-like features, but it is stationary and could not readily be adapted to other purposes. The same could be said for other home appliances such as smart fans and printers.

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

Other machines in the home, like a microwave, for example, have only timer-based operation, they do not make decisions, and are too simple to be regarded as robots.

Perhaps the most obvious home robot is a robot vacuum cleaner, as shown in Figure 1.6:

Figure 1.6 – A robotic vacuum cleaner – PicaBot (Image credit: Handitec [Public Domain - https://commons.wikimedia.org/wiki/File:PicaBot.jpg])

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. This robot is autonomous, mobile, and could be reprogrammed to different behaviors.

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.

You have been reading a chapter from
Learn Robotics Programming - Second Edition
Published in: Feb 2021
Publisher: Packt
ISBN-13: 9781839218804
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 €18.99/month. Cancel anytime