In a next guide, we will introduce mBlock, the programming language we will be using to program the robot. However, before starting with the mBlock programming language, it is useful to define programming. This unit aims to introduce students to programming in an abstract sense before they start working with the robot.
Programming is writing step-by-step instructions for a machine, such as a computer or a robot, which is essentially a computer plus some sensors and motors. The set of instructions you can pick from when writing the program is a programming language. In this lesson, the programming language will be mBlock. mBlock provides the instructions the robot understands.
Before delving into programming the robot, explore the challenges programmers face through the following simple (made-up) example. Engage students with the scenario pictured below.
You are an engineer hired to program a mobile robot to reach the house's front door (indicated with an arrow) when the bell rings. The robot should be able to get to the front door from any location in the house.
This image depicts the layout of an imaginary building. The building is serviced by a robot, and we want to program it to answer the door when the doorbell rings.
Discuss the following with students. In solving the problem, programmers are faced with two different challenges.
Above, we discussed that programmers typically address two challenges when programming robots. To convey this message more clearly to students, we have developed a game in which the students are asked to write a program for a hypothetical robot. This game aims to help students experience the two challenges that occur when programming. First, students need to understand how a cheese sandwich can be built, in principle. Second, students need to shoehorn their intuition into the commands provided by the programming language. This requires understanding the commands. This exercise encourages students to perform a problem analysis before they start coding when programming robots.
Imagine you are an engineer hired to write the program controlling a robot arm in a cheese sandwich factory. The image below shows the robot arm can reach three locations labeled 1-3. You are asked to write a program for the robot such that it makes complete cheese sandwiches. A complete sandwich consists of a slice of bread, a slice of cheese, and another slice of bread.
Image of the challenge faced in the Cheese Sandwich Maker game. Students are asked to program the robot arm to use the materials delivered on the conveyor belt (at location 1) to build cheese sandwiches on the loading deck of a truck (location 3). Unneeded materials (bread and cheese) can be discarded on another conveyor belt (locations 2)/