Programming Lego Mindstorms with Java

Dario Laverde, Giulio Ferrari, Jurgen Stuber

  • 出版商: Syngress Media
  • 出版日期: 2002-02-28
  • 售價: $1,330
  • 貴賓價: 9.5$1,264
  • 語言: 英文
  • 頁數: 464
  • 裝訂: Paperback
  • ISBN: 1928994555
  • ISBN-13: 9781928994558
  • 相關分類: Java 程式語言Storm樂高 Logo
  • 已絕版

買這商品的人也買了...

商品描述

The LEGO® Mindstorms™ Robotics Invention System has been called "the most creative play system ever developed." This book unleashes the full power of the RCX and the tools, bricks, and components that make up LEGO® Mindstorms™.

Programming LEGO® Mindstorms™ with Java is as much about robotics programming as it is about Java programming. This book is for all levels of Mindstorms™ users, from hobbyists to the serious Mindstorms™ aficionados. This book is also appropriate for a variety of programming levels; those with only a modicum of Java knowledge as well as those at an advanced level will find much to learn within these pages. You will cover all the basics of programming the RCX, beginning with the introduction of the available Java APIs used to communicate remotely to the RCX using its default firmware, all the way through the advanced topics of embedded programming using a custom Java Virtual Machine (JVM).

You will master the art of:

  • Creating an applet for remote controlling a robot
  • Programming a line-following robot
  • Using the emu-lejos and emu-lejosrun emulators
  • Extending the Java Communications API to include support for USB ports
  • Using popular leJOS tools for developing leJOS programs
  • Simulating Artificial Intelligence with the RCX
  • Extending leJOS using native code
  • Programming LEGO MINDSTORMS with Jini
  • Designing and debugging
  • Communicating with the RCXJava API

The Programming LEGO® Mindstorms™ with Java CD-ROM includes:

  • The latest versions of leJOS for Windows and Unix
  • Simlink, a PC-based visual emulator for leJOS
  • RCXJava API, a platform independent Java library used to develop RCX applications
  • RCXPort, a Java interface created for users to interact with a LEGO® Mindstorm™ RCX from a Java Virtual Machine

Table of Contents

Foreword  ns = "urn:schemas-microsoft-com:office:office" />

Chapter 1 Introducing LEGO MINDSTORMS

Introduction

The LEGO MINDSTORMS RIS Kit

A Brief History of the LEGO

  MINDSTORMS RIS

What's Included with the Robot Kit

RCX: The Robot's Brain

How It Works

The Physical Structure 

The Logical Structure

Expanding the RCX Brain

Replacing the RIS Software

Replacing the RCX Firmware

The RIS Software Environment

Installing the Firmware into the RCX

A Visual Programming Interface: RCX Code

RCX Bytecodes 

The LEGO Assembly Code for the RCX

LEGO Expansion Kits

Alternative Processing Units

Add-on Building Elements

Summary

Solutions Fast Track

Frequently Asked Questions

 

Chapter 2 The Java Communications API

Introduction

Overview of the Java Communications

  Extension API (JCE API)

Understanding the JCE Framework

Port Discovery and Enumeration

Port Ownership Management

Asynchronous event-based I/O

Encapsulation of Underlying

  Native Ports

Java Communication API's Event Based

  Architecture

Installing and Configuring the

  Java Communications API

Installing the Native Library

Installing the Java comm.jar Library

The javax.comm.properties

  Configuration File

Configuring your Development

  Environment

Reading and Writing to Serial Ports

Simple Read Example

Simple Write Example

Debugging with Serial Ports:

  The "Black Box" Example

Selected Code

Extending the Java Communications API

Using More than Serial or Parallel Ports

USB Port Access

Summary

Solutions Fast Track 

Frequently Asked Questions

 

Chapter 3 Communicating with

the RCXPort API

Introduction

Overview of the RCXPort Java API 

How RCXPort Works

Formatting RCX Commands

RCXPort Object Model

Limitations of RCXPort

Compiling Java into Machine Code

Restrictions of Using Direct Mode

Reliance on Java Communications API

Programming the RCX Using RCXPort

Downloading Programs with RCXPort

Interfacing External Software with RCXPort

An Advanced Example Using RCXPort

Summary

Solutions Fast Track

Frequently Asked Questions

 

Chapter 4 Communicating with

the RCXJava API

Introduction

Designing an RCX Java Communications

  Architecture

The Basic Components of an RCX API

