1, 2, 3, code ! - Cycle 2 activities - Lesson 3.4. Programming Thymio (1/2)

Summary

To go into more depth with Thymio, students discover the Aseba/VPL programming environment. The graphic interface lets them design their own programs for Thymio. 

Key ideas
 (see Conceptual scenario)

"Machines"

  • The machines all around us simply follow "orders" (instructions)

"Languages"

  • We can give a machine instructions by using a special language called a programming language, which can be understood by both people and machines. If you launch the same program several times, it will always do the same thing.

"Robot"

  • A robot is a machine that can interact with its surroundings
  • A robot has a computer that decides which actions to take in which situations.

"Algorithms"

  • A test indicates which action to perform when a condition is met.

Equipment

For each group

  • A Thymio robot
  • A computer (Windows, Mac or Linux OS) with VPL software (Aseba/VPL is an environment and a visual programming language (hence its name) that can be used to program a Thymio robot. This software is free of charge and can be downloaded from the publisher's website at: https://www.thymio.org/en:start )

For each student:

Note: Direct access is available on the project website to the installation file for Windows.

Glossary

Programming language

Duration

1 hour

 

Preparation

Download the Aseba/VPL software at https://www.thymio.org/en:start (you can choose the version for your operating system). The software is free of charge and available for Windows, Mac and Linux OS. During installation, simply accept the default settings (and be sure to choose the "For Thymio II" option (Recommended)).

When installation is complete, rename the "Aseba" shortcut "Thymio."

 

To start VPL
Method 1 Method 2
1.   Connect Thymio to the computer using the USB cable (it will turn on)
2.   Start Thymio-VPL
1.    Start Thymio-VPL (a "Choose an Aseba target" window opens)

2.    Connect Thymio to the computer using the USB cable (it will turn on)

3.    Check the "Serial port" box, select "Thymio-II Robot," click "Connect"
To program

1.   Write the program

2.   Save the program

3.   Run the program

If the robot is connected to the computer via a cable and the software is closed out by mistake, the computer may no longer recognize the robot. If this happens, unplug the robot and plug it back in.

Start the "Thymio VPL" software or ask the students to do so.

 

Starting the activity

In the previous lessons, students will have handled Thymio and learned that a computer commands the robot's actions based on what its sensors detect. Now, students will create their own programs to have Thymio perform other actions. For students to be able to talk to Thymio, the teacher presents the Aseba/VPL programming language.

 

Experiment: Programming Thymio with VPL (in groups)

This language lets students create programs by describing a series of tests. By combining one card each from the left and right columns, students can create a test.

To help students better understand VPL, the teacher gives students Handout 24. The students begin by getting familiar with the interface and how to create programs with the cards provided. In particular, they will see that the cards from the left column correspond to various events that the sensors can trigger, while the cards from the right column correspond to actions.

Teaching notes:

  • You learn to program by programming, not by watching someone program. It is interesting to consider the same problem in pairs (probably more so than to program alone), but it is important to be active. We therefore recommend placing the students in small groups in front of computers (ideally two students per machine) and asking them to “switch over” (pass the keyboard and mouse to their neighbor) every 10 minutes.
  • For this introductory lesson, only the "red" sensor status is taken into account. If students ask what the "black" status for a sensor in VPL means, the teacher tells them that this will be covered in the next lesson.

The class explores the pre-set programs. The teacher gives students Handout 25. The students must test the four programs one after another and write down what they did in the form of a test.

To test the effect of a program on Thymio, students must:

  • Delete the cards already in the central area of the graphic interface by clicking on the corresponding Xs (see Handout 24)
  • Place the event card and the action card to be tested in the central area
  • Modify these cards if necessary by clicking the buttons and/or moving the cursors
  • Start the program by pressing the arrow
  • Place Thymio on a flat surface, without unplugging it if possible, to test and observe the effects of the program by manipulating Thymio as much as needed. If the students unplug Thymio, they will have to plug it back in before testing the next program.

 

Group discussion

The teacher writes down the class's descriptions for the different programs on the board:

  • Program 1: IF you press the center button, THEN Thymio moves forward
  • Program 2: IF Thymio detects an object in front of it, THEN the cover turns green
  • Program 3: IF Thymio detects an object under it, THEN the chassis turns blue
  • Program 4: IF you tap on Thymio's cover, THEN it plays music

Scientific notes:

  • Program 3 uses Thymio's chassis sensors. These are the same sensors that are used for turquoise Thymio's "line-follower" mode. If you put Thymio near the edge of the table, it detects nothing. The same happens when you put it on a black piece of paper. However, it will detect any light surface.
  • For Programs 1, 2 and 3, Thymio will not come back alone to its original setting (it does not stop until another instruction is given and won't go back to the original color). This is normal, because this would be another behavior that the one covered here: at the moment, when it detects an event, Thymio changes color or begins to move… and it shall continue until another program asks it to do something else. The next lesson deals with getting Thymio to return to its original setting.

 

Conclusion and lesson recap acivity

The class summarizes together what they learned in this lesson:

  • The machines all around us simply follow orders (instructions).
  • We give instructions to a machine by creating a program, which uses a programming language.
  • The execution of a program is reproducible (if neither the instructions nor the data to manipulate change, the program always gives the same result).

 

 


<< Lesson 3.1 to 3.3 Sequence III Lesson 3.5 >>

 

Project partners

Aucun résultats