Fun with LEGO Mindstorms Programming
I've developed pbForth, a port of a rather archaic programming language, for the LEGO Mindstorms brick. The cool thing about it is that with a dumb terminal emulator that does ASCII uploads and can handle XMODEM (checksum) transfers, you can compile applications right on the brick! Yes, on the brick! When you are done, you blast S records back to your PC using XMODEM and then you can reload the app anytime using one of the standard firmware uploaders.
Check out pbForth for LEGO Mindstorms
pbForth got a whole chapter in the O'Reilly book, and it is getting more and more momentum as replacement firmware that busts the 32 variable barrier, and allows total cross-platform development without screwing around with building ecgs.
OK, I'm biased - I wrote it - but I think it's cool. Maybe some of you LEGO gearheads out there would like to try programming in something other than the native tongue. Learning Forth can make you a better C programmer. No, I'm not a Forth evangelist - I write embedded systems in C all day long.
Perl is NOT suited to embedded programming. Perl is huge. A Forth interpreter is tiny, and Forth bytecode is tiny. Forth was written for embedded systems.
Perl is best suited to larger systems, as a good method of tying together the extensive resources available on such a machine. It's just not suited to a tiny system.
Firstly, legOS is a really cool project. They've totally re-written the firmware for the RCX and built a fully pre-emptive multitasking environment running programs you can write in C or C++ and compile with a gcc cross-compiler. Very cool stuff, though the networking support (IR) doesn't seem very usable just yet.
NQC uses the standard firmware I believe, and is a bit more solidified. You write programs in a pseudo-C language and compile/upload it using the NQC utility. It also has some good IR message passing abilities.
Information about both of these can be found at LUGNET in the robotics section.
I experimented with LegOS a while back but ended up using NQC and a bunch of server-side Perl to build myself a telerobotic camera mount for my webcam.
There are definitely tools available out there for some extremely flexible Mindstorms programming.
As with any great toy, there are limitations, but here is the low down for thoes who dont know about this little toy yet...
Out of the box its a PLC type system with three in's and three out's... It comes with two motors, two on/off "touch" sensors and one ir sensor... It also has (but not talked about) its own built in IR sensor which it can use but requires using some slightly more advanced programming languages than the one included.
There are all types of Visual Basic programs available, but thats all I have seen so far. The lego site talks briefly about it I belive.
There are also add ons available for it... a heat sensor, a rotational sensor and of course more motors.
The toy is pretty nice, but really requires some patience engineering the remaining bricks to do what you want, and as always, if you dont have some legos already, you will want to go and get a few kits, because you will be limited despite the large quantity of bricks included.
Hope this helps clear some stuff up.
AF-Design, web development.
I was in the Penninsula Robotics Competition here in south eastern Virginia. We(my school's team) had to build a robot that would drive around a rectangular course and collect small white wiffle balls.
Programming for the Mindstorms robots isn't very hard. However there are many other problems with them.
For one you are only allowed to have three engines on a given mindstorms robot. I guess i should more accuratly say that you are only given 3 power terminals to plug your engines into, you may plug in more than three engines, but then two of them must go in the same direction.
Another problem with the mindstorms robots is that they don't allow much room for a "smart" robot, as you are only given 3 sensors (like the engines above you can plug in more than three sensors but then two of them must respond to the same stimulus).
Also the strength of legos in general is much worse when you try to put legos and a moving vehicle into one. Your building style will have to be entirely reformed if you plan on keeping your mindstorm alive for more than 10 minutes. The technic legos help with this a little, because they are longer and contain those neat axle shafts which we used liberally. But overall if you decide to change anything on the robot it will have to be entirely rebuilt for strengh/durability reasons.
The last major problem with mindstorms robots is that they cost way too much. For a kit including three engines, a bunch of legos, and one cpu unit(basically the bare minimum you can get by on if you want a robot that moves), it was > 500$.
At first I thought, oh, that's OK. That still involves problem solving and working with constraints, yes?
But what constraints! Forget any notion of building Rodney Brooks-like robots: You get three sensor inputs. Even if you were willing to spring for lots of extra-cost sensors, and used some clever multiplexing schemes, you'd be hard pressed to build an insect that could even know whether its legs were up or down, forward or back.
And seemingly simple robots have a way of using up the parts that come in the standard set. Once you've built a track following robot, what do you do with it? You've used up both motors. Similarly, once you've built an arm that can raise/lower open/close its claw, you've used both motors, both touch sensors, and most of the gears and structural pieces.
I'm afraid that I lost interest pretty quickly.
Here's a related topic to this whole Mindstorm business. I have a system that LEGO designed way way before the Mindstorms and even MIT's LEGO brick (which became the basis of the Mindstorms) called LEGO Technic TC. It consisted of a very simple 8-bit ISA card that connected to a black box with a ribbon cable. Basically it was a relay control card. The thing had 6 "output ports" that could either drive a motor forward and backward or operate a light. It also had two input ports for 1-bit touch sensors or optical sensors (or any other 1-bit sensor you could build for that matter).
The whole system was programmed in a LOGO (Remember that one, geeks?) environment called LEGO TC LOGO. It ran under DOS. I have been unable to find any control programs for this thing except for the stupid worthless DOS based LOGO.
Is anyone else still using this system? Is there anything for it under Linux?
~GoRK