Unformatted text preview:

ROBOLAB INTRODUCTIONMAE 1170(I) Starting OutWe will be using ROBOLAB 2.5, a GUI-based programming system, to programrobots built using the Lego Mindstorms Kit. The brain of the robot is amicroprocessor called the “RCX” which accepts programs through an IRtransmitter which should be attached to your computer.1) Get a yellow RCX controller and turn it on. Notice the 6 ports on thedevice; ports 1, 2, 3 for attaching sensors and ports A, B, C for attachingmotors and lamps. Things attach to the RCX using the black cables in yourkit.2) Examine the infrared transmitter which is connected to your PC. Byplacing the transmitter a few inches in front of the RCX’s “infrared eye,” aprogram can be transmitted wirelessly.3) Using the VIEW button you can directly see values of the sensors hookedup to the RCX. Use the PROGRAM button to cycle through the 5 programslots and hit RUN to start/stop the program. TransmitterLongRange/Short Range Switch4) Now, click on ROBOLAB 2.5 under the PROGRAMS → ROBOLAB menu on the Start button. Click on the PROGRAMMER button and double click on INVENTOR 4.5) A large graphics window opens up, and you will see a green light and a red light (this is the DIAGRAM window), a functions palette with lots of buttons and another window on top of the graphics window with instructionson how to return to the main menu. Every program starts with a green light and ends with a red light. 7) Move the mouse to the DIAGRAM window. By pushing the TAB button youshould be able to get four different mouse pointers: - Arrow: use to click on objects and highlight them – (i.e., for deletinguse the arrow to highlight an object and press the DEL key to removeit). It can also be used to drag objects around the screen- Hand: double click on an object for information on the object.- Spool: use to wire things together- Text: use to add text boxes and labels- Right Click on an object to use for other options, such as gettingdetailed help or replacing it directly with another object.8) Let’s take a closer look at the functions palette:9) Check out the arrow in the top left of the DIAGRAM window. If the arrow isbroken, your program cannot run and you can click the arrow to list theerrors. Once the arrow is solid, you can click it to transfer the program to theRCX.(II) ExamplesThe motor objects turn motors on and off in therespective direction. Use STOP signs to turn motorsoff.Below the motors and stop signs (top half), you seemany other icons which open up new windows. Wewill be primarily using the top row, namely theWait For, Structures, and Modifiers.Wait For: Can wait a specified amount of time, orfor a sensory input.Structures: Allows you to split tasks, createsubroutines, or generate loops within your program.Modifiers: Modifies either the “where” or the“what” for program objects. For example, use themto specify which light sensor port to use or themotor power setting.9) Let’s start by building a simple program. Press TAB until you get the arrowtool. Drag a “motor A forward” and “motor C forward” object to the DIAGRAMwindow. Now go to the Wait For window and pull in a “wait for 6 seconds”object. Then, drag in a “motor A reverse” and “motor C stop sign.” Rightnow, your program should look something like this:Use the spool tool to run a wire from the END of the green light to the BEGINof the “motor A forward” object. Similarly, wire everything in the sequencetogether until the red light. Go to the Modifier window and drag the“power level 2” object next to all the motor objects. Wire the modifier objectonto the appropriate slot on the motor using the spool tool. The arrow in the top left of the diagram window should now be solid. Set upthe RCX and IR transmitter correctly and click the arrow to transmit theprogram. Ask a TA for help if you experience problems with this step. ClickYES if it asks you if you want to use program slot 3 since program 1 and 2 arelocked. Try out the program! Does it do what you think it should?10) Next we will up the complexity a bit and familiarize you with the basictools you will need to do the lab. Delete spool lines in your current programby selecting them with the arrow and hitting delete.Create and transfer the program below. Objects you will need are the “loop”icons in the Structures window and the “wait for dark” and “wait for light”objects in the Wait For window. The “numerical constant modifier” can befound in the Modifier window, and can be edited using the text tool. Makesure the program works correctly and explain each element to a TA beforemoving to the next step.11) As a final example, build the simple looping program pictured below. Findthe “loop while light sensor is less than” loop in the Structures window. Addthe sound objects from the main functions palette and modify them to thesounds of your choosing. You should find that your RCX makes noiseswhenever the light sensor senses a white surface, and this behavior repeatsbecause of the loop.(III) Programming StrategyUsing a combination of the tools, you should have no problem programming arobot to follow a black line. But instead of diving directly into programming, use this general strategy:1) Identify the key actions you want your robot to perform.2) Write “pseudo-code” in English on a separate sheet to specify the steps of your program. An example of pseudo-code would be the following:- Motors A and C on (power level 3)- Wait till touch sensor is pressed (port 2)- Reverse Motor A- Turn off motor C3) Execute and build the program in ROBOLAB using your pseudo-code as anoutline.4) Troubleshoot! Almost no programs work correctly on the first try. Analyze what is happening (Is the robot overshooting? Is one motor overpowering the other?) and iteratively perfect your algorithm and/or


View Full Document

CORNELL MAE 1170 - ROBOLAB INTRODUCTION

Download ROBOLAB INTRODUCTION
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view ROBOLAB INTRODUCTION and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ROBOLAB INTRODUCTION 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?