ROBOT: Software architectures for robot programming, 2009

A Computer Science course given in the spring semester of 2009 at Roskilde University by Henning Christiansen.
General information Course material Software Hardware & teamwork Written assignments Schedule

General information

Robots are fun to play with, and we will work with Lego Mindstorms NXT robot sets. This means that we can get into the programming issues very quickly as basic mechanical problems are solved for us already.

Of course, this course is not (just) about playing with Lego, rather it is about software architectures, which may be useful for all sorts distributed or pervasive systems which contain subsystems with some degree of autonomy. - Don't expect that we will get to the point of producing fantastic humanoid robots or cope with difficult mechanical challenges. However, payable robots for use in households, as toys, at hospitals etc. become more and more widespread, so we may expect more and more jobs for which experience with robot programming in itself is of interest.

We will concentrate on robots that are more or less able to manage themselves in order to move around, avoid obstacles, etc., and perform various practical tasks. However, they should also be able to act according to an overall plan or approach tasks specified outside the robot, e.g., from a server.

For the first part, we will use a paradigm called "behavioural robotics" which may provide a robustness in the sense that the robot does something in case of unexpected events or if it looses the contact to its server, instead of just getting stuck.

We may combine this with a client-server architecture with more or less control provided by the server, and possibly also communication and cooperation between the several (or maybe cooperative robot behaviour via a common server).

We will start using the software and programming language provided by Lego in order to get familiar with the robot hardware and basic issues concerning sensors, motors, simpel behaviours etc. Next, we will shift to using leJOS which is a Java based system, so that we may program both the NXT brick as well as server functionality in Java.

Course material (preliminary list)

A note on the software

Lego's Mindstorms software runs well and is easy to install in Windows and Macs (however, you teacher experienced problems with Mac OS X 10.5, whereas 10.4 works smoothly). Bluetooth is essential.

The leJOS system works on Windows, Mac and Linux and may require some technical fighting to get installed. Be aware that we have no expert technician associated with the course, so we need to help each other with such issues. Your teacher's experience indicate that the installation on Windows is fairly straightforward, and helped by an installer program; however, there may small bugs in the scripts that calls the Java compiler, so one have to make small corrections before it works. For Mac, things are more tricky, a lot of other stuff needs to be installed as well, not all combinations of versions will work, you will have to fiddle around with system variables etc. etc., so this may in practice be very difficult. Notice that the pages in the Tutorial concerning Mac and Linux are missing, but when you download the files, you can find more information in the "doc" folder. In an installation on Mac OS 10.5, both the USB and Bluetooth had problems. Your teacher did not try it under Linux.

Documentation standards for Legos's software, leJOS and other possible software that we may need, is often so-and-so, and you must be ready to experiment a little to find out.

A note on the hardware and teamwork

We will have a number of standard sets of Lego Mindstorms available, and we expect 2-3 students working together per set, and on the same small application. It will be practical if you bring your own laptop on which you are willing to install the software, but otherwise we will find the needed computers; notice that Bluetooth is needed.

A note written assigments

By the end of the course, students are expected to have described principles for a specific architecture illustrated by a running application. In fact, the application need neither be impressive, artistic nor complicated; a minimalist approach illustrating the basics of the a software architecture is the best you can aim for.

We will try to organize this into written sub-assignments during the course as to avoid a large burden in the end of a course. Two to three students may work together (preferred, actually!), but each student must give in individually written assignment and be ready to give a overview presentation for the exam.

BSCW server

Link to the bscw folder available to the participants of the course. Here you can upload you own, and find your fellow students' solutions to technical problems, and some additional documentation has been uploaded as well.

Course schedule

Unless otherwise announced, the course runs on Wednesdays, 9.30-12.00 and 13.00-15.30, in Room 43-2.29. First course day is Feb 4 and the last one planned April 15. We plan also to invite one or more guest lecturers who work with robots in practice and who may provide inspiration for subsequent project work.

