EasyManua.ls Logo

LEGO MINDSTORMS Robots User Manual

LEGO MINDSTORMS Robots
226 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #191 background imageLoading...
Page #191 background image
legOS's development cycle is a little clumsy. You write a program, compile it with the legOS source code, then download the whole thing to the RCX. It's the downloading that takes a long time.
Here are some tips to make things go smoother:
1. Always include code that terminates your own program. If your program can stop itself, control returns to legOS. When legOS has control, you can turn the RCX on and off and even reinitialize
the firmware, as described next.
Page 212
2. When legOS has control of the RCX, you can press and hold the Prgm button, then press the On-Off button. This blows away legOS (and your program) and returns control of the RCX to the
ROM. You'll need to do this before you can download a new set of firmware to the RCX.
3. If your program doesn't stop itself and give control back to legOS, you'll need to erase the firmware by removing a battery. If your program has a bug and does not terminate, you'll need to
remove a battery to reset the RCX.
4. Sometimes, through a bug in legOS or in your program, the RCX cannot be initialized by removing the batteries for just a few seconds. You will need to remove the batteries from your RCX
and wait for a minute or so before the firmware is erased. Some circuitry keeps the RCX's memory alive; in some cases, you need to wait for the circuitry to drain completely before the firmware
will be erased.
If the endless code-compile-download-reset cycle is getting you down, you might consider using an emulator. An emulator is a special program that runs on your development PC but acts like an
RCX. You can test your programs on the emulator much faster than you can test them on an actual RCX. Currently one legOS emulator exists; see the "Online Resources" section for details.
Debugging
The display is your best friend when it comes to debugging. legOS offers an impressive array of display functions. You can show words that indicate which part of your program is executing or
display the contents of variables. Of course, there's not a lot of space to work with, but you could easily display a series of values for a short time. You could even write debugging code that lets
you cycle through data by pressing a button.
Unexpectedly Static Variables
One of the craziest things about legOS development is that global variables retain their value from one time you run your program to the next. This is very important—it means that variables you
initialize at declaration time are initialized only once, when your program is first loaded on the RCX. Use the following program to convince yourself:
#include "conio.h"
int x = 44;
int main(void) {
lcd_int(x);
lcd_refresh();
Page 213
x++;
delay(1000);
return 0;
}
The value shown on the display will be 44 the first time the program is run, but it goes up by one each subsequent time, even when you turn the RCX off and on again. This interesting property
was the source of several bugs in the original LightSeeker.c program.
If you really want to initialize a variable each time your program is run, you should do it explicitly in the code somewhere, like this:

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the LEGO MINDSTORMS Robots and is the answer not in the manual?

LEGO MINDSTORMS Robots Specifications

General IconGeneral
Product LineLEGO MINDSTORMS
CategoryToy
Age Range10+
Batteries RequiredYes
Memory64 MB RAM, 16 MB Flash
ConnectivityBluetooth, USB
SensorsTouch, Color, Gyro
Battery TypeAA
Interactive FeaturesProgrammable, Remote Control
App CompatibilityiOS, Android
ProcessorARM9
Pieces Count601
Battery Count6
App NameLEGO MINDSTORMS EV3 Programmer App

Summary

Welcome to MINDSTORMS

What Is a Robot?

Defines a robot and its fundamental components: brain, body, actuators, sensors, power source.

Mobile Robots

Discusses the challenges and types of mobile robots (tethered vs. autonomous).

What Is MINDSTORMS?

Explains the MINDSTORMS product line and the Robotics Invention System (RIS) set.

Meet the RCX

Details the features and components of the RCX, the robot brain.

About the Software

Describes the components of the RIS software: documentation, programming environment, and downloader.

What About MacOS and Linux?

Discusses programming options for users not on Windows.

Online Resources

Lists official and unofficial websites for MINDSTORMS community and information.

Hank, the Bumper Tank

Building Instructions

Provides step-by-step instructions for building the Hank robot.

A Simple Program

Explains Hank's basic program for exploring and avoiding obstacles.

Locomotion

Discusses different methods of robot locomotion like treads, differential drive, and cars.

Bumpers and Feelers

Explains the design and function of bumpers for detecting collisions.

Gears

Details the purpose and types of LEGO gears used in robot construction.

Multitasking

Explains the RCX's multitasking capability for running multiple tasks simultaneously.

Trusty, a Line Follower

Building Instructions

Provides step-by-step instructions for building the Trusty robot.

Some Tricky Programming

Discusses the challenges of programming line following behavior.

State

Explains the concept of robot states for decision-making in programming.

The Light Sensor

Details how to use and calibrate the light sensor for accurate readings.

Idler Wheels

Explains the function and importance of idler wheels for robot stability.

Using Two Light Sensors

Describes how to use two light sensors to simplify line following.

Not Quite C

A Quick Start

Provides a simple NQC example to get started with programming.

RCX Software Architecture

Explains the software layers involved in programming the RCX.

NQC Overview

Introduces Not Quite C (NQC) as an alternative to RCX Code.

Output Commands

Details NQC commands for controlling the RCX's outputs (motors, lights).

Input Commands

Explains NQC commands for reading sensor input values.

Program Flow

Covers NQC commands for program control, including waiting, loops, and conditionals.

Variables

Explains how to declare and use variables in NQC programming.

