Throughout this book, we will build a robot and create programs for it that give the robot behaviors that make it appear intelligent and able to make decisions. We will write code to use sensors to observe the robot's surroundings and build real-world examples of advanced topics, including vision, speech recognition, and talking.
You will see how the simple build techniques, when combined with a little bit of code, will result in a machine that feels like some kind of pet. You will also see how to debug it when things go wrong, which they will. You'll find out how to give the robot ways to indicate problems back to you, along with selecting the behavior you would like to demonstrate. We will connect a joypad to it, give it voice control, and finally show you how to plan a further robot build.
Before we start building a robot, it's worth spending a little time on what a robot is. We can explore some types of robots, along with basic principles that distinguish robots from other machines. You'll think a little about where the line between robot and non-robot machines is located, and then perhaps muddy that line a little bit with the somewhat fuzzy truth. We will then look at a number of robots built in the hobbyist and amateur robotics scenes.
In this chapter, we will be covering the following topics:
- What does robot mean?
- Exploring advanced and impressive robots
- Discovering robots in the home
- Exploring robots in industry
- Competitive, educational, and hobby robots
What does robot mean?
A robot is a machine that makes autonomous decisions based on input from sensors. A software agent is a program that automatically processes input and produces output. Perhaps a robot is best described as an autonomous software agent with sensors and moving outputs, or it could be described as an electromechanical platform with software running on it. Either way, a robot requires electronics, mechanical parts, and code.
The word robot conjures up images of fantastic sci-fi creations, devices with legendary strength and intelligence. These often follow the human body plan, making them an android, a human-like robot. They're often given a personality and behave like a person who is, in some simple way, naïve:
The word robot comes from science fiction (also known as sci-fi). The word is derived from the Czech word for slave and was first used in the 1921 Karel Capek play, Rossum's Universal Robots. The science fiction author Isaac Asimov coined the word robotics as he explored intelligent robot behavior.
Most real robots in our homes and industries are not cutting-edge and eye-catching. Most do not stand on two legs, or indeed any legs at all. Some are on wheels, and some are not mobile but still have moving parts and sensors.
Robots such as modern washing machines, autonomous vacuum cleaners, fully self-regulating boilers, and air sampling fans have infiltrated our homes and are part of everyday life. They aren't threatening and have become just another machine around us. The 3D printer, robot arm, and learning toys are a bit more exciting, though:
At their core, robots can all be simplified down to outputs such as a motor, inputs such as a sensor, and a controller for processing or running code. So, a basic robot would look something like this:
- It has inputs and sensors to measure and sample properties of its environment.
- It has outputs such as motors, lights, sounds, valves, or heaters to alter its environment.
- It uses data from its inputs to make autonomous decisions about how it controls its outputs.
Now, we will go ahead and look at some advanced robots in the next section.
Exploring advanced and impressive robots
Now that you have an overview of robots in general, I'll introduce some specific examples that represent the most remarkable robots around, and what they are capable of. Except for the Mars robots, human and animal forms have been favored by these robot makers for their adaptability, contrasting with robots designed for industrial use and intended for single repeated use.
Figure 1.3 shows the similarities between these robots and humans/animals:
- Robot 1 is Cog from the Massachusetts Institute of Technology. Cog was an attempt to be human-like in its movements and sensors.
- Robot 2 is the Honda ASIMO, which walks and talks a little like a human. ASIMO's two cameras perform object avoidance, as well as gestures and face recognition, and have a laser distance sensor to sense the floor. It follows marks on the floor with infrared sensors. ASIMO accepts voice commands in English and Japanese.
- Robot 3 is the Nao robot from Softbank Robotics. This cute 58 cm tall robot was designed as a learning and play robot for users to program. It has sensors to detect its motion, including if it is falling, and ultrasonic distance sensors to avoid bumps. Nao uses speakers and a microphone for voice processing. It has multiple cameras to perform similar feats to the ASIMO.
- Robot 4 is Atlas from Boston Dynamics. This robot is fast on two legs and has natural-looking movement. It has a laser radar (LIDAR) array, which it uses to sense what is around it so as to plan its movement and avoid collisions.
- Robot 5 is the Boston Dynamics BigDog, a four-legged robot, or quadruped. It can walk and run. It's one of the most stable four-legged robots, staying upright when being pushed, shoved, and walking in icy conditions.
You'll add some features like these in the robot you'll build. We'll use distance sensors to avoid obstacles, using ultrasonic sensors in the same way as Nao, and discussing laser distance sensors like ASIMO. We'll explore a camera for visual processing, line sensors to follow marks on the floor, and voice processing to work with spoken commands. We'll build a pan and tilt mechanism for a camera like the head of Cog.
The Mars rovers
The Mars rover robots are designed to work on a different planet, where there is no chance of human intervention if it breaks. They are robust by design. 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:
Mars rovers depend on wheels instead of legs, since stabilizing a robot on wheels is far simpler than doing it for one that uses legs, and there is less that can go wrong. Each wheel on the Mars rovers has its own motor. The wheels are arranged to provide maximum grip and stability to tackle Mars's rocky terrain and lower gravity.
The Curiosity rover was deposited on Mars with its sensitive camera folded up. After landing, the camera was unfolded and positioned with servo motors. The camera is pointed using a pan and tilt mechanism. It needs to take in as much of the Mars landscape as it can, sending back footage and pictures to NASA for analysis.
Like the Mars robots, the robot you'll build in this book uses motor-driven wheels. Our robot is also 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.
Discovering robots in the home
The 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
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:
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.
Exploring robots in industry
Robot arms range from tiny delicate robots for turning eggs, to colossal monsters moving shipping containers. Robot arms tend to use stepper and servo motors. We will look at servo motors in the pan and tilt mechanism used in this book. Most industrial robot arms (for example, ABB welding robots) follow a predetermined pattern of moves, and do not possess any decision making. However, for a more sensor-based and smart system, take a look at the impressive Baxter from Rethink Robotics in Figure 1.7. Baxter is a collaborative robot designed to work alongside humans:
Many robot arms are unsafe to work next to and could result in accidents, requiring cages or warning markings around them. Not so with Baxter; it can sense a human and work around or pause for safety. In the preceding image, these sensors are seen around the head. The arm sensors and soft joints also allow Baxter to sense and react to collisions.
Baxter has a training and repeat mechanism for workers to adapt it to a task. It uses sensors to detect joint positions when being trained or playing back motions. Our robot will use encoder sensors to precisely control wheel movements.
Figure 1.8 picture 1 shows robotic crane systems for shifting pallets in storage complexes. They receive instructions to move goods within shelving systems.
Smaller item-moving robots, like Intellicart in Figure 1.8 picture 2, employ line sensors, by following lines on the floor, magnetically sensing wires underneath the floor, or by following marker beacons like ASIMO. Our robot will follow lines such as these. These line-following carts frequently use wheels because these are simple to maintain and can form stable platforms.
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:
Kismet (Figure 1.9 picture 1) was created at MIT in the late 90s. Several hobbyist robots are derived from it. It was groundbreaking at the time, using motors to drive face movements mimicking human expressions. OhBot, a low-priced hobbyist kit using servo motors, is based on Kismet. OhBot (Figure 1.9 picture 2) links with a Raspberry Pi, using voice recognition and camera processing to make a convincing face.
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. 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 6, Building Robot Basics – Wheels, Power, and Wiring. I used a hexapod kit to build SpiderBot (Figure 1.10) to explore the walking motion:
Skittlebot was my Pi Wars 2018 entry, built using toy hacking, repurposing a remote control excavator toy into a robot platform. Pi Wars is an autonomous robotics challenge for Raspberry Pi-based robots, with both manual and autonomous challenges. There were entries with decorative cases and resourceful engineering. Skittlebot (Figure 1.11) uses three distance sensors to avoid walls, and we will investigate this kind of sensor in Chapter 8, Programming Distance Sensors with Python. Skittlebot uses a camera to find colored objects, as we will see in Chapter 13, Robot Vision – Using a Pi Camera and OpenCV:
I built the robot in Figure 1.12 from scratch, for the London robotics group The Aurorans, in 2009. The robot was known as EeeBot in 2009 since it was intended to be driven by an Eee PC laptop. The Aurorans were a community that met to discuss robotics. The robot was later given a Raspberry Pi, and a robot arm kit (the uArm) seemed to fit, earning it the name ArmBot.
In the current market, there are many chassis kits, and a beginner will not need to measure and cut materials in this way to make a functioning robot. These are built to experiment on, and to inspire other robot builders and kids to code. Toward the end of the book, 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.
The television series Robot Wars is a well-known competitive robot event with impressive construction and engineering skills. There is no autonomous behavior in Robot Wars, though; they are manually driven like remote control cars. Washing machines, although less exciting, are smarter, so they could be more strictly considered robots.
In this chapter, we have looked at what the word robot means, and the facts and fiction associated with robots. We have defined what a real robot is. You have seen what a machine needs to do in order to be considered a robot.
We've investigated the robots seen in the home and in industry. You've been shown some designed to amaze or travel to other planets. We've also looked at hobbyist and education robots, and how some of these are just built for fun. You've seen some block diagrams of real-world devices that may not have been considered robots. You've also spotted how our homes may already have several robots present.
I hope this chapter has you thinking about what earns the title of robot. A washing machine can be fully automatic, starting at some time later, following a program, with some advanced machines saving water by detecting the quality of the water coming out from the clothes as a metric for how clean they are. A machine called a robot, however, could be simply a remote-controlled device, such as telepresence robots or Robot Wars robots. Undoubtedly, all have sophisticated engineering, requiring many similar skills to make them.
While some robots are clearly robots, such as the Honda ASIMO and Baxter, some others are far harder to draw the line at. If the broad concept of a decision-making, electro-mechanical machine fits these cases, it would exclude the remote-controlled type. If the concept of machines that are mobile is applied, then a toy RC car would be included, while a fully autonomous smart machine that is stationary is excluded. A machine could be made to look robot-like with anthropic (human-like) characteristics, but simply being mechanical, moving an arm up and down – is this a robot? It isn't running a program or reacting to an environment.
Now that we have explored what robots are, let's move on to the next chapter, in which we'll look at how to plan a robot so we can build it.
Look around your home. There will be other automatic machines with many of the features of robots in them. Take a common household machine (other than a washing machine), and look at its inputs and outputs. Use these to make a diagram showing them going in or out of a controller. Think about how they move if they move around the house.
Consider further what feedback loops may be present in this system. What is it monitoring? How is it responding to that information?
Refer to the following links:
- Honda ASIMO: http://asimo.honda.com/.
- Baxter at Rethink Robotics: https://www.rethinkrobotics.com/baxter/.
- Kismet at MIT: http://www.ai.mit.edu/projects/humanoid-robotics-group/kismet/kismet.html.
- The OhBot: http://www.ohbot.co.uk/.
- The Mars Science Laboratory at NASA: https://mars.nasa.gov/msl/.
- For building a robot arm like the one used in ArmBot, take a look at MeArm: https://github.com/mimeindustries/MeArm.
- For more information about my ArmBot design, visit https://www.youtube.com/watch?v=xY6Oc4_jdmU.