Bachelor Thesis: Simulating Lego Mindstorms

Damn, I haven’t updated this in a long time, have I? Don’t worry, though, I will now post more here, as I have found a good topic: My bachelor thesis, which I recently started working on. Let me introduce you to it.

![The topic: Lego Mindstorms Roboter.](/bachelorthesis/originalrobot.jpg)

I think Lego is fairly well known. For a few years now, they have been offering a set and system that allows you to build robots with it, known as Mindstorms. The most current version is Lego Mindstorms NXT 2.0. It is great and it has also found a place in teaching programming. In particular, at RWTH Aachen, there is the [go4IT!][go4it] project by [Computer Supported Learning Research Group][cslrg], where children in 6th and 7th class learn the basics of programming in workshops with robots build with Mindstorms.

That is great and all, until the workshop ends. Then, however, the negative side of Mindstorms rears its ugly head: The suggested retail price is about 300&euro. You can find it cheaper (I got mine from Amazon, more because I wanted it than because I needed it for this thesis), but I doubt you will find a new one for less than 250&euro. That means most of these children can no longer program at home or in school once it is over. And that is where I come in.

Sorry for the low quality, I seem to have left my compact camera in Goslar and my DSLR wasn’t expensive enough to shoot video, so the “real” part comes from my iPhone.

I am writing a simulator for Lego Mindstorms NXT 2.0 robots[^1]. The goal is that you write your program the same way as for the real thing, including the same compiler, but instead of downloading it to a piece of plastic, it gets executed in the simulator on your own Windows or Mac OS X computer. It gets better: The final version will include network support, so many people will be able to have their robots run together or against each other like a multiplayer game. In my opinion, that will be the most challenging part, but not impossible.

[^1]: Only one robot. This is not about building virtual Lego models.

And it works nicely so far. It does not support a lot yet, and won’t ever support everything the real Mindstorms can do (remember, this is meant as a teaching tool for children only), but it has a landscape that is easy to edit, working collision detection, a 3D robot and most importantly, it can execute simple programs.

Personally, I love this project, because I can re-use just about everything I ever learnt about programming. After all, it is in many ways the same as a game with bad graphics, which is my speciality. [Weird binary file formats][trposer]? Check. [Cross-platform programming in C++][hubi]? Check. [3D graphics with OpenGL][snow]? Check. [Network gaming][hubimulti]? Check. I am not allowed to re-use code, but I can re-use previous knowledge, so I am really excited to be doing this. Oh, and I am also a huge LEGO fan. Watch this space (or rather, the RSS feed) for more in the future.

I will be giving a start-up presentation next thursday, at 10:00 AM, in the chair’s seminar room, telling more or less the same as here (though probably with more technical detail), but I am not really sure whether externals are allowed as well. I’ve also written an [official proposal][proposal], which also contains more technical detail, and an official [page for the thesis][thesis], which contains no really new information at all.

Written on April 19th, 2010 at 01:48 pm


  1. Posted 4 July 2010


    (I linked here from dA)

    I have just finished a 3 yr diploma in Automation & Robotics - emphasis was on fluid power and PLCs, but I studied microcontrollers as well. My final project was a two legged robot that avoids obstacles; the software was written in ladder logic (primitive!) - my partner and I spent most of our time machining parts (right down to brackets and pins) and soldering up the controller, so I did not have time to program the inteligence I had originally intended.

    Mindstorms is expensive, however, many microcontrollers are not. The PICaxe is programmable in BASIC and easily embedded in a small robot. I used a CUBLOC (Atmel-based), I may also try an Arduino (also Atmel-based).

    There is interesting research going on with swarm robotics - lots of little robots sharing information to achieve a common goal. I see some overlap with the virtual robot environment you are creating.

    I wish you the best in your work!

  2. Posted 4 July 2010

    Torsten Kammer (admin)

    What you mention there sounds very interesting!

    Mindstorms is of course very good for teaching, since Lego solves that problem of machining the parts you have. For price, though, yes, there are far better solutions - and more versatile as well, since anything that can’t be done with Lego is going to be a pain to do with Mindstorms.

    Swarm robotics for this simulator? I guess that could be done. I’m not sure how useful it will be (a dedicated simulator for simpler swarm robots might be more useful), but at least for an introduction in the area it might work.

  3. Posted 4 July 2010


    I think your project is a great idea: far better for children to be introduced to programming with a virtual robot (fun!) than to sit down and write code to print "hello world" on the screen ad nausuem (boring!)

    A long time ago (ahem), many children were introduced to computers by programming in LOGO.

    Anyhow, what was the connection I saw between your simulator and swarm robots, you ask? In a simulator, a large swarm is no more expensive than a small swarm, therefore behaviour algorithms can be tested before being committed to hardware. For some applications, a detailed environment might reveal behaviour not seen in a simpler one.

    Example: LANdroids
    These are wireless LAN relay devices being developed by DARPA. Will they be as effective in a sewer system as they are above ground? Answer: run a simulation

    Have fun!

  4. Posted 5 October 2010

    Ursula Weinmann

    Did you finish the software by now? I would be pleased to test or buy it.


  5. Posted 1 September 2011


    Möglicherweise doofe Frage:

    Wie kommt denn ein Programm aus der NXT 2.0 IDE auf den Simulator? Der weigert sich bei mir, rbt bzw. rbtx Files zu lesen...


New comments can no longer be posted because it got to annoying to fight all the spam.