1 Feb 4 Opening the box
Building a Lego robot and developing a little robot program according to the directions in the box,
-- and a bit of general introduction to robotics
Lego Mindstorms, getting started (Included in the Mindstorms base kit box)
Lego Mindstorms User Guide (Included in the Mindstorms base kit box)
Background (noncompulsary):
Wikidedia on Lego Mindstorms NXT
Wikidedia on "Robot"
2 Feb 11 Introduction to behavioural robotics
Programming simple behaviours Legowise
- [Jones] Chapters 1 and 2
- [Boogaarts et al] pp. 9-13 (if you have Lego's software available, you may also look at the help function as explained in the text).
Exercise: Implementing a simple behavioural robot using Lego's graphical programming language (pdf)
Written assignment 1: pdf
3 Feb 18 Opening a more complicated box
Introduction to leJOS; installing it on your computer and testing it (hello world level, and with a bit of luck, trying to redo the exercise from last week, but now with leJOS.)
We will be assisted by Donald Axel this day, to overcome the technical problems.
[leJOS] Take a quick reading of the entire Tutorial and make yourself an overview.
Read in details the first three sections (1 2 3) plus 'PC GUI Tools', and notice also the 'Hello World' program hidden at the bottom of the page 'Getting Started on Microsoft Windows'.
Exercises: See Slides
Feb 20 Deadline for Written assignment 1 Assignment text
4 Feb 25 Preparing for advanced applications: Behavioural robotics in leJOS
... and opening up for communication with the robot
- [Jones] Chapters 3 and 4 ⇐ Mistake; changed 23. feb :/
    (Chap's 1 and 2 were incorrectly stated)
- [leJOS] Section on Behavior Programming; review also section on Communications that we will use in the exercises. - leJOS' PC API (only technical documents available)
Exercises: Behavioural robot with leJos, and a bit more (pdf)
5 Mar 4 Fighting with leJOS, getting the communication facilities to work
We found out last week that it does not work by itself when we write "import lejos.pc.comm.*;" in our programs.
If, as part of your homework, you find out how to compile and run such programs, please communicate to the other students (or your teacher).
A sample file,, that you can find buried deeply in the files you have downloaded, gives some hints. With the right environment variables, your teacher succeeded in compiling with javac but not in running.
See students' solution on the bscw server!
- [Jones] Chapters 3, 4, 5
- [leJOS] Section on Communications.
Exercises: Continue with exercises from last week
6 Mar 11 Getting the last parts of the communication stuff to work + starting the larger assignments/group works for the rest of the course
Read the document referenced to the right, make your own opinion so that you can contribute to the brainstorm.
Ideally, everyone knows his or her task for the assignment by the end of the day.
- [Jones] Chapters 6-9; you may spread your reading over the next two weeks; don't expect lectures given as the material is not difficult and is fairly easy to read, but the text is very useful background for what we are doing and will be doing the coming weeks
- Notes on the forthcoming written assignments: Work on a particular software architecture
What may be left over; if you have time, write two small robot programs in leJOS in which robots send messages to each other. For example, make robot 1 move a random distance and then stop; then robot 2 does the same thing; and so forth.
Written assigments 2+3 ⇐ New 11-mar-2009
7 Mar 18 Working with your assignments 2+3
Guest lecture: Søren Tranberg Hansen from Teknologisk Institut, Center for Robotteknologi will give an overview of TI's activities in robotics and with a special focus on his own personal research.
Schedule: ⇐ Changed 17-mar-2009
9:30-10:00: Status of possible, technical problems
10:00-11:00: Guest lecture
11:00-12:00, perhaps continue in the afternoon: Presentations by the groups. Each group must give an overview of the task, they want to solve and which technical challenges they expect, and how to solve them; if possible, present the overall structure of the software architecture that you aim at.
Afternoon: Continue with the assignments
8 Mar 25 Working with your assignments 2+3
and perhaps guest lecture
Mar 31 Deadline for written assignment 2
Assignment text
9 Apr 1 Working with your assignments 2+3
and perhaps guest lecture
10 Apr 8 Working with your assignments 2+3
and perhaps guest lecture
11 Apr 15 Presentation and demonstration of your robots
April 22 Deadline for written assignment 3
Assignment text
June 8 Oral exam

Last modification 21-april-2009, Henning Christiansen