Lab 1: An Introduction to LEGO Mindstorms:

Building and Programming the Tankbot

 

Introduction:

 

The LEGO Mindstorms robotics kit is the hardware that will be used throughout the semester for the lab session of this class. The kit comes with LEGO parts to build your robot. LEGO supplies a visual programming language (which is called RCX Code in the textbook), which we shall use for this exercise.  In subsequent labs, we’ll use a more traditional computer language to enable more complex programs.

 

The purposes of this lab are (1) for you to inventory your Mindstorms kit, and (b) to familiarize you with the LEGO kit and software environment. 

 

Aim:

 

1. Build Tankbot (Chapter 5 of Baum)

2. Make it run the RCX Code on pages 88, 91, and 94 (next week we will begin using NQC, the textual programming language).[aal1] 

3. Modify the program to make the robot run a specified path to a target (for example, a foot forward, turn left 90°, go a foot, turn right 90°, go a foot, stop).

 

We will evaluate the lab based on (a) how well your robot follows the path and close it comes to the target, (b) how fast it gets there.

 

What You Need:

1)      A laptop computer or one of the computers in the lab

2)      Your Mindstorms Kit (which you will get at the beginning of the lab period)

3)      Your textbook

 

Procedure:

 

Building Your Robot

 

In order to familiarize yourself with the structure of the robots, look at the designs in the manual with the kit. Follow the directions in your book, starting on page 83, and then use the directions below, as well as the directions in your text, to help you program your robot.

 

Programming Your Robot

 

NOTE: These instructions are meant to familiarize you with building and programming your robot; however, do not be too dependent on such specific instructions. Instead, attempt to figure out what you want to program before you follow the instructions step by step. Although the instructions are correct, there can certainly be some variation or improvisation on your part if you want to be creative.

 

Part 1: Driving Straight

            Follow the directions on page 88 of your text to get your robot to drive straight (only the visual programming blocks—disregard the textual code for now).

            Once you have done this, read the next example under the heading “Turning.” Code the examples listed in Figures 5-12 and 5-13.

 

** When you are ready, ask the lab assistant to check off this milestone.

 

Part 2: Following A Path

            Now that you know how to get your robot to drive straight and turn, modify your code to enable your robot to travel from a starting point to a target point by following a specific path given to you by the lab assistant[aal2] . 

 

** When you are ready, ask the lab assistant to check off this milestone.

 

Tips and Tricks

 

·        Remember to keep your program corresponding with the actual ports you are using. A common mistake is to program the wrong port!

·        Utilize the various commands in the RCX program. One of them, the ‘wait’ command, basically allows an action to continue status quo without being interrupted for a specified amount of time.

·        Think in small pieces as you program. If your robot is not doing what you want it to do, think through what each ‘action’ in the program really means. Don’t assume anything about your robot’s behavior; what it will do is plain and simple. It’s up to you to manipulate these actions into a complex program.

 

 

Lab Report:

 

This is a very short report. Just describe your design for Part 2 of the lab.

 

 

Grading:

 

Since the lab report is very short, it will count less than normal (25%), while the completion of the lab will count for 75%.


 [aal1]What are the page numbers in the book?

 [aal2] Just a path, right? No obstacles for this lab.