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 #154 background imageLoading...
Page #154 background image
Page 169
only upload fifty datalog values at a time. If you have larger datalog, it must be uploaded in pieces.
The relevant Spirit.ocx function is UploadDatalog, which takes a starting index and a length. The first (zero-th) item of the datalog contains the length of the datalog. It's the first thing
SaveDatalog reads:
data = .UploadDatalog(0, 1)
length = data(2, 0) -1
The actual data length is one less than the reported length, because the zeroth item is not a data point.
The data returned from UploadDatalog is an array. Each datalog item is represented by three numbers. The first two numbers indicate the source and number of the value; source and number
have exactly the same meaning here as they do for Poll. The third number is the actual value stored in the datalog.
SaveDatalog writes the source, number, and value for each datalog item out to a text file. Each line of the text file represents one item from the datalog. On each line, the source, number, and
value of the item are separated by commas. This example interprets the source of each value, then converts it to a descriptive string before writing it out to the file. The output file will look
something like this (depending, of course, on the contents of the datalog):
Variable, 1, 2
Timer, 0, 543
Variable, 2, 8
Variable, 8, 368
Sensor value, 1, 33
Watch, 0, 7
A plain text file of comma-separated values is usually pretty easy to import into a spreadsheet or statistical analysis program. You can use your robot to gather data, use this example program to
upload it to your PC, and then use some other program to analyze or graph the data. Some people have built optical scanners based on RIS using these techniques.
The example is comprised of three parts. The SaveDatalog subroutine does most of the work. It uses the min function to calculate a minimum and the getTypeString function to convert
the datalog item source number to a descriptive string:
Sub SaveDatalog(filname As String)
Dim data As Variant
Dim index, length, stepSize As Integer
Dim line As String
With DummySpiritForm.Spirit1
Page 170
' Open the output file.
out = FreeFile
open filename For Output As #out
.InitComm
' First get item zero, which describes the length of the datalog.
data = .UploadDatalog(0, 1)
length = data(2, 0) - 1
' Now upload 50 items at a time.
index = 0
While (index < length)
' Find the smaller of the remaining items or 50.
stepSize = min(length - index, 50)

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