Port Configuration and Error Handling

Protocol Management and

  Message Parsing

Tower Communications

RCX Communications

Reusability: Protocols and Ports

Supporting Similar Protocols 

Using Java Interfaces to Support

  Ports Other than Serial Ports

Overview of the RCXJava API

The RCX Package

Classes

Interfaces

Exceptions

Using the RCXLoader Application

The User Interface

Handling and Parsing Response

  and Error Messages

Beyond Serial Port Communications:

  The RCXApplet Example

Communicating over the Network

Using Sockets

Building and Extending the Simple Applet

Direct Control Programming

  for the RCX Using Java

Basic Remote Control Application

Creating a Direct Control

  Framework for Java Programs

Direct Control Using AI

Summary

Solutions Fast Track

Frequently Asked Questions

 

Chapter 5 The leJOS System

Introduction

Basic leJOS Usage Guidelines 

Using the lejosc Compiler

The LEGO Java Operating System 

The TinyVM

Overview of the leJOS Architecture 

Exploring the josx.platform.rcx Package

Using the Button and ButtonListener

  Classes

Using the MinLCD, LCD, Segment,

  LCDConstants, and TextLCD Classes

Using leJOS: A Simple Example

Controlling Motors

Reading Sensors

Summary

Solutions Fast Track

Frequently Asked Questions

 

Chapter 6 Programming for the leJOS Environment

Introduction

Designing Java Programs to Run in leJOS

Using Memory Wisely

Using the Right Java Classes

  (and Using Them Correctly)

An Advanced Programming

  Example Using leJOS

Controlling the Steering

Restricted Steering

Getting Back to the Line

Debugging leJOS Programs

Using Sounds and the LCD

Exception Handling with leJOS

Testing leJOS Programs

Using the leJOS Simulator

Summary

Solutions Fast Track

Frequently Asked Questions

 

Chapter 7 leJOS Tools

Introduction

Programming Environments for leJOS

The Command-Line Tools

  that Interact with the RCX

Using the lejosc Compiler

Using the lejos Linker

Using the lejosfirmdl Downloader

The Command-line leJOS Emulator

Using the emu-lejos Emulator

Using the emu-lejosrun Linker

Using Exisiting IDEs

Configuring Forte

Using the leJOS Visual Interface

The leJOS Visual Interface

Installing lVI

Setting Up lVI

Basic Usage

Using a leJOS Simulator: Simlink

Getting Started with Simlink

Installing and Configuring Simlink

Running Your First Simulation

Designing a Floor Plan for Simlink

Non-visual Declarations

Visual Declarations

Navigational Declarations

Creating a New Simlink Robot Body

Creating a Body: Passive Components

Active Body Classes: Sensors

  and Wheels

Creating a Simple Robot Design

Future Tools for Designing Robots

Additional Tips and Tools for leJOS 

RCXDownLoad 

RCXDirectMode

Summary

Solutions Fast Track

Frequently Asked Questions

 

Chapter 8 leJOS Internals 

Introduction

Advanced Usage of leJOS

Multiprogram Downloading

Storing Persistent Data 

Examining leJOS Internals

From Source Code to Execution

Inside the leJOS Linker

The C Wrapper

The Java Main Program

Building the Binary

The leJOS Binary Format

Inside the leJOS Firmware

The Structure of the leJOS Virtual

  Machine

Real-Time Behavior

RCX Memory Layout

The Emulator

The leJOS Source Code

Extending leJOS with Native Methods

Native Methods in leJOS

Adding a Native Method

Additional Tips and Tricks with leJOS

Changing Stack Sizes

Determining the Amount of Free Memory

Measuring Latency

Summary

Solutions Fast Track

Frequently Asked Questions

 

Chapter 9 Programming LEGO

MINDSTORMS with Jini

Introduction

Overview of the Jini Architecture

Jini as a Network Protocol

A Simple Jini Service Example

What's Required for Installing and

  Running Services

A Simple Service and Client

Proxies and Service Architectures

Selecting the Right Architecture

Using Proxies

A RCX Jini Proxy Service

Why a Proxy? 

Interfacing with the RCX Java API

Using the RCX Jini Service:

  Example Server and Client

A RCX Jini Server

A RCX Jini Client

Summary

Solutions Fast Track

Frequently Asked Questions

 

Appendix A Resources

 

Appendix B Programming

LEGOMINDSTORMS with Java Fast Track

Index