Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learn Robotics Programming

You're reading from   Learn Robotics Programming Build and control cutting-edge AI robots with Raspberry Pi and Python

Arrow left icon
Product type Paperback
Published in Dec 2025
Last Updated in Sep 2025
Publisher Packt
ISBN-13 9781803246987
Length 566 pages
Edition 3rd 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 (9) Chapters Close

Learn Robotics Programming, Third Edition: Build and control cutting-edge AI robots with Raspberry Pi and Python
1 Introduction to Robotics FREE CHAPTER 2 Exploring Robot Building Blocks – Code and Electronics 3 Preparing a Headless Raspberry Pi for a Robot 4 Protecting Robot Code with Git 5 Building Robot Basics – Wheels, Power, and Wiring 6 Drive and Turn – Moving Motors with MQTT and Python 7 Driving the Robot with a Phone and Python 8 Programming Distance Sensors with Python

Exploring real world robots

Now that you have an overview of robots in general, let’s see example robots from different fields, how they are remarkable, and what they are capable of.The following figure shows amazing robots favoring human and animal forms:

Figure 1.3 – Human and animal form robots

These robots shown in figure 1.3 use sensors and outputs to try to emulate humans and animals in the following ways:

You'll add some features like these to the robot you'll build. We'll use distance sensors to avoid obstacles and plan movement. We'll explore a camera for visual processing and following lines, and voice processing to work with spoken commands.

The Mars Rover

By contrast, the Mars rover robots use wheels instead of legs, since stabilizing a wheeled robot is far simpler, and there is less that can go wrong:

Figure 1.4 - NASA's Perseverance Rover alongside the Ingenuity Helicopter Selfie on Mars (Image Credit: NASA/JPL-Caltech/MSSS; https://mars.nasa.gov/resources/25790/perseverances-selfie-with-ingenuity/)

The front and rear wheels on the Mars rover shown in Figure 1.4 each have a motor to steer them. All wheels have a motor to drive them. The wheels are arranged to provide maximum grip and stability, in order to tackle Mars's rocky terrain and lower gravity. For more information about this rocker bogie system see https://mars.nasa.gov/mars2020/spacecraft/rover/wheels/. A design predominantly being a platform on wheels like this is known as a rover.Mars rovers are designed to work on a different planet, where there is no chance of human intervention if it breaks down. They must be robust. Updated software can only be sent to a Mars rover via a remote link as it is not practical to send up a person with a screen and keyboard. The Mars rover is headless by design.The Perseverance rover is deployed with its 23 cameras folded up. After landing, some cameras get unfolded. The head like cluster of cameras can positioned with motors, in a pan and tilt mechanism, which is used to send back the pictures of Mars.Beside Perseverance is a helicopter, Ingenuity. This has links back to the hobby robotics scene, which we’ll see more of later in this chapter.Like the Mars robots, the robot you'll build in this book uses motor-driven wheels. Our robot has also been designed to run without a keyboard and mouse, being headless by design. As we expand the capabilities of our robot, we'll also use servo motors to drive a pan and tilt mechanism with a camera to send back pictures of our test space.

Robots in industry

Another place robots are commonly seen is in industry. The first useful robots have been used in factories and have been there for a long time, with designs from 1956!

Robot arms

Robot arms range from tiny delicate robots for turning eggs, to colossal monsters moving shipping containers. Robot arms tend to use stepper or servo motors at their joints. Most industrial robot arms (for example, ABB welding robots) follow a predetermined pattern of moves. However, for a more sensor-based smart system, take a look at this robot named Yumi from ABB:

Figure 1.5 – Yumi Dual Arm Cobot from ABB

Robot arms can be unsafe to work around, requiring cages or warning markings around them. This robot Yumi is a collaborative robot or cobot , designed to be easy to train and work safely alongside people. Arm sensors and soft joints also allow Yumi to sense and react to collisions. Image credit: At the Science Museum (12) by Anthony O'Neil, CC BY-SA 2.0, via Wikimedia Commons.Yumi has a training and repeat mechanism for workers to adapt to tasks, using arm joint position sensors when being trained or playing back motions. Our robot will use encoder sensors to precisely control wheel movements.

Warehouse robots

Another common type of robot used in industry is those that move items around a factory floor or warehouse.There are giant robotic crane systems capable of shifting pallets in storage complexes. They receive instructions on where goods need to be moved from and to within shelving systems.Warehouses also have fleets of smaller mobile robots as shown in the next figure:

Figure 1.6 – The Ocado robot fleet

The preceding figure shows the Ocado fleet of warehouse robots, working together to store and retrieve grocery items in a vast warehouse. They sense when they are aligned with storage boxes, and as well as driving can act by lifting or lowering items.Figure 1.6 image credit: Techwords, CC BY-SA 4.0 <https://creativecommons.org/licenses/by-sa/4.0>, via Wikimedia Commons.Humans tend to interact with them through a central system, so each robot is headless, as our robot will be.We’ve seen robots in space and in industry, what about those closer to home?

Robots in the home

Many robots have already infiltrated our homes but are often overlooked as robots. However, they are more sophisticated than they appear.