Sounds and Music

Describes NQC commands for playing sounds and music on the RCX.

IR Communication

Details NQC commands for sending and receiving data via the IR port.

The Datalog

Explains how to create and manage a datalog for storing sensor data.

Tasks

Introduces NQC tasks for organizing programs and multitasking.

Minerva, a Robot with an Arm

Building Instructions

Provides step-by-step instructions for building the Minerva robot.

Programming

Explains Minerva's basic program for picking up objects and returning.

Directional Transmission

Describes the mechanical system that allows changing direction of output shafts.

Pulleys

Explains pulleys as an alternative to gears for transmitting motion.

Mechanical Design

Discusses mechanical challenges in designing Minerva, including the grabber arm.

Balance

Addresses the challenge of balancing the robot due to its arm's weight.

Drivetrain

Details Minerva's complex drivetrain system for controlling wheel movement.

Two Sensors, One Input

Explains how to connect multiple sensors to a single RCX input.

Where Am I?

Discusses techniques for robot navigation and determining position.

Using Spirit.ocx with Visual Basic

You May Already Have Visual Basic

Discusses the availability of Visual Basic (VB) and its versions.

About Spirit.ocx

Explains Spirit.ocx as the interface between Windows applications and the RCX.

Calling Spirit.ocx Functions

Shows how to call Spirit.ocx functions directly from Visual Basic code.

Immediate and Delayed Gratification

Explains the difference between immediate and delayed execution of functions.

Programs, Tasks, and Subroutines

Describes how programs, tasks, and subroutines are structured in the RCX.

Tips

Offers practical advice on using Spirit.ocx, including retrieving input and timer values.

Retrieving the Datalog

Details how to extract datalog information from the RCX using Visual Basic.

Online Resources

Lists resources for LEGO Programmable Bricks, robotics, and programming environments.

RoboTag, a Game for Two Robots

Building Instructions

Provides step-by-step instructions for building the RoboTag robots.

Subsumption Architecture

Introduces subsumption architecture as a reactive robot programming paradigm.

RoboTag behaviors

Explains the four behaviors (cruise, tag, avoid, tagged) used in RoboTag.

Arbitration

Describes the arbitration task that manages which behavior controls the robot's motors.

Online Resources

Lists resources for RoboTag and subsumption architecture.

legOS

About legOS

Introduces legOS as a powerful, C-based firmware replacement for the RCX.

Development Tools

Details the necessary development tools like cross compilers (egcs) and Cygwin.

Hello, legOS

Provides a simple legOS program to display "Hello" and verify tool setup.

Function Reference

Describes important legOS functions for display, output, input, and multitasking.

Using the Display

Explains legOS functions for managing the RCX's LCD display with numbers and text.

Controlling Outputs (direct-motor.h)

Details legOS functions for controlling motor direction and speed.

Working with Inputs (direct-sensor.h)

Explains how to read raw input values and configure sensors in legOS.

Using the Buttons (direct-button.h)

Describes legOS functions for reading the state of the RCX's front panel buttons.

The Infrared Port (direct-ir.h)

Explains legOS functions for sending and receiving data via the IR port.

Multitasking in legOS (unistd.h and sys/tm.h)

Covers legOS support for multitasking using tasks and functions like execi() and tm_start().

New Brains For Hank

Implements a light-seeking version of Hank using legOS and subsumption architecture.

Make Your Own Sensors

Mounting

Discusses methods for physically attaching custom sensors to LEGO bricks.

Cut Wire

Describes using wire bricks to connect custom sensors to the RCX.

Copper Tubing

Explains using copper tubing to create conductive studs for sensor mounting.

Machine Screws

Details using machine screws as an alternative to tubing for sensor mounting.

Conductor Plate

Describes using conductive plates for attaching sensor electronics to RCX inputs.

Passive Sensors

Introduces passive sensors and their basic circuit diagram for RCX inputs.

Light Sensors

Explains how to build a passive light sensor using a photoresistor.

Temperature Sensors

Describes using a thermistor to create a simple temperature sensor.

Powered Sensors

Explains the concept of powered sensors and the active mode circuit.

Signal Splitter

Details the circuit for separating power and signal for active sensors.

The Touchless Touch Sensor

Explains how to build a touchless touch sensor using a Hall effect sensor.

Touch Multiplexer

Describes a circuit for connecting multiple switches to a single RCX input.

Other Neat Ideas

Briefly mentions other sensor and actuator possibilities like sound sensors and servos.

Finding Parts and Programming Environments

LEGO Sources

Lists vendors for LEGO parts and accessories like sensors and motors.

Parts

Provides a table of parts with their item numbers and prices from different sources.

Other Suppliers

Lists suppliers for electronic components needed for custom sensors.

Programming Environments

Summarizes available RCX development environments, languages, and tools.

A pbForth Downloader

System Requirements

Lists the necessary software (JDK, Communications API) for the downloader.

Usage

Explains how to use the Java-based downloader program to transfer Forth files.

Source Code

Provides the Java source code for the pbFORTH program downloader.

Future Directions

RIS 1.5

Mentions the upcoming RIS 1.5 version and its rumored features.

Java for the RCX

Discusses the RCXJVM project for programming the RCX with Java.

LEGO Robots as JINI Devices

Explores the concept of integrating LEGO robots into a JINI network.

Related product manuals