1, 2, 3, code ! - Cycle 3 activities - Lesson 1.1. How to remotely operate a vehicle

Summary

Students must provide the instructions to remotely operate a vehicle. To do this, they define a programming language and explore the difference between it and a natural language. They are also introduced to the notion of a software bug.

Key ideas
(see Conceptual scenario)

"Machines"

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

 "Languages"

  • In computer science, we invent and use languages.
  • To give machines instructions, we use a programming language, which can be understood by both machines and people.
  • A programming language is different than a natural language.
  1. It has very few words or grammar rules.
  2. It leaves no room for ambiguity.
  3. It can be understood by certain machines.
  • There are several programming languages, created for different uses.
  • A bug is an error in a program.
  • A bug that seems minor can have major consequences.

Inquiry-based methods

Experimentation

Equipment

For the class

(Optional)

  • A computer room with an internet connection

Glossary

Programming language, instruction, bug

Duration

1 hour 30 minutes (can be broken into two 45-minute lessons)

 

Introductory question: Project presentation

The teacher explains to the class that the project involves simulating an exploration mission on a faraway planet. The class must start by preparing the mission: thinking about how they will get around, communicate, etc. Then, the class will "play" the mission using a simulation program each student will create (a simple video game).

This will be a manned space mission and the team will have a base and a land rover vehicle available when they land on the planet. It is a hostile environment, so someone must always stay at the base during the exploration outings. If the field team members can no longer pilot the rover (for example, if they lose consciousness), the person at the base must be able to remotely drive the rover back to base without needing to talk to the team. Orders are transmitted to the rover as waves, but you must invent a language to give these orders.

The question is what language do you use to operate a rover remotely?

The teacher hangs or puts up on a projector a map of the area to explore (Handout 28). This area is sectioned off on a grid and a route has been drawn to return to base while avoiding dangerous areas. No shortcuts are possible: you must follow the established route in the direction of the arrows.

 

Quest: establish a language (in pairs)

The teacher passes out the Handout  28 to the students, who are split into pairs. They must decide what types of instructions to give to the rover to make it follow the required route and return to base. The movements must be made square by square (not diagonally).

Group discussion

After a few minutes, the class comes together to discuss all the pairs' work. For example, students can draw or show their solutions on a projector and the class verifies together if it is correct by filling out the table (use any object as the rover and have it follow the instructions exactly).

There are (at least) two ways consider giving the instructions. You can either give the rover "absolute" directions (go North, go West, etc.) or relative directions that depend on the rover's actual position (turn right, go forward, turn left, back up, etc.).

Note: It is preferable to divide the instructions into separate orders. For example, the instruction "Move forward one square to the right" is best given as: turn right (without advancing), then move forward one square.


Fourth Grade class, Carole Vinel, Paris

“N = move northward; S = move southward; E = move eastward; O = move westward”

 

Teaching notes:

  • The first approach to spatial processing (North, West, etc.) is called "allocentric" while the second (right, left, etc.) is called "autocentric". Students do not need to know these terms as they will not be used in later lessons.
  • A third approach (rarer) may also be suggested: assigning coordinates to each square (A1, A2, B1) and, like in a game of Battleship, code movements by giving the name of square of departure and arrival. For example, "Go from A1 to A2". Please note: The direction "A1 to A2 is not ambiguous because these squares are adjacent. However, "A1 to B7" is ambiguous (and therefore not satisfactory) as there are several ways to move from square A1 to square B7. We will not go into further detail about this method in later lessons.

It is likely that different teams will suggest the two different methods. If this is not the case, the teacher can introduce the other method during the group discussion.

 


allocentric language that does not address the distance moved: “up – right – up – left – up – right – down – right – down – left”;
 

allocentric language with autocentric keys: “▲=advance ►=turn right ◄=turn left▼=reverse

showing changes made by a student during the research phase: “straight ahead, right, straight ahead, left, straight ahead, right, right, right, down, right, down, down, left, left, straight ahead;
SA, R, SA, L, SA, R, R, R, D, R, D, D, L, L, SA;
1tSA, 1tR, 1tSA, 1tL, 1tSA, 3tR, 1tD, 1tR, 2tD, 2tL, 1tSA”

autocentric language completely written out: “Advance one cell. Turn right and advance one cell. Turn left and advance one cell. Turn left and advance one cell. Turn right and advance one cell. Turn right and advance three cells. Turn right and advance one cell. Turn left and advance one cell. Turn right and advance two cells. Turn right and advance two cells. Turn right and advance one cell.”.

Several student suggestionsFifth Grade class, Anne-Marie Lebrun, Bourg-la-Reine.

 

The teacher tells the students that the instructions are written in a special language, with a very limited and unambiguous vocabulary: each instruction is perfectly explicit and must not have more than one possible interpretation. This is called a "programming language."

