Review: The Definitive Guide to Building Java Robots

Posted 5 Apr 2006 at 21:04 UTC by steve Share This

The Swirling Brain has been reading Scott Preston's latest book, The Definitive Guide to Building Java Robots. Using Java on a robot would have seemed crazy just a few years ago but every day we're reporting on microcontrollers and laptops with faster CPUs and more memory. You might as well put all that memory and horsepower to use. So if you like programming in Java, there's really no reason not to try it out on a robot. Scott's book provides a good introduction to using Java with sensors, motors and other robot necessities. He also covers navigation, speech, and vision. Read on for the full review.

Review by Jim Brown

Help support by purchasing this book now from!

Title: The Definitive Guide to Building Java Robots

Author: Scott Preston

ISBN Number: 1-59059-556-4

Publisher: Apress

Number of Pages: 419

List of Chapters:

Chapter 1 - A Primer
Presents his java/laptop/ssc paradigm/architecture he'll be using.

Chapter 2 - Serial Communications
Tells how to connect and use pc to robot via serial ports & bluetooth

Chapter 3 - Motion
Tells how to use servo controllers for servo and wheel control

Chapter 4 - Sensors
Tells how to use compass, switch, and distance sensors

Chapter 5 - Speech
Tells how to use speech output and speech recognition

Chapter 6 - Vision
Tells how to get a camera image and process it

Chapter 7 - Navigation
Tells how to make your robot get about

Chapter 8 - Other Topics
Talks about using Scheduling, Ant, MySQL, Tomcat and Groovy

Chapter 9 - Sample Programs
Puts it all together and explains using diagnostics and such

Appendix A - The Definitive Guide API
Gives descriptions of all the classes created in the book

Appendix B - Microcontroller Reference
Gives brief explanations of some of the controller commands used

Appendix C - Robot Parts Reference
Lists some great URLs

When Steve asked me if I would do a book review, I said OK, but little did I know that he would pick out such a great book for me to review! I'm a Java coder myself so a Building Java Robots book is right up my alley. One of the things I asked him when he passed the book to me was, "Do I get to keep the book?" He said I couldn't because after the review it would be donated to the DPRG library. I'm so upset. Perhaps I can check out the book indefinitely from the DPRG library. [Evil grin] Really! The book is that cool!

The book starts off by explaining the architecture he uses and it's just what I would want to use for a perfect power robot: A laptop with serial control boards all controlled by Java. He bagged me right there! What's cool about Java is that it has all of these great Libraries and APIs such as video, speech, and more that you don't have to reinvent. Scott shows how to take great advantage of all of these. A laptop with control boards is to me like the Holy Grail of personal robotting. Forget piddling around with dinky robot boards. A laptop bot is the way to go and all you need is Java and a few support boards for sensors and motors and stuff. So while I read this book, his ideal robot paradigm was mine too so I was really connecting.

The way Scott lays out the book is really good too. He talks a little bit and then he jumps into some sample code. But, the way he does it is the way everyone should do it. First, he has a "Code Objective" which is a quick sentence about what he's about to do, and then he has a "Code Discussion", which is a paragraph or two explaining the code, and then he presents the raw code, but always not too complex. For almost every code section, you'll want to bookmark the pages because you'll want to steal, er, um, use them for your own robot. Pretty soon you'll see you'll have practically the whole book earmarked, as just about every code snippet is very useful! Oh man, you can use just about all his classes and sample code for your robot the way it is!

So, you stop and think about what all you want your robot to do, and low and behold Scott tackles just about everything and lays out how to do it. You want your robot to control servos via a serial port, got it. You want your robot to recognize speech and talk, got it. You want your robot to see and recognize things, got it! You want you robot to navigate and avoid obstacles, got it! And, what's so nice, he explains everything in easy to understand terms and provides sample code that you can use right away. I mean, I read the Speech section and I feel totally confident that I can incorporate what he discussed and have my robot talking and listening in no time flat!

The book reads as though he knows the topics are advanced but he keeps it simple as if you can do it too. I mean really, you have to know a lot of advanced things to build a robot but the way he approaches it, he keeps it simple and you'll believe you can do it too and they won't seem so daunting! I'd say it's not for dummies by any means, but if you already have a little bit of robotic technical wits about you, you'll be on the level.

Of course, there's always some "gotchas." The book is really geared toward the programming side of robotics and is not for the novice programmer. If you don't know Java, you'll need to learn it first or it may be difficult to understand the Java code, which is a lot of what the book is all about. You'll need to know about BASIC Stamps and how to code them as he uses them. You'll need to buy a few things like serial servo controllers and other robot parts, but you knew that right? You'll need to be acquainted with all the tools Scott uses such as the Java tools, Internet protocols, and other tools that he discusses in the book. Really, though, if you're much of a programmer, you'll likely pick up on all these topics fairly quickly. Scott kindly lists all the places on the Internet that you can get the tools and libraries for free as he talks about them in each chapter so you're never in the dark. Even more information can be found on Scott's website.

