Presentation is loading. Please wait.

Presentation is loading. Please wait.

1chung Robofest 2007 Introduction to RoboLab Workshop Feb. 3, 2007 Maurice Tedder

Similar presentations

Presentation on theme: "1chung Robofest 2007 Introduction to RoboLab Workshop Feb. 3, 2007 Maurice Tedder"— Presentation transcript:

1 1chung Robofest 2007 Introduction to RoboLab Workshop Feb. 3, 2007 Maurice Tedder

2 2chung Student Assistant Emily Trudell and Joe Long Sat. 9AM-12PM

3 3chung Agenda Intro to RCX Intro to RoboLab 9 Class Missions (somewhat related to the Robofest Game 2007) Programming Tips

4 4chung LEGO MindStorms 101

5 5chung LEGO MindStorms® Overview – Robot Command Explorer (RCX/Brick) Hitachi H8 16MHz 8-bit microcontroller with 32K ext. Ram 16K ROM contains power up driver 16K of firmware can be downloaded to extend the on- chip driver User programs are downloaded to the RCX as byte code in 6K region of memory Firmware executes and interprets the byte code of programs when instructed

6 6chung LEGO MindStorms® Overview – Robot Command Explorer (RCX/Brick) Infra-red (IR) ReceiverIs a sensor that accepts the program being transmitted from the IR tower. Also transmits data. Sensor Input PortsInput ports 1, 2, & 3 are used to attach sensors to the RCX (0V/0 – 5V/1024 A/D) View ButtonUsed to obtain feedback from the input and output ports On-Off ButtonManually turn the RCX on and off Motor (output) PortsUse output ports A-C to connect any combination of motors LCD DisplayDisplay different values and information regarding the RCX and programs AC/DC Power InputThe RCX can be powered by plugging into a 9 Volt adapter (not for recharging batteries) Program ButtonUsed to switch between programs 1-5 Run ButtonPress the Run button to activate and run your current program Speaker (not shown)Internal speaker indicates RCX status and acts as a programmable sound output

7 7chung What Is RoboLab? A Graphical programming language For the RCX based on LabVIEW In 1997, LabView was used for Sojourner project By designing a flow chart with given icons the programmer can program the RCX

8 8chung Writing a new program Click on the Programmer button. You should then see the Inventor login screen. Double click Inventor 4 to get full RoboLab environment. Introduction to RoboLab – Programming Environment

9 9chung ROBOLAB Environment Set up your screen in Inventor 4 so that it looks like the screen to the right.

10 10chung ROBOLAB Environment There are two major pallets that contain most of the icons and commands you need to build a program. If you cannot see these pallets, you can find them under the Window -> Show drop down list. Tools Functions

11 11chung RoboLab Workspace Functions Palette – Contains Icons for all possible RCX program commands. Icons vary with Level Tools Palette – Contains Icons for building a program diagram in the RoboLab workspace Context Help – When this window is open it displays Help information about the Function Icon under the mouse cursor Example Program – All programs begin with a Green light and end with a Red light Icon Search – Click the Search tab to find a Function Icon in the Functions palette Menus Sub Menu Icons – Icons with the right side black dot have sub menu Icons

12 12chung Tools Palette Operate Value tool: Change values in the Workspace window Wire Tool: connect icons in your program from start to finish Set/Clear Breakpoint: allows you to suspend the execution of your program Set Color Tool: allows you to set the colors of objects in the Panel and Diagram windows Scroll Window Tool: move around in the Title or Workspace windows Arrow Tool: move, delete, or place icons in workspace window Automatic Tool Selection: Automatically senses correct tool to use Get Color Tool: allows you to copy a color from an image and use it as part of the color palette Probe Data: allows you to check the program for values Object Popup Tool: modify settings for items in the Workspace window Edit Text Tool: edit or insert text boxes

13 13chung RoboLab Programming Elements Forks – equivalent to if/then selection structures Task – run multiple task simultaneously (8 max.) Wait states – program execution will be halted until the wait state condition is satisfied Loops – to create repetition structures in a program Subroutines – a segment of code that can be called repeatedly from another code segment (8 max./program slot) Events – jumps to the specific section of code when the specified event occurs

14 14chung RoboLab Capabilities I Read Analog input values Output PWM on the output ports Subroutines Multitasking Event monitoring Multimedia Image/sound processing and capture Access all RCX Brick input/output interfaces (buttons, LCD screen, etc.) Music and sound functions

