Introduction to Lego Mindstorms Robots and RoboLab Environment

Topics

Describing Exercise Format, Introducing Mindstorms Robots and the RoboLab programming environment. This lab is designed to make you familiar with Mindstorms Robots (RCX Hardware) and the RoboLab (Software) programming environment. I will also explain how each lab is developed.

 Exercise Format: Each exercise will consist of three sections.

·         Pre Lab: You are required to finish the work before you come to class. You are required to submit the results of the pre-lab works in order to start Lab work. Required resources are available free online. However, you can ask me by email if you struggle with the Pre-Lab.

·         Lab: You will do this portion of the work in class during lab time. You are required to submit your work at the end of the class.

·         Post Lab: This portion of the work enforces the learning outcome of the lab.

Concepts Learned:

Lego Minstorms's Hardware and RoboLab Software Environment, Motors, Programming, Debugging, Downloading Program.

Handout

Pre-Lab:
Concept: Hardware

  1. What is computer hardware?
  2. What is embedded computer system? Give an example of embedded system.
  3. What is Lego Mindstorm Robots? What kind of system is this?
  4. What are the Lego Robot's most important hardware components?
  5. Create a table comparing Lego Mindstorms Robots and Desktop Computers?

Concept: Software

  1. What is computer software?
  2. Is RoboLab software? If yes, what kind of Software?
  3. What is a Program?
  4. How can you control Robot?
  5. Getting familiar with Programming environment (Installing, Coding, Debugging and Testing).

Lab:

In this Lab, You will identify various hardware components of Lego Brick. You will also get to know your RoboLab Programming Environment. You will download two pre-programmed programs into your robot. The idea is to make you familiar with Programming Environment.

Task 1: Download the following program and run it.  

 

Task 2: Download the following program to the robot and run it.

Please note that if you are having trouble, feel free to ask.
Submit the answers to the following questions before the next lab.

1) What does Robot do after you have downloaded the first Program to the robot?

2) What does the second program make the robot do?

3) Describe the programming errors (if any)?

4) Describe the logical errors (if any)?

5) Compare the first program and second program in your own way. Describe their similarities and differences.

6) Make sure to take notes, anytime you learn something new that you did not realize before?

 Post Lab:

1) Were you able to finish the lab in one attempt?

2) Did you encounter any problem?

3) If yes, describe, what kind of problems did you encounter? How did you solve the problem?

4) What did you learn from the lab?

5) Did you learn anything new that was not discussed during the lecture or you did not read in the book? If yes, please describe your learning.

 

 What is program?

Programs are written to do some specific tasks in a particular environment. Any computer program should be capable of doing the following three things:

§         The program will take the input

§         The program will process the information.

§         The program will produce the output.

People who write these programs are called programmers. Programming environment is required to write a program. There are numerous programming environments out there. Each programming environment requires the skill set of particular programming language. For instance, if you need to write a Java program, you need to know how to write program in Java programming language. Programming is more than just writing the codes. Usually, the most popular high level programming languages are C, C++ , Java, Python, Ruby etc. It is also about analyzing and solving problem by using algorithm (i.e. the way to solve the problem). If you know how to analyze a problem, then you can always overcome the learning of programming language barrier. For Instance,

§         Our programming environment (Software) is RoboLab.

§         Programming Language is RoboLab graphical language.

§         You are the programmer.

§         You are programming the RCX Programmable Bricks. RCX is called the programmable lego brick because we can program the brick to do various tasks.

How do I program?

There are three parts to programming the Lego robot. We will use the RoboLab programming environment.

Step1 (Coding):

First, we will use the existing program. Later, we will modify the existing program or write new program.

Step 2 (Debugging): In this step, you will try to see if you have any error. If you have error, then you need to go back to the RoboLab programming environment to fix the error. If the compiler does not generate error, then you don't have any syntax errors. You might still have logical errors. If you have any logical errors, you will find that out when you run the program.

 

Step 3 (Testing): This is the testing phase. Unlike other programs, which are usually run on a computer, our program needs to be run on a physical robot. We need to first transmit (send our) code to the robot and then try to test our code.

Step 3.1(Downloading the Program): Download the program to the RCX via IR tower. Make sure that you turned on the robot before you click on the "Download " icon in your RoboLab environment. After you have successfully downloaded the program, go to next step.

            Step 3.2(Testing the Program): Test the program to see if the robot works accordingly. You need to press the "RUN" button to test your program. Write down what the robot is doing. If it does not do anything, you need to debug your code again.

More about running program using RoboLab.