Clean the Floor Using A Robot
TeachEngineering activity developed by New York University Polytechnic Institute. For a related activity, see TeachEngineering’s Automatic Floor Cleaner Computer Program Challenge, created by Worcester Polytechnic Institute.
Grade level: 7 – 9
Time: 1.5 hours (can be split into two 45-minute class sessions)
Cost: This activity uses reusable LEGO Mindstorm EV3 robots and software
Summary
Students consider and explore mathematical algorithms and/or geometric concepts to devise possible solutions to how a robotic vacuum should move to best clean a floor of unknown shape and dimensions. They brainstorm ideas, analyzing all presented solutions and presenting the best idea before being introduced to an elegant solution. Rather than elaborately calculating the most efficient route and keeping track of which tiles the robot has visited, a random number generator determines which direction the robot will take when it hits a barrier. Students are able to visually confirm how an unfamiliar programming concept (a random number generator) can make for a simple and efficient program that causes an EV3 robot (that is suitably equipped) to clean a bare floor. Then students think of other uses for random numbers.
A Roomba® (iRobot) vacuum cleaner
Larry D. Moore Wikimedia URL
Engineering connection
Many engineering problems can only be solved by the use of complex mathematics or specific mathematical algorithms. A random number generator is one example algorithm that is commonly used in computer programs for many purposes, from character actions in games to encrypting Internet communications. It can also be used for modeling real physical systems, which inherently contain some noise or randomness, such as weather forecasting. In addition, engineers must design products so that random or unpredictable processes from the surrounding environment have minimal impact on safety and reliability.
Learning objectives
After doing this activity, students should be able to:
- Provide examples of how engineers approach problem solving using their knowledge of mathematics.
- Describe how the concept of random numbers can be used to solve real-world problems.
Learning standards
Next Generation Science Standards
- MS-ETS1-1. Define the criteria and constraints of a design problem with sufficient precision to ensure a successful solution, taking into account relevant scientific principles and potential impacts on people and the natural environment that may limit possible solutions. [Grades 6 – 8]
- MS-ETS1-2. Evaluate competing design solutions using a systematic process to determine how well they meet the criteria and constraints of the problem.
Common Core State Mathematics Standards
- Make sense of problems and persevere in solving them. [Grades K – 12]
- Model with mathematics. [Grades K – 12]
- Use random sampling to draw inferences about a population. [Grade 7]
- Use probabilities to make fair decisions (e.g., drawing by lots, using a random number generator). [Grades 9 – 12]
International Technology and Engineering Educators Association
- New products and systems can be developed to solve problems or to help do things that could not be done without the help of technology. [Grades 6 – 8]
- Requirements are the parameters placed on the development of a product or system.
- Knowledge gained from other fields of study has a direct effect on the development of technological products and systems.
- Design involves a set of steps, which can be performed in different sequences and repeated as needed.
- Modeling, testing, evaluating, and modifying are used to transform ideas into practical solutions.
Materials
To share with the entire class:
- LEGO MINDSTORMS EV3 robot, such as EV3 Core
- LEGO MINDSTORMS Education EV3 Software 1.2.1, free online, you have to register a LEGO account first
- computer, loaded with EV3 1.2.1 software
- an assortment of large items that can be used as “obstacles” for the EV3 robot, such as boxes, poster board and moveable furniture, as well as classroom walls
- capability to show the class two short video clips from the Internet
Each student needs:
Note: This activity can also be conducted with the older (and no longer sold) LEGO MINDSTORMS NXT set instead of EV3; see below for those supplies:
- LEGO MINDSTORMS NXT robot, such as the NXT Base Set
- LEGO MINDSTORMS Education NXT Software 2.1
- computer, loaded with NXT 2.1 software
Worksheets and attachments
- Random Movement Updated.ev3 (ev3)
- Random Movement.ev3 (ev3)
- Random Movement.rbt (rbt) (NXT version)
- Random Numbers Pre-Quiz (docx)
- Random Numbers Pre-Quiz (pdf)
- Random Numbers Pre-Quiz Answers (docx)
- Random Numbers Pre-Quiz Answers (pdf)
- Random Numbers Worksheet (docx)
- Random Numbers Worksheet (pdf)
- Random Numbers Worksheet Answers (docx)
- Random Numbers Worksheet Answers (pdf)
- Random Numbers Post-Quiz (docx)
- Random Numbers Post-Quiz (pdf)
- Random Numbers Post-Quiz Answers (docx)
- Random Numbers Post-Quiz Answers (pdf)
More curriculum like this
What is a Program? (Elementary lesson)
Automatic Floor Cleaner Computer Program Challenge [Grades 6-8]
Introduction/Motivation
Computers are involved in nearly every aspect of our lives. Simple or complex, computers are present in our phones, cars, kitchen appliances, vacuum cleaners like iRobot’s Roomba, and even watches. How do humans “tell” computers what to do? (Answer: Through the use of computer programs.) In this activity, we will continue to use the EV3 robots and the LEGO MINDSTORMS EV3 programming environment to explore the world of robots and engineering.
Computers do not understand the spoken or written language that we use in ordinary discourse, but instead comprehend computer software, which is also called computer code. This software is a set of instructions that computers can understand and follow. The software directs the computer processor to perform specific tasks, such as opening a file, editing a text document or displaying a video. The software is written using programming languages, which are specific languages designed to communicate instructions to computers in the form of software.
People who compose these instructions are called computer programmers, and they use languages such as Java or Python to create the software. Just as regular human language has rules of grammar and syntax, programming languages also have certain rules that use special words and formats intended for particular types of computers. When a computer is combined with physical mechanisms and electronic sensors, a robot is created.
Robots are designed and created by engineers. They follow a series of steps called the engineering design process to guide them in the creation of new products. (Click HERE to see iRobot’s 2003 U.S. patent for a robot obstacle-detection system.) This design process is circular and iterative. This means that engineers repeat the steps as many times as necessary in order to make improvements to the product. While the engineering design process includes seven basic steps, this activity will focus on three of them: defining the problem, brainstorming and developing ideas and solutions, and evaluating alternatives and performing design analysis. (Note: For more information on the engineering design process and its steps, refer to the recommended websites in the Additional Multimedia Support section.)
To follow the design process, we are going to look into a real-world engineering design problem related to robots. Specifically, we will consider the design of robotic vacuum cleaners. First, let us start by brainstorming about why this kind of robot would be important to create. Can you think of any reason why someone would want to have a robot clean the floor, instead of using a regular vacuum cleaner? (Give students a moment to think about this and offer their ideas to the class.) Consider the case of people who are injured or disabled. They may not be able to vacuum the floor themselves, or it may be a very difficult and time-consuming task. A robot could be very useful if it was set up to consistently clean the floor every day or week. If you were part of the engineering team tasked with designing this robot, what features would you want to include that would help clean the floor?
In this activity, we will focus on a specific part of the design. Consider the following typical example engineering design problem: How should a robotic vacuum move in order to best clean a floor of unknown shape and dimensions? Note that posing this question gets us started with step 1 of the engineering design process: defining the problem.
Procedure
Background
In this activity, students are given background information on computer software and programming, and the engineering design process, and then invited to solve an engineering problem. Next, they are introduced to the concept of random numbers and a random number generator and watch two short videos on the topic. Then, students apply this new knowledge to the same problem.
Before the Activity
- Conduct this activity using one shared EV3 robot per class. Or, if more robots are available, provide one EV3 robot per group.
- Gather materials and make copies of the Random Numbers Pre-Quiz, Random Numbers Worksheet and Random Numbers Post-Quiz.
- Provide enough smooth floor space to run the activity. Use boxes, poster board, walls and other available classroom objects to create for each robot a minimum 3 x 3 ft. low, walled off area in which to move.
- Be ready to show the class two short video clips, as listed in the Additional Multimedia Support section.
- Prepare the EV3 robot according to the Five Minute Bot Building Instructions.
- Download the RandomMovement.ev3 file to the computer and open it with the EV3 software. Once the file is opened, connect the EV3 intelligent brick to the computer with the USB cable. Then, use the MINDSTORMS software to download the rbt program onto the EV3 brick, by selecting the download button located on the bottom right of the computer screen. As an alternative, if you are familiar with programming the EV3 brick you may want to write your own programs to demonstrate different patterns of movement, including random movement, circles and other geometric shapes.
With the Students
- Administer the pre-quiz.
- Explain to students the concepts covered in the Introduction/Motivation section to provide a general review of software programming, robots as computers and specific steps of the engineering design process.
- Hand out the worksheets and ask students to write their names on them.
- Introduce the engineering design problem: To program an EV3 robot to move in order to most efficiently clean a floor with an irregular shape. (Refer to the irregular floor area provided on the worksheet.) Then ask: What mathematical or geometric concepts can we use to solve this engineering challenge?
- Tell students that, for simplicity, we assume that: A) when the robot touches a square of the floor, we deem that entire square “clean.” (We can reduce the problem of partially cleaned tiles as much as we want by making the size of the virtual tiles as small as we want.) B) the robot cannot keep track of its past travels, so the program cannot use the information about which squares have been previously cleaned as part of the algorithm that governs its movement. By identifying the problem, we have completed step 1 of the engineering design process.
- Divide the class into groups of four to six students each. Ask groups to each come up with a short list of steps or a geometrical pattern that they think would cause the robot to efficiently cover the area of an irregularly shaped floor. Point out that doing this is step 3 of the engineering design process: brainstorming and developing ideas and possible solutions. (Note that Step 2 is “conduct background research.”) Have each group document on the worksheet its best proposed solution to the problem, including any steps or mathematical equations, and then draw a sketch or diagram to visually represent the solution. For example, students might draw a series of circles to show a path for where the robot would move about the room.
- Have each group make a brief presentation to the class explaining its design solution. Suggest that students either draw the proposed robot movement on the classroom board or act out the robot movement in front of the class.
- Next, guide students through the thought process to examine the various suggested strategies in more depth. This helps students think through how their plans would play out in reality, particularly with regard to robustness and efficiency in dealing with a complex floor shape, compared to a simple rectangular area. Doing this serves as step 4 of the engineering design process: evaluating alternatives and performing design analysis. Expect possible student-suggested movement strategies to include a spiral, back and forth, consecutively smaller squares, circular patterns, special movements for dealing with obstacles, etc. Demonstrate how they might work by drawing or physically moving a robot around the classroom space to show the feasibility of the strategies. As the class observes these demonstrations and discusses the pros and cons of the various solutions, have students record their observations and realizations on their worksheets. Examples:
- For a spiral pattern, draw on the board a robot following a spiral pattern inside a square room. As Figure 1 illustrates, a robot would miss cleaning the room corners.
- For a back and forth pattern, point out that this strategy would not work well for a room with many obstacles, such as a classroom full of desks.
- For a consecutively smaller squares strategy, a robot trying to clean a non-square room would miss parts along the outer edge.
- For a circular pattern, point out that the robot would miss cleaning in the gap areas between circles.
Figure 1. Robot movement example
copyright 2014 Raymond Le Grand, School of Engineering, NYU Polytechnic
-
- Introduce the concept of randomness versus order with an exercise in which students are able to visually see the effects of randomness in a mathematical context. Have students line up in the classroom according to height (see Figure 2). Then, read a list of names from the student roster in a random order and have students line up in the order that they are called. Then ask students to describe on their worksheets the difference between the first line ordered according to height and the second line that is random. Then, explain that random lists are defined by a lack of order, intentional pattern or conscious decision. Also explain the existence of “random number generators,” starting with a humorous video, Random Number Generator (2:09 minutes) and then the Random vs. Pseudorandom Number Generators (6:40 minutes, but just show the first 1:20 minutes). See website addresses for the videos in the Additional Multimedia Support section.
Figure 2. A classroom exercise to help visualize order vs. randomness.
copyright 2014 Raymond Le Grand, School of Engineering, NYU Polytechnic - Explain random numbers: A random number is a number that is chosen without conscious decision or pattern. Random numbers do not have “order,” but a computer or other device can generate them. A device that picks out random numbers in an unbiased manner, with no favor being given to any particular number, is called a random number generator. Some examples of these devices include coins, dice and spinners. A computer program can use a random number generator to make decisions, such as having a screen saver display random shapes.
- Remind students that engineers use the process of iterative design to create good products. Engineers are rarely satisfied with initial designs, but continuously seek to improve them by applying what they learn from analysis to making changes to the designs. Now that all group designs have been analyzed and students have gained new information, it is time to take a fresh look at their designs for how to improve them. Invite the groups to brainstorm about applying this new concept of random numbers to the problem of the robot floor cleaner by asking: How could we use random numbers or a random number generator to make the robot move around and clean the entire room? Expect that the leap of figuring out how the random number generator can be used in this program may be difficult for students. If so, go back over the basic problem of what the robot should do (given our assumptions) in order to have it clean the entire floor surface. If no students are able to answer the question, propose the following answer: The random numbers can be used to make the robot move in random directions, thus eventually covering the entire floor. Have students compare the results of this technique to some of the others initial design ideas that were considered before the concept of random numbers was introduced.
- Ask students to select a floor area shape and create a perimeter of obstacles, such that the obstacles become low walls defining that area. To do this, use boxes, poster board, classroom walls and any other handy materials or furniture. For best results, make the physical implementation at least 3 x 3 ft. in size. See Figure 3 for an example. Only one robot and floor shape are necessary for students to visually see the results, but if each group has a robot, have each group create its own floor area.
- Place the pre-programmed EV3 robot inside the area and begin the robot program. The robot will automatically try to avoid the obstacles and make random turning movements. Without giving the answer to students about what is happening, direct students to watch what the robot does and record on their worksheets their detailed observations about the robot movements.
- Explain that the robot is programmed to turn a random amount each time it detects an obstacle with its ultrasonic sensor. By doing this, it covers the entire floor area, regardless of the shape of the area. The Roomba® (iRobot) vacuum cleaner, uses this method in homes around the world to clean carpet floors.
- Introduce the concept of randomness versus order with an exercise in which students are able to visually see the effects of randomness in a mathematical context. Have students line up in the classroom according to height (see Figure 2). Then, read a list of names from the student roster in a random order and have students line up in the order that they are called. Then ask students to describe on their worksheets the difference between the first line ordered according to height and the second line that is random. Then, explain that random lists are defined by a lack of order, intentional pattern or conscious decision. Also explain the existence of “random number generators,” starting with a humorous video, Random Number Generator (2:09 minutes) and then the Random vs. Pseudorandom Number Generators (6:40 minutes, but just show the first 1:20 minutes). See website addresses for the videos in the Additional Multimedia Support section.
-
- Open the LEGO MINDSTORMS software and show students the EV3 code used to program the robot (Figure 4). Specifically, talk about how the first part of the code (the inner loop) is set up to make the robot go straight until the ultrasonic sensor detects an obstacle, with a threshold value of 7 inches. Then, the robot moves straight backwards for one rotation. Next, a random number is taken from the random number generator block, which is multiplied by a factor of 15, then sent to a move block, where the duration of the turn is set by the multiplied random number. Finally, the entire program is in a loop, so after it finishes turning it starts again at the beginning, moving straight ahead.
- As an exit reflection, invite students to think of other applications in which a random number generator might be part of a solution to an engineering problem. After listening to ideas from students, give the following examples.
-
-
- Computer programs use random number generators for everything from character actions in games to encrypting Internet communications.
- Random numbers are also used for modeling real physical systems, which inherently contain some noise or randomness, such as weather forecasting.
- In addition, engineers must design their products such that random or unpredictable processes from the surrounding environment have minimal impact on product safety and reliability. For example, civil engineers design bridges so that they do not crumble under the random gusts of wind during storms, while still supporting the weight of cars distributed at random intervals along its surface.
-
-
- Administer the post-quiz.
Vocabulary/Definitions
- computer software: A set of instructions that a computer can understand and follow. Software directs the computer processor to perform specific tasks, such as opening a file, editing a text document or displaying a video.
- programming language: A language designed to communicate instructions to a computer in the form of code. Programming languages are what computer programmers use to create apps, games and other useful software.
- random number generator: A computer program or calculation, or mechanical system or device that generates a sequence of numbers that lack any pattern.
- random numbers: A set of numbers in which each successive number bears no systematic relationship to the number before it.
Assessment
Pre-Activity Assessment
Pre-Quiz: At the beginning of class, administer the Random Numbers Pre-Quiz to determine students’ base knowledge of the activity topics, including computer software and programming, the concept of random, and random numbers.
Activity Embedded Assessment
Worksheet: Have students use the Random Numbers Worksheet during the activity to sketch group ideas for the path the robot should take in covering an irregularly shaped room, provide a definition of a random number, and record robot movement observations. Review their worksheets to gauge their depth of understanding.
Post-Activity Assessment
Post-Quiz: At the end of class, administer the Random Numbers Post-Quiz to assess student’s understanding of the concepts explained in the activity, including the definitions of computer software, programming language, random and random number generator. Additional questions ask for an example of random vs. non-random relationships, their ideas on how they would program a robot to clean a kitchen floor, and in what ways a random number generator might be useful for solving engineering problems. Review their answers to assess their level of comprehension.
Investigating Questions
- What are random numbers? (Answer: A set of numbers in which each successive number bears no systematic relationship to the number before it.)
- Who makes computer programs? (Answer: People who write instructions in the specific languages that computers understand are called computer programmers or computer scientists.)
- How do robotic vacuum cleaners move around a floor area? (Answer: Robotic vacuum cleaners usually move around randomly, in order to make sure they clean the entire floor areas of unknown shape.)
Troubleshooting Tips
If the robot does not work, make sure its motors and ultrasonic sensor are connected to the correct ports.
Activity Scaling
- For lower grades, engage students’ attention by having them design their own “cleaning accessories.”
- As a further challenge for upper grades, have students write their own programs that direct a robot to cover the entire floor area.
Additional Multimedia Support
As part of the Procedure section, show students the following video clips about random numbers:
- Random Number Generator by Idaho Lottery (2:09 minutes)
- Random vs. Pseudorandom Number Generators by Art of the Problem (6:40 minutes; just show the first 1:20 minutes)
For more detailed information about the steps of the engineering design process, see the Creative Engineering Design unit.
For more information about the engineering design process, see https://www.teachengineering.org/design/designprocess.
Prepare the EV3 robot for the activity by follow the online tutorial, Five Minute Bot Building Instructions, which provides excellent guidance through the building process because of its many images.
Copyright
Contributors
Raymond Le Grand, Lester Greenman
Supporting Program
AMPS GK-12 Program, Polytechnic Institute of New York University
Acknowledgements
This activity was developed by the Applying Mechatronics to Promote Science (AMPS) Program in the School of Engineering, funded by National Science Foundation GK-12 grant no. 0741714. These contents do not necessarily represent the policies of the NSF, nor should you assume endorsement by the federal government.
Filed under: Class Activities, Grades 6-8, Grades 9-12
Tags: Class Activities, computer program, floor cleaning robots, Grades 6-8, Grades 9-12, LEGO Mindstorms, random number generator, Robotics, roomba, teachengineering