Slashdot Mirror


Core Lego Mindstorms Programming

dr_skipper writes: "In the preface of Core Lego Mindstorms Programming, the author compares the Robotics Invention System to the first mass production automobile, the Ford Model-T. This put millions of cars into the hands of ordinary people, and kick-started an industry. Whether this kit will turn out to be the equivalent of the model-T of robots remains to be seen. We already know millions of these kits have already been sold, so at least it has the potential to capture a huge number of people into robotics that never would have ventured into it in the first place. Maybe someday we'll hear stories from robot engineers telling how they got their start with the Lego Mindstorms kit. Before Mindstorms there were lots of do-it-yourself robot kits that were usually a little sketchy. The promises often outweighed what was delivered, and it was never guaranteed that once all the transistors and capacitors were assembled that it would even work. Mindstorms has overcome this and caught on in a big way, as evidenced by the staggering robotics creations that are popping up on websites all over the Internet." The rest of John's review is below. Core Lego author Brian Bagnall pages 560 publisher Prentice Hall PTR rating 10/10 reviewer John Delisle ISBN 0130093645 summary Fantastic book - Covers robot construction, programming and much more!

The Mindstorms kit is for those people who have always wanted to play with robots, but couldn't find any time between work and home. In short, its a kit tailor made for programmers, not for those people with Mensa level IQs who know how to build an H-bridge circuit or a voltage regulator from scratch. Probably the easiest and most understood programming language right now is Java, and that is the language this book focuses on. The book introduces leJOS, which is a Java Virtual Machine (JVM) and operating system rolled into one. It's the first JVM I've seen to run in the tiny space of only 32kb. As lore has it, back when Java was known as "Oak," it was meant as a language to program small appliances such as remote controls, microwaves, televisions, VCRs and other household electronics. In all that time I've never seen Java actually used in such small devices until now.

This book starts out slowly, for people who are just cracking open the box. It gives a complete, in-depth overview of the hardware, as well as the included software -- which the author basically advises you toss away if you have any interest in serious robot programming. Surprisingly (or perhaps not surprisingly) the tiny RCX brick contains as much horsepower as the on-board computers for the Apollo moon missions. The brick contains 32kB of RAM, which seems small at first but when you realize the memory older computers like the Apple II and TRS-80 had, this is an ample amount. Some of those older games had a lot going on in terms of AI and graphics, so for robot applications without graphics it's a lot of memory. In the spirit of Bill Gates, 32kB should be enough for anybody. There are also some good (though prohibitively costly) third-party sensors that, if you owned them all, would give you most of the sensing abilities that old Spock had with his tricorder.

leJOS is a product of Sourceforge, and quite popular. The leJOS language, which is essentially Java with some cut-backs, is covered in depth. It has most of the features of the real Java language, barring object reflection and garbage collection. I haven't heard of any official "smallest JVM" contest but if there was one I'm sure leJOS would be one of the contenders. It definitely surpasses Sun Microsystems J2ME in the micro category. Setup is fairly straight forward and the author even includes a free IDE that works great with the leJOS.

Once past the introductory material, the book contains some truly interesting projects. In a way, the book is similar to the general robotics book Mobile Robots: Inspiration to Implementation (Jones, Seiger, Flynn), except it's for the Mindstorms crowd. There are many robots to build, including a wall-following robot, a robot that navigates with a real compass, a robot you can control from a web page, and some surprisingly in-depth hacking tricks. Unlike books which only give suggestions on how to build robots, this book includes complete building instructions and code listings for every project. The fact that Lego parts and RCX bricks (the processing center of a Lego Mindstorms robot) are identical to each other allows this to be possible. It contains not just 'how to' information, but expands into robot theory as well. Books such as Mobile Robots have to be general and ambiguous at times because the authors don't know what kind of parts a reader will be able to obtain. In a way, this is the genius of Lego Mindstorms - the ability for people to pass robot recipes to one another.

The final two chapters really kick the leJOS language into overdrive. These sections are where geeks thrive. Chapter 11 deals with connecting the RCX brick to the Internet. Apparently the leJOS language has built in classes for sending data, and even a handy Java bean that's useful for embedding JSP web pages. These projects are described down to the last detail, including showing how to set up a free Resin server to serve the web pages. Unfortunately the author does not take the time to explain much of anything with JSP, so beyond his JSP examples you may not get very far. Readers will be forced to look elsewhere if they want to learn more about JSP.