A washing machine might be considered a robot with sensors (like temperature and water level, water transparency), outputs (like motors, heaters, pumps, door locks, and displays) and processes to control the wash time, temperature and water level. Some washing machines use sophisticated algorithms to automatically detect the stop conditions.

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, may have only timer-based operation, they do not make decisions and are too simple to be regarded as robots.

The robot vacuum cleaner

Perhaps the most obvious home robot is a robot vacuum cleaner:

Figure 1.7 – An OKP robotics vacuum cleaner

The wheeled mobile robot in Figure 1.7, is like the one we will build here, but prettier. Robot vacuum cleaners are packed with sensors to detect walls and dust levels, and as this one is doing, navigate back to their charging station. This robot is autonomous and mobile.Let’s take a closer look at its systems:

Figure 1.8 – The robot vacuum cleaner systems

Figure 1.8 shows a robot vacuum cleaner as a block diagram. The robot’s controller connects to many sensors, inputs, and outputs.Some are for user interaction, like a remote connection to a smartphone, indicator light, beeper, and user button. Some ensure things are working normally like the cover sensor, battery charge sensor and dust collector sensor. It has outputs for brush motors and the vacuum suction motor.The motors have encoders, so the vacuum knows how far it has moved or turned. It has floor sensors, so it won’t drive off edges, distance sensors to avoid walls, and IR sensors to locate its charging sensor. When it is driving, feedback loops are formed between some of these sensors and wheel motors.As we build our robot, we will explore how to use its camera to navigate to and track objects like this robot finds its charging station, we’ll use encoders to measure wheel movement, and distance sensors to avoid walls.Now we’ve examined robots we use our homes, what about the robots people build in their homes?

Discovering competitive, educational, and hobby robots

The most fun robots are those created by amateur robot builders. This is an extremely innovative space.Robotics always had a home in education, with academic builders using them for learning and experimentation platforms. Many commercial ventures have started in this setting. University robots are often group efforts, with access to hi-tech equipment to create them.Hobby robotics is strongly linked with the open-source software/hardware community, making use of sites such as GitHub (https://github.com) for sharing designs and code, leading to further ideas. For example, searching Github for topic: robotics org: orionrobots would show you my robotics work.Hobbyist robots can be created from kits available on the internet, with modifications and additions. The kits cover a wide range of complexity, from simple three-wheeled bases to drone kits and hexapods. They come with or without the electronics included. An investigation of kits will be covered in Chapter 2, Exploring Robot Building Blocks – Code And Electronics, Choosing a chassis kit.The following robot was built using a kit:

Figure 1.9 – Spiderbot – a servomotor-based hexapod

I used a hexapod kit to build SpiderBot (Figure 1.9) to explore the walking motion with 6 legs. It uses an esp8266 controller and an Adafruit 16 Servo driver for the motors.Another way that hobby robots are built is via toy hacking, taking a moving toy, for example a remote-control (RC) vehicle, or a device like a hoverboard, and converting it into a robot. This can be fun, but also needs some confidence in electronics problems. An example is the robot pictured in Figure 1.10:

Figure 1.10 – Skittlebot – My PiWars 2018 Robot, based on a toy

Skittlebot, pictured in Figure 1.10 was built using toy hacking, repurposing a remote-control excavator toy into a robot platform. It was made for the 2018 PiWars competition. It uses the motors, tracks, and base of the RC toy with a Raspberry Pi controller similar to what we will use in this book.

Pi Wars is an autonomous robotics challenge for Raspberry Pi-based hobby robots, with both manual and autonomous challenges. It welcomes entries with decorative cases and resourceful engineering.

Skittlebot uses three distance sensors to avoid walls. We will investigate this kind of sensor in Chapter 8, Programming Distance Sensors with Python. Skittlebot also uses a camera to find colored objects, as we will see in Chapter 13, Robot Vision – Using a Pi Camera and OpenCV, in the section Colors, masking, and filtering – chasing colored objects.Some hobbyist robots are built from scratch, using 3D printing, laser cutting, vacuum forming, woodwork, CNC, and other techniques to construct the chassis and parts, like this robot, Apex:

Figure 1.11 – Apex robot by Rowan Hansard

Apex, the robot shown in Figure 1.11, was built by Rowan Hansard of Onydus Robotics in 2023, with the design inspired by the Mars Rover’s rocker bogie, a camera on a mast, and a camera beneath to detect and align itself over screws. It has been built using a junction box, and some plywood, with a Raspberry Pi 3b+. Apex was made to apply sealant to screws. This robot uses principles from previous editions of this book, including vision with the camera, headless via a remote-control web app and build around a Raspberry Pi.Some robots combine techniques, like scratch building and kits:

Figure 1.12 – ArmBot - A larger Raspberry Pi robot with Arm

I built the robot “ArmBot” shown in Figure 1.12, combining materials I had cut and shaped with a robot arm kit, for a London robotics group in 2009. It was based on a small laptop but now uses a Raspberry Pi.In this book, we will use a chassis kit to get started and experiment on. We will cover some of the communities where robots are being built and shared, along with starting points on using construction techniques to make them from scratch.Having seen a few robots, let’s see what the parts inside them are!

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learn Robotics Programming
You have been reading a chapter from
Learn Robotics Programming - Third Edition
Published in: Dec 2025
Publisher: Packt
ISBN-13: 9781803246987
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
Modal Close icon
Modal Close icon