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 #126 background imageLoading...
Page #126 background image
Page 135
(table continued from previous page)
Table 6-11. SOUND_PLAY Sounds (continued)
Sound Number Description
2 Descending arpeggio
3 Ascending arpeggio
4 Long low note
5 Quick ascending arpeggio (same as 3 but faster)
The sounds can be either unqueued or queued. Unqueued sounds will be played right away if no sound is currently playing. If a sound is currently playing (i.e., the sound system is already
busy), then the unqueued sound will not be played at all. A queued sound, on the other hand, waits for the sound system to finish whatever it's doing and then plays. The value of code
determines if a sound is queued (4003) or unqueued (4004).
SOUND_GET (address --)
This word returns the current state of the sound system to the given variable. You can use the pbFORTH-supplied variable RCX_SOUND for this word. A zero indicates that the sound system is not
busy. Any other value means that the sound system is busy playing another sound.
Cooperative Multitasking
pbFORTH version 1.0.5 introduced words that support cooperative multitasking. Cooperative multitasking allows multiple tasks to appear to run simultaneously. In reality, each task must
voluntarily yield control to the next task in line. The other kind of multitasking, which you've seen in NQC and will see again in legOS, is called preemptive multitasking. With preemptive
multitasking, the system gives little bits of time to each task, interrupting each task to give control to the next task.
Cooperative multitasking is a little tricky to program because each task needs to explicitly yield control to the other tasks. If your robot has a task that is going to do any lengthy processing, the
task needs to be structured so that it can yield control frequently.
The pbFORTH web page has more information on cooperative multitasking. Take a look at the tortask.txt example, which is a good demonstration of the use of multiple tasks in pbFORTH.
The basic procedure for running a multitasking program has four steps:
1. First, you need to allocate space for each task using the ALLOT_TASK word. This includes space for user variables and space for a parameter and return stack. Here's a sample from tortask.txt:
0 32 CELLS 32 CELLS ALLOT_TASK MOTOR_TASK
Page 136
The CELLS word simply converts a number on the stack from cells, which are the fundamental units of Forth memory, to bytes. The line above allocates no space for user variables and 32
cells each for the parameter stack and return stack. The name of the new task is MOTOR_TASK. In tortast.txt, three other tasks are allocated in the same way:
0 32 CELLS 32 CELLS ALLOT_TASK TIMER_TASK
0 32 CELLS 32 CELLS ALLOT_TASK SENSOR_TASK
0 32 CELLS 32 CELLS ALLOT_TASK DISPLAY_TASK
Notice how the name of the new task is specified after the ALLOT_TASK word, almost like a variable definition.
2. Next, each task must be built into a list. When one task voluntarily gives up control (cooperates), the next task in the list will get control. The BUILD word assembles tasks into a list:

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