The final chapter really goes hard core. It contains some so-so information about how to hack leJOS, changing classes or removing methods to save memory. The real kicker is a feature of the leJOS JVM I was not aware of: leJOS is capable of running almost ANY language. Apparently even the official JVM is capable of running a multitude of third-party developed languages, including Fortran, C, and weird custom languages such as IBM's NetRexx. All that's required are the development tools to compile the source code into Java bytecode, and these compilers exist in abundance. There are no fewer than 100 such available languages, all free for the downloading.

Illustrations in the book are frequent and helpful, but somewhat plain. Usually they consist of line drawings without much artistic merit. The 3-D renders of the robots are exceptional, however. Each step in building the robots has been rendered, making the Lego parts very easy to see. The steps are well laid out, and the new parts for each step are suspended in the corner and labelled. Thankfully, all models in the book can be built with any version of the Robotics Invention System kit.

If you are a programmer who has an impulse to experiment with robots, but don't want to get solder on your fingers building from scratch, this book will get you to where you want to go. And if you do want to get some solder burns, there's even a few projects in here just for you. Overall the book is a joy to read. The author obviously loves robotics and his enthusiasm shows on every page. The tone is loose but contains a lot of detail presented in an easy-to-digest manner. If you want to dabble in robotics then Lego Mindstorms is the easiest way to do it and having this book is a good way to get started.

You can purchase Core Lego Mindstorms at bn.com. You can read your own book reviews in this space by submitting your reviews after reading the book review guidelines.

3 of 108 comments (clear)

  1. imprecise hardware... by kisrael · · Score: 4, Insightful

    I only played a little bit with the first generation they released, and only using that bad visual block language it came bundled with. But one problem I see is that you couldn't specify exact degree turns or amount of motion consistently. For instance, there'd be no way to make a robot that consistently turned 90 degrees and went forward X inches; you're forced into a more biological, reactive method of programming. That's not an entirely bad thing, though it ramps up the level of difficulty, especially in that original block language, don't know about these later ones.

    --
    SO YOU'RE GOING TO DIE: The Comic for Dealing with Death
  2. Re:Robots were HUGE in the 80's by coryboehne · · Score: 2, Insightful

    Human labor (so far as the present time) cannot be replaced in many jobs, there is simply currently no way to program a robot to respond to all of the problems that may arise in just about any given "real-world" situation. The thing we need to worry about is how to effectively manage and balance human and robotic labor.

  3. Re:Robots and Complexity by Uberminky · · Score: 5, Insightful
    I've been interested in robotics since I was a kid (I'm 21 now). Where I grew up, I didn't have access to resources like Radio Shack, or well stocked hardware stores. (Mail was about 2 weeks each way.) I tried to do what I could, reading all the books I could find. "Robot Builder's Bonanza" was an awesome book, which gave me many ideas and helped give me a foundation. But as you say, there were no books for the middle ground. I still didn't know jack about robots, when it came down to it.

    Here is my tip for you. I know it's lame and obvious, but still: find other people that are working on this stuff. When you have a real question, no book will answer it. You can only answer it one of two ways: working your butt off for unreasonable amounts of time (what I was forced to do), or asking someone who knows. No online forums, none of that -- real live people. And then, it takes work. Lots of work. And time. (And money. Ack!)

    how much will Lego Mindstorms help me in learning how to create more complex interactive robots?

    I like MindStorms because they get kids and other people involved with robotics that otherwise wouldn't be. You can presumably learn a thing or two from them. But for people actually interested in learning real things, I'd say it doesn't take you far. You learn about gear ratios, great. But where do you buy a gear? What pitch should it be? How does the rotation sensor work? How will you learn about back-EMF and how to protect your circuits from it? Maybe I'm just biased, but I think it doesn't teach you so much, as it lets you play with hardware without investing time to do it. (I've always been convinced that the real value of MindStorms was the LEGO blocks, not the microcontroller at all.) Mindstorms are great. Get excited about robotics with them. Then get off your lazy butt and make it to the club meetings! ;)

    I've been working on some things for the new members of the Indiana University Robotics Club for next year. Kits and things that will let anyone get started building robots from scratch, for cheap. But even that will only take people so far. If you want to move past the kits, you need to learn a little about electronics. (This book is awesome: Practical Electronics for Inventors.) Find people with the same interests to work on projects with, and find people you can ask questions. Then start on a project, and learn everything you can. This WILL take time.

    Robotics is hard. There are ways to have fun without getting far into it (like MindStorms). But if you want to really learn, you need to find people to help you, and you need to invest time learning.

    <beating dead horse>

    --

    The streets shall flow with the blood of the Guberminky.