Materials

Untitled

What is programming

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.

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.

Activity: Cheese Sandwich Factory Game

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.

Problem description

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)/

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)/

  1. Location 1 corresponds to the end of a conveyor belt. This conveyor belt delivers slices of bread and cheese. However, and this is important, the order is random. You do not know in advance what the following item will be. It can be either bread or cheese.
  2. Location 2 corresponds to the start of a second conveyor belt. This conveyor belt leads to additional robot arms in the factory. This conveyor belt can be used to drop off items that are not needed by the robot. For example, if the conveyor belt 1 delivers a run of bread, the superfluous slices of bread can be dropped onto conveyor belt two.
  3. Location 3 corresponds to a place where cheese sandwiches are assembled. For the purpose of this game, we assume that the truck can only carry one cheese sandwich. Whenever a complete sandwich is assembled on the truck's back, it drives off, and another truck takes its place. For this game, a completed sandwich consists of a slice of cheese between two slices of bread.