Problem Solving and Creativity: Complementing Programming Education With Robotics
Problem Solving and Creativity: Complementing Programming Education With Robotics
Tobias Kohn
[email protected]
University of Cambridge
Cambridge, UK
ABSTRACT 1 INTRODUCTION
With its direct feedback and the tangible machine, robotics is a Physical computing has the potential to motivate and engage stu-
strong motivator for engaging students in STEM fields, as evidenced dents who find themselves not typically attracted to STEM fields.
by the popularity of competitions and events such as FIRST and Through interaction with the outside world physical computing
Robo Games. However, in the context of K-12 computer science breaks free from the usual restrictions imposed by classical comput-
education, the potential of robotics seems as yet hardly tapped ing devices. Additionally, physical computing can help the students
into. In an attempt to bridge the gap, we designed a Python library form a viable model of the machine to be controlled: the notional
for robotics with Lego’s EV3 robots to complement programming machine finds a tangible manifestation of its basic properties and
classes. capabilities. Incorporating robotics early on into a CS curriculum
We employed our library to teach secondary school students as could thus help address two difficulties that novice programmers
part of an outreach activity. Our approach is built around open- face: understanding the machine and what programming is for [6].
ended tasks instead of narrow exercise statements. Although our However, successful incorporation needs to establish as many
activity was based on the EV3 Space Challenge Set, we encouraged parallels between the existing curriculum, its tools, and robotics
the students at any time to pursue their own ideas and even their as possible, so as to fully leverage robotics as a motivator for CS,
own challenges. While students had little problems in using Python instead of presenting it as an isolated stand-alone concept. The
to program their robots, we still found a series of misconceptions aim is to reiterate and reuse the same ideas in different contexts,
and observed that female students were more interested in follow- leading to a spiral curriculum of mutually complementing teaching
ing their own creative projects than in solving given challenges. segments.
We put strong emphasis on both the concept of a spiral curricu-
ACM Reference Format: lum and making the notional machine explicit. In particular, we
Dennis Komm, Adrian Regez, Urs Hauser, Marco Gassner, Pascal Lütscher, follow many of Seymour Papert’s ideas [14] built around turtle
Rico Puchegger, and Tobias Kohn. 2020. Problem Solving and Creativity: graphics in primary school. Even this may be implemented as a
Complementing Programming Education with Robotics. In Proceedings of second iteration in a spiral approach as already Kindergarteners
the 2020 ACM Conference on Innovation and Technology in Computer Science can encounter programming [10] using, e.g., the Beebot, which un-
Education (ITiCSE ’20), June 15–19, 2020, Trondheim, Norway. ACM, New derstands an instruction set quite similar to that of Papert’s turtle.
York, NY, USA, 7 pages. https://doi.org/10.1145/3341525.3387420 For grades 1 through 4, a block-based programming approach for
the Beebot (e.g., via Bluetooth) can be used, and in the last two
years of primary school, the bee is replaced by the turtle. While
the turtle is not a physical object anymore, it still serves as a very
Permission to make digital or hard copies of all or part of this work for personal or comprehensible notional machine [11], and its immediate feedback
classroom use is granted without fee provided that copies are not made or distributed
for profit or commercial advantage and that copies bear this notice and the full citation allows students to experience programming as a fun activity; con-
on the first page. Copyrights for components of this work owned by others than the cepts such as loops can be taught to 5 or 6 graders in the context of
author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or
republish, to post on servers or to redistribute to lists, requires prior specific permission
drawing symmetrical objects.
and/or a fee. Request permissions from [email protected]. Our curriculum for secondary and high school is based on Python,
ITiCSE ’20, June 15–19, 2020, Trondheim, Norway still starting with turtle graphics for the first couple of lessons; a
© 2020 Copyright held by the owner/author(s). Publication rights licensed to ACM.
ACM ISBN 978-1-4503-6874-2/20/06. . . $15.00
transition from Logo to Python can be carried out smoothly this
https://doi.org/10.1145/3341525.3387420 way. A complementing segment on robotics should thus also use
259
Session: Creative Computing ITiCSE ’20, June 15–19, 2020, Trondheim, Norway
Python, ideally even the same programming environment. Algorith- by software simulation to allow students to still progress in devel-
mic tasks such as describing symmetrical objects or approximating opment and testing. As we had enough robots available so that
circles by polygons, programming fundamentals such as loops and each pair of students had their own device, this was no concern, al-
variables, and also design methodologies such as building programs though the software used would have offered simulation. However,
bottom up etc. can all be revisited using physical computing. the misconceptions we observed would indicate that care must be
One of the most fundamental differences between traditional taken to help students develop a proper understanding.
programming and robotics is the robot’s interaction with a physical Hodges at al. [9] note that a tight integration between the physi-
environment. As a first consequence, the data has to be read in cal device and the programming environment is critical, and that a
through sensors: programs are no longer “self-contained entities” close collaboration between educators and developers is required.
whose output could be determined through static analysis alone.
As a second consequence, the robot’s movement is imprecise with 3 FORMAT
random errors that have to be accounted for through analysis of The robotics outreach activity “i-CAMPs” took place in the Swiss
sensor input, say. Hence, constructs such as variables, conditions, canton of Grisons and lasted from Monday to Friday with a total of
and loops are no longer mere simplifications, but rather necessities roughly 80 students of grades 3 to 9 (ages 9 to 15) from different
to cope with an unknown environment. For instance, having the schools. For this paper, we only consider the subgroup of 24 sec-
robot follow a given line is a natural extension of approximating a ondary school students. There were six girls, thus one fourth of the
circle by a polygon, where the trajectory is no longer predetermined students were female. Some of the students had prior experience
by a regular shape, but has to be adaptive to react to sensor input. with the EV3 robot using block-based programming, and roughly
Support for Python on Lego robots is still scarce, although some half of them had taken part in the national First Lego League. Three
solutions exist [1]; but we deemed their heavy reliance on object younger students were highly familiar with the robot, but had not
orientation and the need for a sophisticated setup not appropriate yet used Python.
for our setting. We have therefore used an alternative approach for The 24 students worked in pairs on the EV3 Space Challenge Set,
using Python on EV3 robots – the library grobot. Moreover, with each set containing seven tasks to be solved using the EV3 robot.
cheaper robotic devices becoming available, the device-agnostic There was a total of six tutors for the 24 students, which allowed
design of the software interface we used becomes highly beneficial, for highly individualized guidance, which is not usually found in a
so that schools are free to choose the used device. In addition to classroom. The tutors were recruited from different colleges and
the EV3 and a software simulation, the library also supports the universities with either technical or educational focus.
Maqueen [5], which is based on the micro:bit [13]. On the first day, we introduced the students to the basics of
As a first evaluation, we used the robotic library during an out- Python with turtle graphics. The only control structure introduced
reach event for secondary school students (grades 7 to 9). After at this point were repeat loops. During the morning of the second
a brief introduction to Python and how to control the Lego EV3 day, students assembled their EV3 robots and received a basic intro-
robots, the students were asked to solve the Space Challenge Set duction to programming the robots using the Python library. The
from the First Lego League competition. However, the tasks were rest of the week was left to the students for working at their own
mainly viewed as a means to familiarize themselves with program- pace.
ming the EV3. From the start, we encouraged the students to follow
their own ideas and challenges. In this paper, we illustrate our
4 TECHNOLOGICAL SETUP
approach in detail and describe our experiences, e.g., regarding
misconceptions and feedback from the students. Each pair of students was given a base model of Lego’s EV3 robotics
kit and a laptop. On the first day, where no robots were involved,
each student worked on their own laptop.
260
Session: Creative Computing ITiCSE ’20, June 15–19, 2020, Trondheim, Norway
distance sensor, a light sensor for color and brightness, and a touch Table 1: List of basic commands and functions available through
sensor. The EV3 contains four motor ports A, B, C, and D; and four the Python library; ls stands for light sensor and ts for touch sensor.
sensor ports 1, 2, 3, and 4. One battery charge was sufficient for the
whole day, i.e., we recharged the devices over night (however, see forward() left() leftArc(r)
also Section 6.2). back() right() rightArc(r)
stop() delay(t)
4.2 Executing Python
ls2.getValue() getDistance() ts3.isPressed()
We ran Python on the EV3 bricks together with a Java TCP Server
BrickGate [2]. Programs were uploaded to the robot and executed
there. The Python program would then send the necessary com- three states: rotating clockwise, rotating counter-clockwise, or being
mands and instructions to the Java Server. Although the software at rest. The combination of the driving motors then leads to an ad-
supported a sophisticated graphical simulation mode, the students ditional FSM with the states forward, backward, turning left, turning
used the physical robots throughout. right, or being at rest. Similarly, sensors change their state based on
their measurements.
4.3 Robotics Library A command like forward() then changes the state of one of the
Design Principles. The development of the library was guided by FSMs. This is fundamentally different from, e.g., turtle graphics,
three main principles: where forward() is an action. Accordingly, it is natural to interpret
a parameter to forward() as speed in the case of a state change, and
(1) No setup required. The setup, configuration, and boiler-
as length in the case of an action. A program is then no longer a
plate inside the program must be kept to a minimum.
sequence of actions to be performed, but more akin to a timeline
(2) Support for different devices. The same API and interface
script of signals to be sent to different parts of the robot.
should work with a multitude of different devices.
(3) Expandability. The API should be expandable for more Basic Commands. Table 1 provides a selection of the basic com-
sophisticated robotic designs and applications. mands and functions that are provided to control the robot. The
delay(t) command is special in that it does not change the state
These principles reflect our belief that writing a first program to
steer a robot should be kept simple, run on many different robots, of a motor, but rather waits for the given duration of milliseconds
and allow for stepwise enhancements as the devices get more com- before continuing execution of the program. An example that in-
plex and the student progresses through the curriculum. As there cludes the import of the library and moving forward during one
are strong variations in how different robots are built, customiz- second is given in Program 1.
able, and have to be programmed, finding a common denominator While left() has the robot turn on the spot, leftArc(r) has it
involves making compromises. The idea is, however, that there is a move along a circle with radius r (provided in meters). The ultra-
common base, upon which each robot’s specialities then can build. sonic sensor has to be plugged into sensor port 1, light and touch
A robotic device such as the Lego EV3 allows for a multitude of sensors can be at any port. This makes it necessary to specify the
different configurations. Since the various motors and sensors are port when accessing one of the latter, e.g., via ls2.getValue().
unable to identify themselves, it is necessary to mimic the physical
Program 1 A first simple program to make the robot move forward.
design of the robot in program code to initialize correct pairing
of soft- and hardware. Alternatively, the software can stipulate a 1 from grobot import *
physical design of connections, placing the burden of correct pairing 2 forward()
3 delay(1000)
on the builder of the device. Other devices such as the Maqueen
4 stop()
allow for significantly less customizability, and setup code as in the
EV3 would feel alien.
The EV3 version of the library is thus based on a set of default The decision to use a function getDistance() at a fixed port is
configurations. For instance, the two driving motors must be con- based on the desire to use the same library for other robotic devices
nected to the motor ports A and B, respectively. In order to allow such as the Maqueen [5], where sensor ports are not configurable. As
for more complex designs, it is possible to change the default con- the micro:bit [13] device severely constrains the amount of available
figuration and specify different ports for the motors. memory, we chose a design with a minimum of objects and memory
consumption. The same interface can thus be used not only to
States and Concurrency. In contrast to typical programs running control Lego EV3 robots, but other devices as well.
on a computer, robots are highly concurrent devices: different mo- Similarly, as pointed out earlier, the library assumes that the two
tors and sensors act independently of each other, and to some extent motors connected to the wheels are plugged into motor ports A
even independently of the central control unit. Moreover, this con- and B. It is also possible, however, to address them individually
currency as imposed by the hardware is necessary from the very via, e.g., motA.forward(). If the rotor is plugged into port C, it is
beginning on. Moving forward and turning typically requires syn- analogously addressed with, e.g., motC.forward().
chronisation of two driving motors. Likewise, stopping in order to Since motA, ls2, and so on are instances that were initialized by
read data from a sensor would lead to strange behavior. the grobot library, introducing them serves as a comprehensive
Consequently, we can regard each part of the robot as a small first step towards object-oriented programming after the basics
finite state machine (FSM). As a first approximation, a motor has have been mastered by the students.
261
Session: Creative Computing ITiCSE ’20, June 15–19, 2020, Trondheim, Norway
5 SELECTED EXAMPLES
While the workshop was built around Lego’s EV3 Space Challenge
Figure 2: On the left: a picture of the fourth design iteration with
Set, especially girls were more interested in creating their own
the pencil in between the two driving wheels. On the right: if the
challenges. Moreover, some students came up with very creative so-
pencil is not on the axis of the driving wheels, the pencil will follow
lutions for both the space set and advanced tasks we gave them. In
an exaggerated path when the robot is turning.
the context of this paper, “creativity” is to be understood as the gen-
eral ability to develop surprising ideas that are both understandable
and valuable in some way [4].
pencil would be pushed onto the ground through a series of rubber
5.1 Drawing Lines bands (Figure 2). Apart from very slight exaggerations of turns, still,
the result worked remarkably well.
Instead of attempting to solve the predefined Lego space challenges,
Despite proposals from tutors to use a felt pen with less need for
a group of two girls decided to follow up on the idea of turtle
pressure, the girls stuck to their pencil design and were quite eager
graphics and build their own “turtle”-robot for drawing pictures. We
to find an appropriate solution without “cheating.” Once a solution
encouraged them to go through with their own idea and provided
with the pencil had been found, they were quite happy to use a felt
them with large sheets of paper to draw on and any other materials
pen instead to get clearer pictures.
or advice they needed.
It was overall remarkable how the two girls not only found
Figure 1 shows a schematic view of the evolution of the girls’
an engineering problem they were interested in, but showed an
turtle robot. Their first attempt built entirely on the base model.
eagerness to first and foremost solve that problem instead of going
The two students attached a pencil to the predefined arm/lever of
with a simple quick-and-dirty solution to proceed with the actual
that model. However, despite various attempts to lower the lever
drawing part. Moreover, it is interesting to observe how they formed
as far as possible, no track was visible from the robot’s movements.
“rules” of what was permissible to solve the problem and would not
The girls determined that the motor had not enough power to exert
accept further aids unless there was evidence that the rules were
the required pressure on the pencil and thus replaced the motorized
not violated.
lever by a fixed arm, which led to a visible trace. Unfortunately,
the robot itself responded badly to commands and became almost
unmaneuverable with little actual motion. Through the pencil’s 5.2 Playing Sound
pressure onto the floor, the robot got slightly lifted and the two Whenever the EV3 robot starts executing a program, it plays a brief
driving wheels were only partially in contact with the floor, causing sound. This prompted one of the female students to ask whether the
too little traction. We hinted at an alternative solution where the robot could be programmed to play other sounds as well. Indeed,
pencil would be attached not in front, but at the back of the robot. our library includes a function playTone(f, d) that plays a sound
This would cause the supporting ball-wheel to lose contact with of frequency f for the duration of d milliseconds. As it is the central
the ground instead of the two driving wheels. control unit (brick) itself that plays the sound, this function blocks
Although the third design led to clearly visible traces while for the given duration.
maintaining the robot’s maneuverability, it turned out that it was We also provided the student with a table relating musical notes
difficult to control the pictures through movements of the robot. to frequencies, based on the 440 Hz for a. As soon as this student
The robot is capable of turning on the spot, but the centre of rotation had the robot play a first brief melody, almost all female students
lies necessarily on the axis of the driving wheels. With the pencil were highly interested in the necessary technique, playing sounds,
being that far out, any turning of the robot was visible in highly and having their robots “dance”. Unfortunately, due to the blocking
exaggerated form (see Figure 2 on the right). nature of playTone(), it was not possible to combine playing sound
The two students finally came up with a fourth design where with anything but the simplest of motions. In particular, the girls’
the pencil would be installed in between the two wheels for better attempt to have the robot “whistle a merry tune while working”
results. Based on the observation that they focused on having the failed as our library did not offer the necessary means. The use of
pencil somewhere between the driving wheels and not paying Python’s multi-threading libraries did not work out, either.
much attention to the actual axis, we are not entirely sure if they Due to the girls’ strong response to music programming, we
understood the underlying mechanics of why the pencil had to be asked them at the end of the workshop whether they would be
in the centre. Nevertheless, we encouraged them not only to further interested in attending a workshop on programming with music, or
pursue their ideas, but also to consider using materials beside plain whether they would even prefer such a workshop over the present
Lego bricks. Showing them how Lego’s own designs made use of robot-oriented one. All of them immediately agreed and confirmed
rubber bands convinced them to try a similar strategy, where the their strong interest in such a program. This is in line with findings
262
Session: Creative Computing ITiCSE ’20, June 15–19, 2020, Trondheim, Norway
Q2
5.3 Following the Line
As an initial exercise for steering the robot and reacting to sensor Q3
input, we discussed the problem of following a black curved line on
the floor. Program 2 shows the example program, where ls3 stands
Q4
for the light sensor attached to port 3. The light sensor returns a
value for brightness in the range between 0 (dark) and 1000 (bright).
leftArc(0.2) has the robot follow a circle to the left with radius Q5
0.2 m.
Q6
263
Session: Creative Computing ITiCSE ’20, June 15–19, 2020, Trondheim, Norway
Room for improvement is certainly given with respect to half of Loops. In order to properly work with sensor input, loops were
the students stating that the programming was rather difficult. We necessary. We therefore introduced basic loops from the beginning
attribute some of their problems to the difficulties and misconcep- on. As a matter of fact, TigerJython features a repeat loop that
tions listed in the following subsection. does not need any variables and makes using loops as simple as
possible. However, by looking at the students’ code, we observed
6.2 Difficulties and Misconceptions that some students seemed to not have properly understood loops,
After the introduction to Python programming and controlling the even though they were able to copy the overall pattern of programs
robot, the students were working on their own in teams of two. and modify them. For instance, a few students put all code into
During that time we had the opportunity to discuss difficulties, loops – if code was not supposed to be repeated, they just set the
ideas, and program code with them, and noted a few difficulties and number of iterations to 1. We were indeed surprised that even such
misconceptions that had built and were shared by several students a simple control structure posed a hurdle for some of our students.
(we did not conduct a thorough investigation of how many students
shared a certain misconception). The above observations indicate that students did not develop
proper mental models of how the robot executed their programs.
Ending the program. The command stop() immediately stops the In particular, the idea that the robot is built of several (semi-) inde-
propulsion motors so that the robot comes to a complete standstill. pendent parts seemed to be surprisingly difficult. Moreover, that
Several students, however, asked us how they could turn off the the robot consists of a central command unit running a program to
motors without ending the program itself and even explicitly said control motors seemed little understood.
that they understood that stop() turns off everything, including
stopping execution of the program. Difficulties using Python. We noticed only a single difficulty with
Python itself (rather than the design of the library). Leaving out
Multitasking. After issuing a forward() command, the robot
the parentheses after a function does not call the function. This is
will move forward until a new command addressing the propulsion
particularly problematic in assignments such as:
motors is issued, such as rightArc(). While the students seemed
to understand this concept, they were confused that turning on 1 d = getDistance
the third motor for controlling the arm did not lead to a stop of 2 if d < 20:
the propulsion motors. It seems that the students did not have a 3 ...
properly compartmentalized picture of the robot, but tended to where the variable d will have an actual value (a reference to the
regard it as a single entity. getDistance() function), but the condition afterwards will just
never be fulfilled.
Delay. The use of several delay() commands was necessary to
specify time intervals when the robot would continue running a
motor. We had discussed this command and its effect in quite some 7 CONCLUSION
detail, both in the context of robots, as well as when writing small We propose to use robotics in order to increase motivation and
animations. However, while the students had no problems using engagement in STEM fields, and computer science in particular.
the command, they exhibited difficulties in understanding its exact A key aspect of this is a tight integration of robotics with the CS
nature. We found that several students explained that each robot curriculum respectively the spiral curriculum, so that robotics is
command needs to be followed by a delay() stating for how long experienced as a natural part of computer science, and not as an
the given command should be executed. Hence, a sequence like isolated area of its own. Accordingly, we used Python to program
forward(); delay(1000) would have the robot move for exactly the robots during an outreach activity.
one second and then automatically stop it. Our experiences with robotics and the Python library show that
A group of two girls programmed their robot to play their fa- students have no problems using Python to exert basic control
vorite song, using the playTone() function that plays a sound with over the robot. However, several comments and questions from the
a given frequency and duration. One of the obstacles they encoun- students hint at various misconceptions. In particular, we surmise
tered were breaks during the song where no note would be played – that the students did not understand the concept of the robot and
a textbook situation for using delay(). However, even with several its parts as finite state machines, where commands describe state
hints, they did not make the connection but had to be explicitly changes instead of actions.
told to use delay(). Indeed, the two girls seemed surprised that Several groups of students showed some creativity in approach-
this worked. ing the given tasks, or even came up with their own challenges. Due
There is yet another serious problem with using delay(), which to space restrictions, we have only given a small sample of note-
directly corresponds to the battery charge and which is not endemic worthy student projects. However, the discussed examples indicate
to using Python as programming language. If the movement oper- that particularly female students enjoy working with sound, music,
ations merely rely on the specified time, forward(); delay(1000) and an artistic approach, as well as pursuing their own projects.
will lead to different results (i.e., distances traveled) depending on Despite the small sample size, this is in accordance with literature.
how full the battery is currently charged. This was particularly Future research will gain more insights into how the potential of
problematic when the students came up with correct solutions in robotics can be fully utilized to engage students for STEM subjects,
the morning involving moving forward a particular distance, and and how students might further benefit from artistic approaches to
wanted to present these solutions in the evening. computing.
264
Session: Creative Computing ITiCSE ’20, June 15–19, 2020, Trondheim, Norway
265