Core Lego Mindstorms Programming 108
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.
Robots were HUGE in the 80's (Score:1, Flamebait)
How many robot companies went belly up from 1980-early 90's?
Re:Robots were HUGE in the 80's (Score:2, Insightful)
Re:Robots were HUGE in the 80's (Score:2, Informative)
Re:Robots were HUGE in the 80's (Score:2)
Being as it's early and I'm quickly skimming posts, I first read that as "bashing their new controls on XP or CE" and had this image in my head or robots being so fed up with their host computers... well, you get the idea.
-
Re:Robots were HUGE in the 80's (Score:1)
Re:Robots were HUGE in the 80's (Score:2)
Re:Robots were HUGE in the 80's (Score:1)
Re:Robots were HUGE in the 80's (Score:2)
And so they did to a great extent. Have you ever seen the assembly line at any auto manufacturerer? Just because a robot doesn't walk on two legs and push a vaccuum doesn't mean it isn't a sophisticated robot.
Re:lego robots still not as cool as... (Score:1)
Google is usually pretty good at finding these things as well.
imprecise hardware... (Score:4, Insightful)
Re:imprecise hardware... (Score:1)
Re:imprecise hardware... (Score:2, Informative)
The sensors count 16 ticks/rotation...just change the gears to make it count 160 ticks/rotation or 1600....the accuracy is there for anything you make with lego.
Re:imprecise hardware... (Score:3, Informative)
This may mean, as said, the difficulty is ramped up a little - but the effect will be that the results will be a lot more robust and rewarding. Otherwise beginners in the field may spend weeks on their cd autochanger, find it becomes uncalibrated after 2 cds and give up. If robotics is going to explode into the field everyone wants it to, it's best that best practises are forced now, not later.
Re:imprecise hardware... (Score:2, Informative)
Carpenters know that if you want to cut a 16' length of wood into 4 foot sections, you measure 4' from the end and then 8' from the end and then 12' from the end...not 4' then another 4' then another 4'. The measuring tape is extremely accurate if used correctly, just like the sensors in the robotics set.
Re:imprecise hardware... (Score:1)
Re:imprecise hardware... (Score:5, Interesting)
One way (I think, anyway) to get around this is to have many rovers all talking to each other and to the lander. Robots are good at sending relative positions, but bad at determining absolute position. So you get each robot to stay in constant contact w/2 other robots, and deterime their positions relative to itself. As long as one robot stays in constant contact with the lander, the lander can do some simple vector math and determine the positions of all the other robots! This would be cool because you can string out the robots in a long line, and you can safely move robots outside of the visual range of the lander. I wrote about it in my thesis. [uiowa.edu]
GPS... (Score:1)
This way your robots can all leave the vicinity of the lander without getting lost.
Re:imprecise hardware... (Score:1)
JP
I buy when (Score:1)
Re:I buy when (Score:1)
Talk about big plans: moving your lawn with a robot? But, where to, and wouldn't people complain?
Re:I buy when (Score:3, Funny)
Re:I buy when (Score:1)
Re:I buy when (Score:1)
Re:I buy when (Score:1)
Re:I buy when (Score:1)
You want to cut your hair with a lawnmower? Ouch!
Jack
Re:I buy when (Score:1)
I haven't seen one single link in all this mess that actually points you to 'Lego Mindstorm Portal' or whatever the hell...
Re:I buy when (Score:2)
Re:I buy when (Score:1)
LR
Not only robotics, reliving childhood (Score:1)
I'd like to try this out and combine some of the information in this book with my two 15 gallon tubs full of Legos from my childhood.
If when my boy is old enough I could only choose one toy for him to play with, it would undoubtedly be Legos.
Good Old Legos (Score:1)
Imagine a beowulf cluster of these robots
forget the Lego (Score:2, Funny)
No, don't, the outgassing will kill you (Score:5, Funny)
Fortunately, I can take those off your hands, and safely dispose of them, just email me for shipping information.
Re:Good Old Legos (Score:3, Informative)
Robots and Complexity (Score:2, Interesting)
Re:Robots and Complexity (Score:5, Insightful)
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>
Vacuum Cleaner! (Score:3, Interesting)
Re:Vacuum Cleaner! (Score:1)
Well, they did to that. And won the "Ultimate builder Competition", and it got sent to the International Space Station. Not sure it works in the presence of gravity though :-)
The google translation of the german page about this [google.com]
Re:Vacuum Cleaner! (Score:3, Funny)
Just remember to put your gown over the hook, place your towel over the drain, place your satchel over the panel and put your junk mail on top of the satchel...
Otherwise, you'll never get anywhere with these bots.
=
Solution (Score:1, Funny)
Do remember to put on some kind of footwear, though. And bring a shovel.
Re:Solution (Score:1)
When I were a lad... (Score:3, Funny)
Re:When I were a lad... (Score:1)
It think it's great that kids today can focus more on programming aspect of robotics rather than the nitty-gritty details of circuit design, but I think any robotics set (like lego mindstorms) should come with complete schematics of their hardware, so kids can learn something about what they're playing with.
Can I get a witness?
Sun's article (Score:5, Interesting)
Here's Sun's article [sun.com] on this. Apparently, they managed to squeeze a JVM with multithreading (although no garbage collection) into 16K. Who said Java was big and bloated? :-)
A funny quote:
The robot that they built for the International Space Station, called Jitter, floats around collecting particles of debris. So even though it doesn't have a garbage collector, it is one!
with all the lego book reviews (Score:2, Interesting)
Re:with all the lego book reviews (Score:1)
Re:with all the lego book reviews (Score:1)
Re:with all the lego book reviews (Score:1)
Is BackSlashDot the "News for DOS Nerds?"
Everquest. (Score:3, Funny)
Interesting Simulation/Robotics project (Score:4, Interesting)
check out
http://www-theory.dcs.st-and.ac.uk/IC_Group/resour ces/software/software.shtml
[st-and.ac.uk]
- for the software
and
http://www-theory.dcs.st-and.ac.uk/IC_Group/resour ces/multimedia/multimedia.shtml
[st-and.ac.uk]
for cool movies and videos of the lego robot.
Various different types of learning were played around with ; neural, reinforcement learning , handcoded algorithms....
Those pages are still to be ok'd with my local dept. though, so please email gbb@dcs.(nospam).st-and.ac.uk if you have any questions about them.
Re:Interesting Simulation/Robotics project (Score:1)
If you have trouble getting the videos just now (though I don't think you will), check back later...
Re:Interesting Simulation/Robotics project (Score:1)
I don't want to piss on his bonfire at all, but his final year of what - pre-school?
We produced robots for each of the behaviours demonstrated a 1-semester robotics course, hardly a massive final year project.
Re:Interesting Simulation/Robotics project (Score:1)
There is no robotics course here, and no background in robotics at all. We have no lecturers in robotics, and myself and this other guy are the only people with any experience at all - and we're just beginners. Most of his project and a fair bit of my time has been spent trying to build up a knowledge of the area.
The project made up either 15 or 30 credits of a 180 credit course over 7-8 months. (I'm not sure). So the guy didn't spend a year on it, more like 200 hours for everything (see below).
The point of the project wasn't just to demonstrate those behaviours mentioned, but instead to;
1) Practice the full software lifecycle (research, design, implementation, testing, and everyone' favorite, documentation... typically 80 pages of detailed A4 text in one of the reports alone, never mind javadoc etc.).
2) Develop a piece of software that would make it easier for people to develop whatever sorts of behaviour they want, and make it easy for people to plug in their own behaviour, on any platform, and make it easy for people to extend his simulator, or reuse it , or whatever.
3) Make it so that people could use the same bit of source code for working on-board, , off-board , or working in simulation.
4) Then, develop some plugins to show what he'd done.
I'm sure someone could have done the project better had they been spoon-fed the material by someone experienced in the area, but the guy doing this had to teach himself neural nets, reinforcement learning, robotics, etc. etc as well as get familiar with java, lejos, swing and so on, all within that 200 hours.
At the start of this, we didn't even know what robotics platforms were out there, we had to spend time checking them all out, and trying to scrape together some money once we decided a mindstorm would be fun!
Anyway, you have a fair point in that it's not the best project in the world, but it's fun, and it makes it easier to rattle off controllers in for on-board, off-board processing , and for simulation.
I think it was a good 200 hour project, given what the project tried (and succeeded) in doing, and the resources available. It also managed something that I don't think any other program does- a simulator that allows you to run the same java code in simulation or on the RCX without editing / recompiling, on any platform. (linux/windows)
If you still feel the same now that you know the background, then that's your choice, but have a play with the program and see if you like what it can do.
Re:Interesting Simulation/Robotics project (Score:1)
I think you misunderstand the background.
There is no robotics course here, and no background in robotics at all. We have no lecturers in robotics, and myself and this other guy are the only people with any experience at all - and we're just beginners. Most of his project and a fair bit of my time has been spent trying to build up a knowledge of the area.
The project made up either 15 or 30 credits of a 180 credit course over 7-8 months. (I'm not sure). So the guy didn't spend a year on it, more like 200 hours for everything (see below).
The point of the project wasn't just to demonstrate those behaviours mentioned, but instead to;
1) Practice the full software lifecycle (research, design, implementation, testing, and everyone' favorite, documentation... typically 80 pages of detailed A4 text in one of the reports alone, never mind javadoc etc.).
2) Develop a piece of software that would make it easier for people to develop whatever sorts of behaviour they want, and make it easy for people to plug in their own behaviour, on any platform, and make it easy for people to extend his simulator, or reuse it , or whatever.
3) Make it so that people could use the same bit of source code for working on-board, , off-board , or working in simulation.
4) Then, develop some plugins to show what he'd done.
I'm sure someone could have done the project better had they been spoon-fed the material by someone experienced in the area, but the guy doing this had to teach himself neural nets, reinforcement learning, robotics, etc. etc as well as get familiar with java, lejos, swing and so on, all within that 200 hours.
At the start of this, we didn't even know what robotics platforms were out there, we had to spend time checking them all out, and trying to scrape together some money once we decided a mindstorm would be fun!
Anyway, you have a fair point in that it's not the best project in the world, but it's fun, and it makes it easier to rattle off controllers in for on-board, off-board processing , and for simulation.
I think it was a good 200 hour project, given what the project tried (and succeeded) in doing, and the resources available. It also managed something that I don't think any other program does- a simulator that allows you to run the same java code in simulation or on the RCX without editing / recompiling, on any platform. (linux/windows)
If you still feel the same now that you know the background, then that's your choice, but have a play with the program and see if you like what it can do.
After you have read the book... (Score:3, Interesting)
Best of all, you will be helping kids see that computers can be used for more than just video games and IM.
Java for appliances? (Score:1)
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.
I'd never heard that before, but I am realizing what a good idea it is. Admittedly I am not a programmer, but I do have a working knowledge of java, and I know a lot of people like me. How cool would it be if I could easily customize code for my appliances? I may buy this Lego kit just so I can show people the future usefulness of continuing CS education. (And to build cool stuff and show the gigantabox of Legos sits in my utility room for a reason... who can throw away Legos?)
The debate Lego or Legos (Score:1, Offtopic)
Re:The debate Lego or Legos (Score:1)
Re:The debate Lego or Legos (Score:1)
Lego Name (Score:1)
In Danish you do not add a plural, so maybe English need to follow same rule.
Low cost horticulture. (Score:1, Interesting)
The other day while at the hardware store there is one familar brand of sprinklers. The brand name is LEGO. Cool. Horticulture is one area we could use some low cost robotic smarts. One reason is to conserve water with the equipment that is smarter than the simple six relay timer. Another idea is the sprinkler itself with more smarts. Could program sprinklers to spray in square shapes, ovals, half cones, or thin and long rectangles instead of circles. Could have the sprinklers spray lighty on one side and heavy on the other side.
Hmmm (Score:1)
Not used a mobile phone or pda recently then?
So how much would it cost to get into this? (Score:1)
Re:So how much would it cost to get into this? (Score:2)
I also find myself picking up those little sets they have now just to get a few extra gears or something.
Basically, it costs as much as having a killer computer system...you're always upgrading.
Click here [pldstore.com] for prices on pieces.
Re:So how much would it cost to get into this? (Score:1)
Mindstorms Java & Linux (Score:4, Informative)
Under Linux the problem is that the Robot Invention kit 2.0 only has a USB infrared tower to download programs to your lego brick - v1.5 and 1.0 had serial towers where were easy to access from Linux.
The setup I've got currently is Linux with VMWare 3.1 Running Win98 - that way I can get transfer programs using the USB support from the Win98 and USB support from VMware 3.1.
Its not a great setup but it means I only have to run one program, the lejos transfer program in my Win98 sandbox. (I couldn't get the main lego program to run under VMWare/Win98 - when it attempted to access the usb I just got segmentation violations and vmware disappeared!)
There is a project at sourceforge - legousb.sourceforge.net to add the usb support for the lego tower to linux but its not very advanced.
Overall if you know java, then programming mindstorms using lejos is a breeze. The book for me has been an excellent guide to both java/mindstorm programming, and the types of extra equipment such as sensors that make everything more enjoyable. There are even projects in the book to build distance sensors using the Sharp GP2D12 sensor and a compass sensor.
The book also touchs on Behavior Control Theory and Navigation theory, and shows how the lejos java API provides you with classes that implement these concepts.
If you know java and want to use mindstorms, then this book is a must.
Lego Challenge... (Score:1)
This thread topic made me think of something I would like to build someday - call it 'LegoRover'.
I travel a lot. Here is what LegoRover would do for me while I'm gone:
> Periodically crawl around my house, either using remote issued directional command/control (more on that below), or using a pre-programmed or semi-random navigational algorithm.
> Always finish a crawl by returning and reattaching to a battery charging station
> During the crawl capture environmental info like: digital stills or mpegs (a small mounted digital camera?); live video feed; sound recordings; temperature; etc.
> transmit environemtal info to base station PC in house
> LegoRover is a home LAN network node - use a wi-fi? connection to transmit live command control feed to LegoRover and transmit live video/sound feed to internet connected base station PC?
>(see where this is going?...) - from my hotel room somewhere, I can access my home net - load/view stored rover data from this morning's programmed crawl, then turn on the live video feed and starting driving LegoRover around the house for a looksee.
The Java Lego MindStorm Challenge (Score:2)
Last year, a bunch of undergraduates and I
participated in the Java Lego Mindstorm challenge, a particularly silly competition between Stanford, UC Berkeley, and UC Santa Cruz. Berkeley won with a money-sorter.
Anyway, working with the kit was really fun and leJOS worked well. Check out the photos:
http://www.sun.com/developers/evangcentral/chal
Or read about the event:
http://www.sun.com/developers/evangcentral/chal
LeJOS really is all it's cracked up to be. It provides a very familiar (for Java junkies) interface to the sensors, motors, etc. of the lego mindstorms kit. Of course, you still need some fine muscle control in order to be able to assemble the legos. The undergrads did that part.
Curious about no garbage collection (Score:2)
Just showing off (Score:2)
My webcam [man.ac.uk]
You can see it working or play with ithere [man.ac.uk]
And my hamster powered 32bit microprocessor [man.ac.uk]
Re:Just showing off (Score:2)
Re:Slashdot Gripes 1.01 (Score:1)
Slashdot Gripes 1.02
1.) Gripes that begin with a "-".
2.) Gripes that complain about the proper use of grammar and then begin with a sentence fragment, and that contain at least 5 grammatical or punctuation errors.
3.) People who make gripe lists.
Re:this book looks amazing (Score:1)
dont get me wrong, i think all of these new technologies for modern publishing are great, they just will never entirely replace printed material.
btw, where is this paperless office ive been hearing about for ages?
Re:this book looks amazing (Score:1)
Its hard to replace books because they're so simple. The book may be replaced by Linux 17.8, but not linux 2.5.
Re:this book looks amazing (Score:2)
The "information wants to be free" thing is just stupid.