So for me, I'm thinking as soon as I start building my laptop bot, I want to have this book around for reference. It really seems to be a definitive guide to have around for a powerful personal robot. It's a hard cover so you'll know it will last through all your page turning. He covers all the necessary topics to build a Java Laptop bot and it would save a lot of time for getting such a robot up and going. I would highly recommend this book for those wanting to build a Java Laptop bot! Great job Scott! To me, it's a must have book for power robot builders.

Nice Review!, posted 7 Apr 2006 at 12:34 UTC by jeffkoenig » (Master)

It sounds like a very good book, not only for robotic applications but for general control of external circuitry using a PC. I'm considering buying a copy.

Serial ports are getting rare on laptop computers. Is USB communication described, or is there a way using Java to use a USB-to-serial converter to talk to subordinate RS-232 controller boards?

Basic Stamps are mentioned - is this book very Stamp-centric? I've owned two of them (a BS2 and an older one), and don't care for them.

Great review, Jim!

Your Covered, posted 7 Apr 2006 at 13:42 UTC by scottpreston » (Master)

I tested all the code at my PC and Basic Stamp BOE, before uploading to the Robot. I used the USB-Serial converter for that and have a picture of it on page 3.

Have fun reading. Let me know if you have any questions.

- Scott

BS2 or Javelin Stamp or Something else, posted 7 Apr 2006 at 13:45 UTC by scottpreston » (Master)

The book uses the BS2 because Parallax was nice enough to donate a few, but the core of the book is Java. If you have other microcontrollers, you should still be able to use about 90% or more of what's in the book.

I also talk about the Lynxmotion SSC-32.

USB - serial, posted 7 Apr 2006 at 14:16 UTC by steve » (Master)

My Laptop (Dell Inspiron 8600 running Fedora Linux) has no serial ports, just USB and Firewire. I've been using a USB to serial converter for a while with my MRM board and it works fine with all the software I've tried. Seems to be totally transparent to the software on the laptop. I know some folks who've had similar luck but others who've gone through two or three brands of USB to serial adapters until they found one that worked for them.

More book stuff, posted 10 Apr 2006 at 14:58 UTC by The Swirling Brain » (Master)

While I was reading, even though Scott used bs2 in his examples, I didn't feel like Scott was locking you into bs2 stuff. I think there was some bs2 code in the book but just for example and nothing at all complex that couldn't be reworked easily for something else. It seemed the code for the bs2 code was not the focus but rather the java code pc side of things was the focus.

USB to Serial for new laptops is a little tricky, but it's getting to be a pretty common yet easy to deal with problem. One other option that Scott mentioned in the book was using bluetooth. In the book, he shows what to do in java and it's just as easy to use as a serial port!!! Look ma, serial comm with no cables! That's sort of what you want for a robot anyway, right?... no cables back to the pc? If you're not familiar with bluetooth serial comm sw & hw, he details how to do it in the book!

Another thing that was interesting in the book was he mentioned setting up the robot to act as an internet server. He got a Tomcat servlet engine going on the robot (he has a laptop robot remember). That way you could access your robot or make it do stuff from your pc through a browser! You could get access the web cam pictures on a webpage, etc. You could connect it to the internet and control your robot from anywhere. You could be at work and send your robot commands!

While I had the book I noticed that I must have spilled something on the top right corner of the book or laid it in something! On closer inspection I noticed that it was actually some kind of art that was printed on the cover. Whew! It got my wife too! She thought I got something on the book! Later, even though I knew the book was printed with that greasy spot looking thing on the top right corner, I'd still take a second look at it now and then. Scott, tell Apress they spilled something on the cover artwork! -- Does anyone remember having a "Chicago" album where the inside record jacket had fingerprints printed on it. You pulled it out and thought you had gotten the jacket dirty with your greasy fingerprints? I know, speaking about vinyl records tells my age. Those were the "good times I remember." Yeah, it must have happened Saturday in the park, I think it was the 4th of July.

See more of the latest robot news!

Recent blogs

30 Sep 2017 evilrobots (Observer)
10 Jun 2017 wedesoft (Master)
9 Jun 2017 mwaibel (Master)
25 May 2017 AI4U (Observer)
25 Feb 2017 steve (Master)
16 Aug 2016 Flanneltron (Journeyer)
27 Jun 2016 Petar.Kormushev (Master)
2 May 2016 motters (Master)
10 Sep 2015 svo (Master)
14 Nov 2014 Sergey Popov (Apprentice)
Share this page