The Unofficial Guide to Lego Mindstorms Robots
Last year, Lego released their Mindstorms Robotics Invention System. Using this, children and adults can build simple robots whose behavior can be programmed. The Mindstorms system is a major contender for Coolest Toy on the Planet.
The system contains a RCX programmable brick containing an H8/300 microcontroller, some pushbuttons, a little LCD display, and connectors for motors and sensors (light and physical contact). The user writes a program using a graphical programming language on his Windows box, and downloads it to the RCX via infrared.
Not surprisingly, substantial reverse engineering (1, 2) has been done by hobbyists, and it is possible to develop Mindstorms programs on a Linux box and to download the RCX brick from Linux.
Now O'Reilly has joined the Mindstorms fray, with a book full of fun and useful information about how to build and program Mindstorms robots. The book describes four different robots: Hank is a bumper car robot, Trusty uses light sensors to follow a line along the floor, Minerva has a movable arm, and two identical robots play a game called RoboTag. Along the way, the author discusses the physics and mechanics of robots, programming issues, and the available development environments for Mindstorms.
What's Good? There are detailed building instructions for each of the robots, showing photos at various stages of construction. The designs are simple and appear mechanically sound. There are discussion of the physics and mechanics of tank treads, steering, gears, and other things.
The book's chapters sequentially step through several different software development environments. The first chapter starts with the Windows-based RIS environment that comes on the Mindstorms CDROM. Later chapters give programming examples for NQC (Not Quite C), pbFORTH, Visual Basic, and the legOS operating system, which uses an EGCS cross-compiler to target the H8/300. There are more development platforms available, but these give a good sense of what's possible in Mindstorms programming.
The book has dozens of useful URLs, for both official Mindstorm sites and unofficial hobbyist sites. I particularly liked the fact that the author was aware of some of the recent research in robotics. For instance there is some discussion of Rodney Brooks' subsumption architecture, which is used for the RoboTag robots.
Later chapters of the book often expand on designs from earlier chapters, building more sophistocated robots in an accessible, incremental fashion. For the more adventurous hobbyist, the final chapter talks about building your own sensors and actuators, and how to connect them to the RCX.
What's Bad? Some of the photos are too dark and lack contrast. It would also have been nice if the photography had been in color, but black-and-white photos kept the book more affordable.This book is for the casual weekend robot-building tinkerer, and it never promised to discuss real-time embedded issues in depth. Still, a few topics might have merited at least brief mention. Systems with real-time multitasking must frequently arrange for synchronization and communication between tasks, using mutexes and mailboxes and the like, which brings the possibility of deadlocked processes. Another danger is that an aggressively efficient compiler will sometimes optimize away reads and writes to hardware registers. The fix is to declare such registers with the volatile keyword.
Review by Kurt DeMaagd
While Lego Mindstorms were officially released for a teenage crowd, they have become popular with a wide variety of technically competent people in many age groups. This widespread fascination has opened up a whole new world of opportunities for using Mindstorms. At the same time, the documentation and tutorial included with the Lego kits provide very little information about how to get the most out of the sets. This book fills the void by providing several start-to-finish robot designs, software to run them, and a wealth of other tips and tricks.
After a brief introduction to robotics and how Legos fit in, the author discusses the basics of using Mindstorms to create them. Both chapters present a problem, provide step by step building instructions, provide the necessary information to program the solution, and finally go into greater detail about the Lego features used to solve the particular problem.
While the chapters did an excellent job of presenting this information in general, they fell victim to a problem that would plague the entire book: some of the building diagrams were nigh unto unreadable. Attempting to build a robot based on fuzzy black and white photographs can be quite a chore. Fortunately, none of the robots were so complex that they robots were completely unbuildable.
The first few chapters presented robots programmed with the default RIS programming environment. In chapter four and following, he shows how to program using languages such as Not Quite C, Forth, Sprit.ocx for Visual Basic--or optionally Visual C++ or another ActiveX-aware language--and legOS. Since much of these sections was documenting API's, it was certainly not the most exciting read, but it does provide concise, easily to reference documentation.
Not Quite C, as the name implies, is a C-like language that can be used to program Mindstorms robots. It overcomes many of the limitations of the default RIS programming environment, most notably the lack of variables. One of its biggest advantages is that it does not require the user to install a new version of the firmware on their RCX unit. In general, it provides an excellent balance between power and usability.
The remaining three means of programming presented in the book are fairly mediocre options. PbForth requires the user to download a new firmware version, and the language itself is very archaic in modern software development terms. Using Sprit.ocx is a viable option for people used to programming in Visual Basic or Visual C++, but the control structures are very clunky and non-intuitive. legOS, while it is probably the most powerful option, takes a significant amount of time to set up and develop applications with.
Two of the projects referenced while discussing the various programming languages were particularly interesting, both of which outlined infrared communication. The first program creates a simple remote control for controlling a robot via the IR port on the RCX. The other example, perhaps the most interesting in the book, was creating two robots who played tag with each other. These two robots also communicated with each other via their IR ports.
The last chapter, targetted toward the hard core Mindstorms users outlined how to create additional sensors for Mindstorms. It sketched out such possibilities as a passive light sensor, a Hall effect sensor (magnetic fields), and a touch multiplexor (allowing you to have more touch sensors than normally allowed on the RCS unit).
In general, the book provides a vast array building and programming tips, tricks, and methods. He gives basic information for the person who is just starting, and introduces the advanced user to the vast network of people and product that have made Mindstorms far more than a child's toy.
Purchase this book at fatbrain.
Table of Contents
- Preface
- 1. Welcome to MINDSTORMS
- What is a Robot?
- Mobile Robots
- What is MINDSTORMS?
- What Now?
- Online Resources
- 2. Hank, the Bumper Tank
- About the Building Instructions
- Building Instructions
- A Simple Program
- Wheels
- Bumpers and Feelers
- Gears
- Multitasking
- Online Resources
- 3. Trusty, a Line Follower
- Building Instructions
- Some Tricky Programming
- The Light Sensor
- Idler Wheels
- Using Two Light Sensors
- Online Resources
- 4. Not Quite C
- A Quick Start
- RCX Software Architecture
- NQC Overview
- Trusty Revisited
- Online Resources
- 5. Minverva, a Robot with an Arms
- Building Instructions
- Programming
- Directional Transmission
- Pulleys
- Mechanical Design
- Two Sensors, One Input
- Where am I?
- Online Resources
- 6. PbFORTH
- Replacement Firmware
- pbForth Overview
- About Forth
- pbFORTH Words
- An Expensive Thermometer
- Minerva Revisited
- Debugging
- Online Resources
- 7. A Remote Control for Minerva
- Two Heads are Better Than One
- The Allure of Telerobotics
- Building Instructions
- Programming the Remote Control
- Programming Minerva
- Online Resources
- 8. Using Sprit.ocx with Visual Basic
- You May Already Have Visual Basic
- About Spirit.ocx
- Calling Spirit.ocx
- Immediate and Delayed Gratification
- Programs, Tasks, and Subroutines
- Tips
- Retrieveing the Datalog
- Online Resources
- 9. RoboTag, a Game for Two Robots
- Building Instructions
- Subsumption Architecture
- Online Resources
- 10. LegOS
- About legOS
- Development Tools
- Hello, legOS
- Function Reference
- New Brains for Hank
- Development Tips
- Online Resources
- 11. Make Your Own Sensors
- Mounting
- Passive Sensors
- Powered Sensors
- Touch Multiplexer
- Other Neat Ideas
- What About Actuators?
- Online Resources
- A. Finding Parts and Programming Environments
- B. A pbFORTH Downloader
- C. Future Directions
- Index
(RCX is the programable brick)
amazon.com has it for $199.99, and I think I've seen it at retail for the same price. (I'm a bit disappointed at amazon here - I'll have to try eToys).
D
----
If Slashdot readers gave feedback to Lego, and showed them that a significant number of Lego Mindstorm (and Lego, in general) users use Linux, it's possible Lego might be a bit more active in supporting the OS.
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
I'd like to second the idea that this book is an introduction to Mindstorms. It does have a lot of useful references, and serves as an overview of What You Can Do with Your Mindstorms. There's not a lot of time spent on any one topic.
It would be nice to have another couple of chapters on more advanced topics ("Common Traps and How To Avoid Them", "Cool Hacks You'd Never Think Of", "a Beowulf Cluster of Mindstorms"). It's a good introduction, but don't expect a LEGO Camel.
--
how to invest, a novice's guide
This has to be quick, but- for anyone who uses Linux, legOS is not at all difficult to setup or maintain. John Knudsen is a good guy, but he (and the target audience) are windows users. If you can get RH running, you can get legOS running. It is easily the best way to use the Mindstorms from Linux. Check out the homepage or my HOWTO.
~luge (use it before you criticize, guys...)
IAAL,BIANLY
I haven't updated the web page in quite a while (other projects; you know how it is....). But take a look if you're interested.
--
I'd love to buy Mindstrorms for my kids (OK for me too .... but you see I'd have to 'buy it for the kids') but the big problem seems to be platforms - we're a Mac/Unix house, Windows was banished as neither kid or adult friendly
I believe you can run the robolab software in MacOS (robolab is the version of the mindstorm soft for schools) And if you can do C, legOS is the way to go...
MIT has a nice version of Logo that both has a GUI and is a complete, powerful programming language. I'm not sure if it runs on MS Windows, but definitely there's a Mac version. It's available to educators, but unfortunately not to anyone else.
--
The one advantage that Legos have at this point is the MindStorms. K'nex only have a motor at this point which will "spin" pieces in a few different directions, but with a little creativity they are just as fascinating.
I hope someday to have a web page with my K'nex creations, but until then the only decent site I have found yet is at http://www.balmoralsoftware.com/knex/ knex.htm
Sorry, if this is too far off topic, but Legos seems to get a lot of press where K'nex have yet to be mentioned. Kinda like the Linux and Windows...
Imagination is the foundation of reality -Gallagher
--
Mac NQC works on PowerMacs and works with most USB serial widgets. Mac Robo Lab is ok, but hard to get outside of the USA.
Using Emulation (VPC etal) and MindStorms Software on the Mac you will need get or to make a Powered Break-Out-Box.
Quick Hardware notes:
Yellow RCX 1.0:
The Original and the Best. Get a 1.0 box if you can and upgrade to 1.5 later. As said already 1.5 missing Wart-power.
Blue RCX, aka Scout:
OK, has a remote, missing an Output and has Internal LightSensor Block. Great with a MicroScout.
MicroScout (Droid Kit):
Best "Out of Box to Play" time of the whole line. 6 Hard Coded programs and no user program space. CD is a Building Guide and no IR tower.
Have fun
PS: RCX owners get Free Web Page on Lego Site. (for lego releated only).
Yeah, the price is pretty fixed at around $199. On the other hand, if you already have a ton of technic pieces (gears and such) and don't mind not having the official lego software (which is lose95/98 anyway) you may be able to save a little bit by getting the RCX unit and sensors separately. Try the lego world shop. I'm pretty sure they have them separately.
As for software, well, with Linux you are pretty much stuck with PBForth or legOS. Both of those are going to require a language (forth or C, respectively) but are going to be much more powerful than the standard software.
~luge
IAAL,BIANLY
Don't get fooled by the scout, either. Again, cheaper, but connectivity to the computer is limited at this point (though Lego appears to have hidden more than a few tricks in it's software.) If you can at all scrape up that extra hundred bucks, buy the "real" Mindstorms RIS instead.
~luge
IAAL,BIANLY
The difference is purely software- the HW is identical (unless you buy a big package intended for large groups of students, but IIRC that is on the order of a thousand bucks.) And it is, of course, Windows-centric (don't recall if it runs on Mac or not.) If you want Linux, PBforth and legOS are the way to go.
~luge
IAAL,BIANLY
I've read Mobile Robots (very good book!) but have not actually constructed anything in there. The big differences are going to be ease of use and flexibility. If you are handy with a soldering iron, then the Mobile Robots DIY approach shouldn't be too intimidating. (Don't know anything about Linux support on the SW side, though.) It is also far more flexible- the RCX limitations of three inputs and three outputs gets very chafing very quickly. OTOH, if soldering irons sound dangerous to you :) or you want to get results NOW, then RIS is for you.
~luge
IAAL,BIANLY
--
I had the chance to play with the Lego Mindstorms system earlier this year...the IR port on the RCX has a maximum range of 1.5 meters. This got me thinking...what about programming a team of, say, six Mindstorms to behave as a team? I'd certainly like to see any research someone has done on this....
The Kulturwehrmacht
Finding God in a Dog
There are several kits available from The LEGO Company (TLC) which let you build Mindstorms-style robots; the Robotics Invention System (RIS, the Mindstorms 'basic' set) the Robotics Discovery Set (which has the 'Scout' microcomputer instead of the RCX that comes in the RIS; the Scout doesn't require a PC for you to program it) and the Droid Developer Kit (which has yet another 'Scout'-style programmable brick). These are the three robotics kits available from The Lego Company .
Available from Pitsco/DACTA is the RoboLab, a LEGO robotics kit aimed more towards the Educational sector, primarily as a teaching tool for educators looking to teach scientific-minded youths the joys of programming and the wonderment that is robotry. It's available from PITSCO/Dacta. I've ordered stuff from them online without having to prove if I'm an educator, but YMMV.
I've had the Unofficial Guide to LEGO Mindstorms for a month now, and my cats are starting to think I like my robots (Clumsy Pike and Hovis) better than them (Hydrox and Pork Chop, so they don't get jealous)(I think they've got FELUX running on my PC).
I hope that this is of some use to someone looking for the perfect gift for that geek on their Christmas list.
-The Cheese, who's next plan is to RULE THE WORLD!
PS; LEGO also sells a wireless IR remote for controlling the RCX.
PPS; Check out the online resources at LUGNET .
I would have to say it depends on where your interests lie.
I used Mobile Robots when building a robot for a competition in a 4th year engineering project. It was a two-person team, so I developed a lot of respect for how hard robots are to build.
I also own a Lego Mindstorms kit.
I would have to say that Mindstorms provides a much more solid base to build on. You can spend a lot less time getting electronics to work and a lot more fun doing the (IMHO) fun part - programming the behaviour, etc.
Of course, if your interests are more in the electronics (putting the board together, building your own sensors, etc.) then you might want to go the do-your-own route outlined in Mobile Robots.
Do you even know anything about perl? -- AC Replying to Tom Christiansen post.
I knew this sounded familiar!
GCSE Information Systems, 1995. I had to play with some robotics, and we did this all with Lego running through Control Lab (I think - memory's a little hazy) under MacOS 7. Gave us lights, motors, rotation sensors, temperature sensors, light sensors and push switches. Programmed in something that I remember looking like a weird BASIC derivative. We made a greenhouse with a temperature regulation system - it was the original assignment, we just went thoroughly OTT on it! Others managed some really fun stuff like automated carwashes (well, simulated models... you get the idea!) , so it was a fairly powerful system. Not ideal, by any means - I remember being frustrated that I couldn't interrupt things - but it worked.
Would this be the same system, by any chance?
Greg
Greg
(Inside a nuclear plant)
Aaaarrrggh! Run! The canary has mutated!
The Scout has only two inputs and two outputs (compared to the RCX's three apiece) but doesn't require a PC or IR tower (the IR tower is part of the RIS) to be programmed. The RCX requires that you compile your software on your PC or Mac (the RIS only provides cabling for connecting the IR tower to an 8-pin serial or [using the provided adapter] a 25-pin parallel port, but Mac adapter cables are available from PITSCO/Dacta) before downloading it to the RCX. The Scout can be programmed using the on-screen display and menus.
I would recommend the RIS with the RCX for anyone who wants to get into the guts of the matter, as this will allow you to choose your programming environment, rather than be locked into the built-in environment of the Scout.
-Cheese, who really does have a real job.
The difference is *not* purely software; the Scout has two inputs and two outputs, whereas the RCX has three apiece. Also, the Scout is programmed from onboard, onscreen menus. The RCX is not.
The Cheese
Nitrozac Boot Squad
I think that the Robolab software has been reworked since then, and includes a variant of the Mindstorms software, which is _very_ object-oriented. Mac adapter cables for the RIS's IR tower are available from PITSCO-dacta .
The Cheese
Nitrozac Boot Squad
palm - palm development for Lego mindstorms
robotics - talk/problem solving about programming, building and designing robots in lego
a unique feature of LUGNET is the three way interaction between newsgroups using news (nntp), email (using smtp) and the web (using http). You can interact/subscribe through LUGNET by any of the above protocols and the discussions are simultaneously readable via news, web or email.
peterrenshaw ~ Another Scrappy Startup