15 15chung RoboLab Capabilities II Data logging (2000 pts. @ 100Hz) and processing functions using G-Code (can compute basic statistics to derivatives and integrals) Basic Logic and Math functions Variables (47 total, 22 user variables) IR Communication functions Direct program control functions Internet functions User defined libraries LASM functions (LEGO assembly language) Control lab interface functions

16 16chung Pros to Using RoboLab Easy to see control structure Visual interface is simple Exactly like LabVIEW Data gathering and visualization (investigator)

17 17chung Cons to Using RoboLab Spaghetti code Hard to wire icons… No edge triggering supported

18 18chung For More Information LEGOs Page National Instruments Page Tufts University mages/eng/downloads/compare.doc

19 19chung What is a computer program? A list of instructions created by a computer programmer (you) that tell a computer what to do next Your job as a computer programmer is to: Decide how to get from point A to point B using a bag of tricks (instructions) For the LEGO Robot, instructions = Picture Icons connected together to form a program A (what I want the program to do) B (program doing what I want it to do) LEGO RoboLab Function Icon Palette

20 20chung An Introduction to Structured Programming (or How to get from point A to point B) Structured programming philosophy states that all programs can written using only three single entry/single exit control structures 1.Sequence structure: is built into RoboLab and means that statements are executed sequentially one after another as along the chain of connected icons 2.Selection structure: chooses between alternative courses of action (makes yes or no decisions) 3.Repetition structure: tells which actions are to be repeated while some condition is true Programs are built in structured programming by stacking and/or nesting as many control structure building blocks as needed to solve the problem

21 21chung RoboLab Control Structures Sequence Loop/Repetition : Decision: Fork Subroutines: Multitasking:

22 22chung Ex 1: Go forward 2 seconds and come back by reversing motors

23 23chung Making Turns Turn left: Spin left: (point turn) Face left: Left wheel Right wheel Left wheelRight wheel stop

24 24chung Ex 2: Go forward 1.5 seconds and come back by spinning left Spinning 180 degrees? Is it accurate?

25 25chung Tips How to insert icons? How delete icons? How to save programs? How to use the Icon search feature? Cover the tower and RCX when downloading, if more than one robot in a room! Use Meaningful file names Add Comments using A: edit text

26 26chung Sensors Light Touch Rotation Temperature Timer – Internal sensor RCX buttons

27 27chung Light Sensor Percent mode 5% - lowest dark 100% - very bright Reflected light mode: shines a red light Use View Button

28 28chung Light Sensor Readings Source:

29 29chung Attach a Light Sensor Facing down Gap: around 1 cm (What will be the problem if less than 1 cm to solve the Miner Rescue problem?) Port No. 1

30 30chung Ex 3. Go straight until the edge of the table is detected. Then stop the robot

31 31chung Stop when it sees the black line on the Miner Rescue field Measure and record the following values White shelf Black line Foil Outside Edge Start of the ramp from the miner field and the home base: why? The big gap! Suggested to lower the power level move down slowly

32 32chung The gap between the Light sensor and the floor!!! Both Reflected and Ambient light values are affected by the distance between the sensor and the floor! The light sensor value is in inverse proportion to the gap Light sensor Light sensor

33 33chung Stop when it sees the black line on the Miner Rescue field

34 34chung Ex 4. Stop when it sees the 2 nd black line on the Miner Rescue field What went wrong?

35 35chung How about stopping at the 4 th line? Loop (Repeat) Block

36 36chung Touch Sensor If released (not pressed): 0 If pressed: 1 Is it very sensitive?

37 37chung Attach a Touch Sensor Port No. 2

38 38chung Ex. 5 Loop until a touch sensor is pressed Display seconds until touch sensor is pressed.

39 39chung Line following - Zigzag methods

40 40chung Ex 6. Follow the black line until a touch sensor is pressed

41 41chung Ex 7. Follow the line until it detects the foil Need max power to climb

42 42chung Ex 8. Follow the line until it climbs back to the home base

43 43chung Ex 9. Follow the line until it climbs back to the home base – Use Subroutines

44 44chung Not covered advanced topics Variables Multiple tasks & Synchronization of multiple tasks …

45 45chung Tips for Robofest 2007 Game Line following may be needed for RCX Light sensor needed for detecting balls in the tunnel or edge

46 46chung Tips for RoboSumo Light Sensor to detect the ring edge Touch sensor to detect the opponent Theories in physics

Download ppt "1chung Robofest 2007 Introduction to RoboLab Workshop Feb. 3, 2007 Maurice Tedder"

Similar presentations

Ads by Google