This language can be further simplified. For example, you do not need to say "Go to the East" or "Go to the right" when you can simply say "East" or "Right" instead (for example, assuming that the meaning of "right" is well defined when you say "move from one square to the right" and not "pivot a quarter-turn to the right").

As a class, the group describes the two languages, e.g.:

 

Allocentric language (or "absolute") Autocentric language (or "relative")
  • North (means "move one square to the North")
  • South
  • East
  • West
  • Forward (means "move forward one square in front of you")
  • Right (means "pivot a quarter-turn to the right without advancing")
  • Left

The allocentric language requires four vocabulary words while the autocentric language requires only three. Some students may give the instruction "Back", but the rover will end up in the same square if it backs up one square or goes "Right, Right, Forward". However, with these instructions, it will have changed the direction it is facing. For the rover to be facing its initial direction, the instruction must be "Right, Right, Forward, Right, Right."

It is also possible to reduce the number of words used in the autocentric language. "Left", for example, can be "Right, Right, Right". Here, two words suffice. For more clarity, you may want to keep three or four words, depending on what the students decide.

The teacher tells the students that the grammar is also very basic. There are no genders, plurals, moods or tenses. The only rule here applies to sequencing: when there is a series of two instructions, such as "Right Forward," this means that they must be done one after the other in the order they appear.

For greater clarity when reading and writing the instructions, students can decide (or not!) to introduce an additional rule, such as separating instructions with commas.

Finally, the class notes that these languages do not allow for other actions besides moving around a grid (e.g., you cannot display text or do calculations): programming languages are specialized. The teacher can tell the class that there are other similar languages (with few "words", few grammar rules, little or no ambiguity, etc.), such as music notation.

 

Introduction to errors

The teacher asks the students what happens if there is an error in the program (for example, if an instruction is left out). A concrete example can be used based on the rover's initial route (Handout 28). What happens if you skip an instruction? Regardless of the language used, the goal is not achieved. An error in an autocentric language can take you farther from the goal than an allocentric language error. However, in both cases, this is a bug and there are two things to take note of. First, the goal is not met, so the failure is just as serious in both cases. Second, if there are obstacles along the route (cracks, etc.) you do not want to make a mistake, however slight. Both bugs are equally problematic.

The class discusses the different possible causes of a bug. It may be from an error in the algorithm (the method), an error in the program (the expression of the algorithm in the chosen language, such as a syntax error), or an equipment failure (related to a broken part in the machine or an error in transferring the instructions, such as in this activity).

Teaching note

The word "bug," first coined by Thomas Edison, began being used in the field of computer science after computer scientist Grace Hopper found the cause of a computer malfunction: an actual insect found in the machine's inner workings. Read more about Grace Hopper here.

 

Conclusion and lesson recap activity

The class summarizes together what they learned in this lesson:

  • In computer science, we invent and use languages.
  • To give machines instructions, we use programming language, which can be understood by both machines and people.
  • A programming language is different than a natural language.
    • It has very few words or grammar rules.
    • It leaves no room for ambiguity.
  • There are several programming languages, created for different uses.
  • A bug is an error in a program.
  • A bug that seems minor can have major consequences.

Students write down these conclusions in their science notebook. The teacher prepares a poster called "Defining computer science?". This poster will be completed during the project and will provide a general overview of this field (key ideas of language, algorithm, program, machine, data, etc.). They start by copying what the class learned about the notion of language during this lesson.

Online exercise

If the school possess a computer room the lsson can be continued by a short exercise online which is a good complement on the notions of program and bug. The activity can be done together on the board with a projection or on the digital table a few days after this sequence, to strengthen the notions acquired.

 

Si l’école dispose d’une salle informatique, on peut prolonger cette séance par un court exercice en ligne permettant de retravailler les notions de programme et de bug. L’activité peut aussi être menée collectivement au vidéoprojecteur ou sur TNI, quelques jours après cette séance, de façon à en renforcer les acquis.

 

Further study (unplugged, Cycle 4)

This lesson can be extended with an exercise where pairs translate one language into another:

  • Translate this series of instructions: North, West, North, East, East, East, South, East, South, West, West, North, North" (allocentric language) into an autocentric expression. Use a piece of grid paper to check that both expressions lead to the same result.
  • Translate (for a rover initially facing North) this series of instructions: Right, Forward, Forward, Left, Forward, Left, Forward, Forward, Forward, Forward, Right, Forward into an allocentric expression and check the result on a piece of graph paper.

If the students finish this activity quickly, have them write the following notion down in their science notebooks:

  • We can translate the same instructions from one language to another.

 

 

 


  Sequence I Lesson1.2 >>

 

Project partners

Aucun résultats