RSRC LVINLBVW;rd ;rD`@@ ,*ܛc/ ܛc/ ُ B~h4M? GI LVINROBOLAB 2.9.4.viP9 cL P d-` cpP"@P@flg@oRt@eofudfP0RootFolderName p0dfd P0txd P0old P0ext8 P@@@0 cP"@P@flg@oRt@eofudf$P@0FileDataStructurep@0dfdP@0txdP@0oldP@0ext8 P@@@0 cP"@P@flg@oRt@eofudf&P@0MasterPathListp@0dfdP@0txdP@0oldP@0extnP"@P@flg@oRt@eofudfP0 FileLaunched x0dfd P0txd P0old P0exth!Wait until done`0name or relative path`0 Control Name`0 Control Name`0 Control Name`0name or relative path`milliseconds to waith!Front Panel Window:Open`!Wait until done c$@0 FileLaunched p@@P @!status @code@0sourceerror in (no error)@milliseconds to wait@!Wait until done@!Auto Dispose Ref@0 Control Name @SValue@0 Control Name @SValue@0 Control Name @SValue@2 appended path@2 appended path@2path@0RootFolderName($@@0FileDataStructure*&@@0MasterPathList cH c c< c<"b@Set Control Value Variant c@ c< c@ c< c@ c< c@ c  c c c@ dP``` d<:x@P>" ROBOLAB 2.9.4MBud1 IlocblobDataIlocblob!Datafwi0blobicnvDataicgoblobImagesIlocblob!Imagesfwi0blobNlsvImagesfwswlongImagesicgoblobImagesicspblobImageslsspblobMoviesIlocblobZ!MoviesicgoblobProgramsIlocblob}ProgramsicgoblobProgramsicspblobROBOLAB 2.9.4.viIlocblobv!SiteIlocblobv}SiteicgoblobTempIlocblob}TempicgoblobTextIlocblobZ}Textfwi0blobicnvTextfwswlongTexticgoblob  @ @ @ @ E DSDB ` @ @ @ RSRC LVINLBVWo |`@A<ܮ$z< ܮ$z< ُ B~jo_{ $LVIN Autorun.viLVINBuildRoboPage.vi& p @!change?@@j@Intro Playing with Controllers and the NXT

April 24th, 2007

Chris, Chris, and Yves Table of Contents

#contents StartUpStartUp NXT/SysQuake Communication

To start with, we played a little with the new connection between SySQuake and the NXT using direct Bluetooth Commands. We did this by the following code:

use legonxt;

try

fd=nxtopen('/dev/cu.legway-DevB-1');

catch

fd = 3072;

end

// play a cos wave to check connection

for t = 0:0.01:6*pi

nxtplaytone(fd, 740 - 200 * cos(t), 0.1);

end

//nxtclose(fd); // close connection

First load the driver file, then open the NXT - after setting it up in the System Preferences on the Mac, and then sending out a cosine wave of frequencies. Note that if you closed the NXT it would close the connection before the music was played.

Next we started to play with a little LEGO car.

Open loop responsemOpen loop response Open Loop

The first step is to measure the open loop response. We did this in robolab - although the goal is to some day have it all run out of SysQuake. Below is a simple code that have the car move forward while measuring the angle every 10 msec. You can run it by clicking here - and then click on the graph to add new data to it. doggy.jpg DefaultProgram 1.viDataSet001.txt SysQuakeSysQuake Read in data file

file=fopen(getfile)

while ~feof(file)

a(end+1,:)= fscanf(file,'%f %f')';

end

extract columns and subset

time=a(:,1)

pos=a(:,2)

time2 = time(time > 0.2);

pos2 = pos(time > 0.2);

linear fit

Phi=[ones(size(time2)),time2]

theta = (Phi' * Phi) \ (Phi' * pos2)

plot both line and curve (theta is y0,slope)

clf

plot(time',pos')

line([theta(2),-1],-theta(1),'r')

Find difference and fit exponential

difference=pos-time*theta(2)-theta(1)

difference(difference<0)=0

plot (time,difference)

plot (time(1:end/4)',log(difference(1:end/4))')

and do a fit

theta = (Phi' * Phi) \ (Phi' * log(difference(1:end/4)))

define tau (response) and alpha (gain)

tau=-1/theta2(2)

alpha=theta(2)

and plot

clf

plot(time',(alpha*time+theta(1)*(1-exp(-time/tau)))')

plot(time',pos','r')

FitPlot.jpgNonlinearPart.jpgTotalFit.jpgexpPlotjpg.jpg Close LoopQClose Loop Thus we have the model and all that remains is to implement a controller which we did with the PID_ct.sq, which resides in the Contents of SysQuake. It has a front panel that looks like:

The second portion of the work was to have SysQuake and Robolab talk. As a temporary solution, we wrote a quick code that talks over TCP/IP - the code is below - you have to enter the correct IP address before running the program - and then SysQuake will send a number - that is Kp - and a new program is loaded into the NXT. Then you can grab the data and when SysQuake sends "data" these data will be sent back to SysQuake and plotted next to the simulation results.PID.jpgYves.vi #define PageTitle[TITLE,FONT]=T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%* $&'0'()#)($( (\))L$`*<$$%%P''l33334(`l (dTL !!!"""8"T"p"""#3CODE rX7p(`q7.0b71Oldest compatible LabVIEW.?@>:<llpfPPRP@0 StyleSheet@@0data@Contents@0info~NI.LV.ALL.VILastSavedTarget0MacNI.LV.ALL.goodSyntaxTargets%@0Mac99ݽwp1 1`p     <DTHPD^9P884;~@0Folder^N p @!change?@@j@G@FSD@lBkUndo.viWD ReadBook.vi%.0f%.0f%.0f%.0f%.0fFPHP Autorun.viFPHPD^8~ rt&^^-4X>F\"<:cXXLlH wl\ p 4 7,  H||4Q4E || , x@d\ d1. ( ^ 10||4 L dPx4 N EuPx8hBT4 2 I }Px0  Ed<  P T  d 0 dd\" .d` ]x|4 d t@PldA ~H|<   $ T0 _ ~8hBPM@PldA ~x d86 ~bk@8 6 ~kHk,0 _ ~8 hBP<N | | | 0 rd& 8*0 sd 0 sd, *0 Ud .d8 hdB dR |0 rd' 0  !d4 |4 0d (k0 | |8 6 Pbrrx@PlLA Pb@+8h BM|0 _ Pb86 Pbrr0 _ Pb|$@PlLA Pb*0 rL' -0 zL& 8h8h B \ HN0 UL d1d8hLB R4 0L 0 sL h0 wL, -0 )L|4Q<j@L|,l 4 N  Yh8h B,T4 2 n}0  jd0AM $6,4 <,< 4|< P ..^BDHP Autorun.viLVINBuildRoboPage.viPTH0LVINGetPathtoFile.vi <PTH0LVIN ShowPage.viPTH0LVIN ReadBook.viHHPTH0LVIN_RB2Globals.vi;PTH0LVINUndo.viC\PTH0L BDHPD^&8M 9 yL~ r99^*^\#KcS,55H50( T | TH D1H. (4 &KKX8 p@x D 43 & " (43\   p43  p 43, .& `@43@ 43&.* P43 &. * x43x 434 ,tD @H4QH ,<p4 J  `]4  2  ]H0   8hB||440430&"  \ p  \D1 ,P?  < (  < 4 &K <O] P43 < 43 <  <9H |843 < ( 43 <   <  , @ ,4Q ,  8| , ,  LH0  L 8h LB p |4 J L `Xp4  2 L X(4 704/DYy  L t T40 `ri0@P64K6VF4/,  :Ph H ,  L T40 40 40 ,  ,42  THLiiL)2MA] WGS3p,H=<B0A4p0@ $lG|gtWT4 J$]Gl{`],P4 jy`W4 r`W84  `Xt,HL0LE(0$24 J 6o`X\4 B6`X0@P6l J<, L4 $pu`r 6hd !$HBdMulticolumnListbox (strict) v!h!t4! JB`WT,"ht "(h"0"=BOH "0"?BOH0">0"@" "6lJ" "X "68Kt@"PBB3 ""@"ABِ" "(X,"H((d1H "B@`0"3$ " @L8"t.L U`D#1p,8I@/@ # 4# &KmL$$0$`C.4$ B`P %4%3F %@0%*H $DAJE %B`4%@p %BP6`% %@@H`H%E\%E4%3XE % %@ %l 4%3H4%38G%L4%L0%$<%,%H8 %B`0%L24,%JxL%D%$ %@$4%  2x 4&QK8&hxB(&|0& x &|0&@<< l4& B<`X'<$''  ,'H(,((H,'L$| 'B`0'|2,'x  D'2| St ' P"!"4' K P[TL( ( 4(g P NStc4(Q"<K!O(|(",(!"8"l"4( J!D 1K`X8)h!DB!xl4)  2!D ?J] 0* !D <K,*!P!DP *@"""4*|#'d0*" d*!# #/W%x%VIp u+#+$,+#$$t$%( +#8-$D.t +#81$.t+$t0+#8#Q #0) +#8%H$t +#8$$t0+#8#R JWP0+#8%TJWP+$ +#8),%'0+#8$0S#0)+% +$D$%H$@+#8%#.W&=+%(<+O'8-&<9+&&&l+'8+h&B@+ 6&-))*4+ J&`# ,@@),'8',,@&X:&T,"Cc, P," P,",@#8,'%(,,'#8,$H,),&&=4,((!4,/)$0JE,),*<,)***+<++,t ,)`*L+< ,)`-t**,*4,0)`)3($0 ,E ,)`+\* ,)`**4,0)`)2( 0,E4,0)`+(0  E,* ,)`,,+<4,0)`*81$ E ,)`++4,0)`+-E ,+ ,)`5,4,+4,0)`,`/$ E,+< ,)`,,t4,0)`,( E ,,t4,0)`,, E 4,..p0,*H.('A JE4,/ /(p ,B-D* ,BP-D* ,B-D* ,B-D*,,---..T.t ,B@--D* ,@@H-t-D*,.T#\,-)E),*.tH,-tE,4,//'=KF,0,0$,00$0,$3 ,/p0X0$ ,/p00$,04,0/p/&5'=#9F ,/p10*4,0/p/%'%#!F4,0/p0D$% !F 4,/4p,,1-), ,B1*4,33p0,*H2#   ,B1*, .t3P,,x$<-1t ,BP1* ,B1*,,1t12`233P,,".2,, -2`,, '.T3 ,@@H11*,`-D1,3P0 ,B@11*H,1  !\,1P  P4,/4 ,4,4 ,4l5444,04l4",,4l/p)`$H,,4l)`H/p,4+4,5t52,,51-tH,54,$LxE4,$LF0 4,$L\G<04,$77$p ,h\,6HEH, 4,/85,8,8,88 ,8,9H88 ,8,:P9 4,08,8`4,08,8t4,9|:0 ,8 \<,6XFK @ L <D(B aC ;i 1 ;i , 84,:4;02 ,9H,:PD,2LX,-=> ??AH@h<- =$;8, , <4- J>L *L`S\@.P v>LB45? YH.R=DL=pX@\8. v>  5X X@0 6>  @ hhh0|,0>>?@8?L80h> B? <00 W>L 700 w>L :I0|@0 6>   ggg00 _>  580h>LB@?0|40Q>L:I@Z,0ABTBAx40 J@ :`P01 U>L 7L81h@BAA1|1|,1 ,-1=$41B8B01=$< 41 2@ =HP02 @ :I,2B:P9HL H2BAn1EH ;i D21$CC?_4^Z0 2C\DDC42 &KC\?m]&d3CD$Dx3C 3C\DD$433C\D[O_W 3C\6DK433C\E]?OG433C\E\?OG3D$3Dx,366686lG ;i 1 ;i 1 ;i 36836l,,,36FGaL ;i 1 ;i D31$HH0`8!@3I3I43 &KHH]&04IIIJ<JJKtK 4HHILI4I443HHH_ 4HHII 4HHJ\I443HHH<443HHJ(84J< 4HHIJ<443HHI8; 4HHK,J443HHJ64J 4HH6lJJ4Kt443HHK`74J 4HH68KKt443HHK44K 4HH6KK443HHK5,4HHC\4 4K Dx4Kt,4PHHC\4J ( @@? AAB A@?f8  F T b d Lucida Grande Lucida Grande Lucida Grande00RSRC LVINLBVWo | 4dRSIDTLVSRhBDPW|LIviCPTMDSTMDFDSLIdsVICDversDLDRFPTD0CPMpDVITSXICONlicl8DTHPHOBJTRec(STRGLIfphFPHP|OMIdLIbdBDHPHISTPRT FTAB x=pl ^ p. ~ Š&$G' sР_?@_< w_\ ~p__ `X` v@d ylu u, {Su8uuv8 uiv } vA w$ W wp qw wx |xT C x'xðyT yڠy |+ y @zXz Az]`{HI{ w{ }`|T|P |"}P }^@$} ,%~ x&~d ݞp'~(~ wb`)X* y`, yh-` u4 . Z/ |ߐ1`023 t4`8# n  ی 0` }0 ~!$#+ @o4\ P0 Autorun.viBud1s.txtIl Pages.txtIlocblobZ! templates.txtIlocblob!  @ @ @ @ EDSDB ` @ @ @Intro to ROBOLAB Introduction to ROBOLAB, covering Administrator, Programmer, and Investigator ROBOLAB, 2.9.4, Introduction, Manuals 0 RL_home.jpg Chapter 1 ROBOLAB 2.9.4 Book Contents ROBOLAB Sections What is ROBOLAB ROBOLAB and LEGO MINDSTORMS Administrator Overview Administrator: Select COM Port Administrator: Download Firmware Administrator: Test Communication Administrator: RCX/NXT Settings Programmer Overview Programmer: Pilot vs. Inventor Programmer: Using Pilot 1 Programmer: Other Pilot Levels Programmer: Using Inventor Programmer: Inventor Tools Programmer: Example Programs Investigator Overview Investigator: Starting Investigation Investigator: Writing a Program Investigator: Uploading the Data Investigator: View and Compare Data Investigator: Compute Tools More Resources TitleSimple.jpg #bookname #pagename URL=http://www.ceeo.tufts.edu Goto=#homepage Goto=#prevpage Goto=#nextpage Stop= PageNumber.jpg #thispage/#totalpages TitleSimpleCOM.jpg #bookname #pagename URL=http://www.ceeo.tufts.edu SelectCOM= Goto=#homepage Goto=#prevpage Goto=#nextpage Stop= PageNumber.jpg #thispage/#totalpages RL_administrator_up.jpga Goto=6 RL_programmer_up.jpg Goto=11 RL_investigator_up.jpg Goto=18 RL_administrator_down.jpga Goto=6 RL_programmer_up.jpg Goto=11 RL_investigator_up.jpg Goto=18 RL_administrator_up.jpga Goto=6 RL_programmer_down.jpg Goto=11 RL_investigator_up.jpg Goto=18 RL_administrator_up.jpga Goto=6 RL_programmer_up.jpg Goto=11 RL_investigator_down.jpg Goto=18 ROBOLAB 2.9.4
Welcome to ROBOLAB This book provides an introduction for first time users to the ROBOLAB (TM) software, a programming interface designed for interacting with the LEGO (R) MINDSTORMS (TM) Systems (both the RCX and NXT bricks).

To get started, click the "next page" arrow in the top navigation to progress through the book. RL_laptop.jpg nav_background.jpg
    Navigation
nav_home.jpg Goto=#homepage Return Home nav_prev.jpg Goto=#prevpage Prev Page nav_next.jpg Goto=#nextpage Next Page nav_stop.jpg Stop= Close Bookprint_button.jpgPrint=Create web-page version for printing Book Contents
When first starting ROBOLAB, the opening screen presents three options: Administrator, Programmer, Investigator (the difference is described on the next page). This book covers all three, detailing the topics shown below. Clicking on a section of this book will jump to that part, or selecting the next page navigation button (at the top-right of each page) will progress through them all sequentially. (The last page of this book provides addtional resources and links to more information.) General Introduction

* Description of ROBOLAB Sections

* What is ROBOLAB? (overview)

* ROBOLAB and LEGO Robots RL_administrator_up.jpg Goto=6 * Administrator Overview

* Select COM Port

* Download Firmware

* Test Communication

* RCX/NXT Settings RL_programmer_up.jpg Goto=11 * Programmer Overview

* Pilot vs. Inventor

* Using Pilot 1

* Other Levels of Pilot

* Using Inventor

* Inventor Tools

* Example Programs RL_investigator_up.jpg Goto=18 * Investigator Overview

* Starting an Investigation

* Writing Investigator Program

* Uploading the Data

* View and Compare Data

* Compute ToolsRL_home.jpg ROBOLAB Sections
When first starting ROBOLAB, the opening screen presents three options:

* Administrator

* Programmer

* Investigator

Administrator

The Administrator option allows you to adjust the RCX or NXT settings, set locations for files, test the RCX or NXT, and hide the administrator button. (If you hide the button, use the F5 key to bring back the Administrator button.)

Programmer

The Programmer option takes you to the Programmer Main Menu screen. From this menu, you can select either Pilot or Inventor programming as well as the programming level with which you wish to work. Programmer is primarily for robotic challenges.

Investigator

The Investigator option takes you to the Investigator Main Menu screen. From this menu, you can select the project on which you wish to work. The projects can include pictures and text descriptions, the program for the RCX or NXT, and the data collected on the hardware. Investigator is primarily for science exploration and investigation. What is ROBOLAB
ROBOLAB is a simple yet powerful programming language that allows the user to program LEGO models (both with the RCX and the NXT hardware) to autonomously perform tasks.

This guide and software were developed by the Center for Engineering Educational Outreach (CEEO) at Tufts University (Massachusetts, US). The CEEO works with schools to help them integrate the teaching of math, science, reading, and writing into the solving of engineering design problems.

The design and programming components of robotic-based projects promotes integrated learning. To support this, we have developed the ROBOLAB software with LEGO Educational Division and National Instruments (Texas, US).

This guide will introduce you to the ROBOLAB programming environment (specifically ROBOLAB 2.9.4). You will be led through the three main sections (Administrator, Programmer, and Investigator), learning the keys to very basic programming. This is meant to act as an introduction, as other resources exist for progressing to more challenging levels.ceeobanner.jpgURL=http://www.ceeo.tufts.edu ROBOLAB and LEGO MINDSTORMS
ROBOLAB is just one method for programming your LEGO MINDSTORMS systems.

The heart of the system is either the RCX (pictured left) or NXT (shown on the right). These are autonomous programmable LEGO microcomputers. The RCX and NXT intelligent bricks can receive input from its environment sensors, internally process data, and signal output motors and lamps to turn on and off.

Your computer communicates with the RCX via an infra-red tower. This is how the RCX is programmed and data is returned. The NXT uses a USB cable to talk back and forth with the computer (bluetooth is only used for direct NXT-to-NXT communication, a feature supported in ROBOLAB 2.9.4 and higher). See the official documentation provided with your kit for further instructions regarding these components.OverviewRCX.jpgOverviewNXT.jpgImport ports (for sensors) are numbered: 1, 2, and 3 (and 4 on the NXT)

Output ports (for motors and lights) are lettered: A, B, and C Administrator Overview
When you click Administrator from the ROBOLAB software screen, the main administrator window opens. From there, you can do a variety of administrative tasks.

Administrator Tab

* Basic maintenance and information including: Select COM Port, Download Firmware, Test RCX Communication, Hide Administrator Button

ROBOLAB Settings Tab

* Configure file locations, adding and deleting themes (themes are a collection of saved programs)

RCX and NXT Settings Tab

* Setting and viewing important RCX or NXT parameters including: Power Settings, Lock/Unlock Programs, Powerdown Time, Battery Level, Firmware Version

The next set of pages detail:

* Selecting COM Port

* Download Firmware

* Test Communication

* RCX/NXT Settings Administrator: Select COM Port
Admin_COM.jpgSelectCOM= Select COM Port chooses which piece of hardware (and what method) the computer communicates with the RCX or NXT. With the RCX, selecting the COM Port determines where the IR Transmitter cable is connected. With the NXT, selecting the COM Port identifies which NXT the computer is targeting. Click on the button above to try it outl.

Below is a screenshot of the Choose Hardware screen that lets you select the specific device. This will appear if you are using AUTODETECT.SelectHardware.jpg Administrator: Download Firmware
Admin_firmware.jpg Firmware is the low-level software that allows the RCX or NXT to run. It must be downloaded to the device before the hardware can receive and execute a program from the computer.

The ROBOLAB software always checks for the firmware and will automatically prompt for another download if necessary. Sometimes, like when the batteries are removed from the RCX or if you are using different versions of ROBOLAB, the firmware needs to be redownloaded. Click on the button above to try it out.

When the download is finished, you will get a message saying everything was successful.Run=Firmware.vi Administrator: Test Communication
Admin_communication.jpg Communciation Problems

From time to time you may receive communcation error messages. The error message that appears helps to detemine the likely causes of the error.

Test Communication

After the firmware has been downloaded to the device, it's time to test the communication between the computer and the RCX or NXT. The Test Communication button will have the device play a sound if communication is successful. Click on the button above to test it out.

Connect the device to your computer and have the RCX or NXT turned on before testing the communication.Run=CheckComm.vi Administrator: RCX/NXT Settings
Admin_RCXNXT.jpg The RCX/NXT Settings tab provides access to additional device set-up conditions.

When you select this screen the computer automatically looks for the RCX or NXT. If the RCX or NXT is off, or not connected, the communication error message appears. If the device can be communicated with, this screen updates with the current settings. Exiting this screen will automatically set the RCX or NXT to the new settings. Click on the image below to see the settings on your RCX/NXT.

Powerdown Time

Sets the amount of time the device will sit idle before turning off. The range is from 0 to 255 minutes. A setting of 0 means the device always stays on.

Battery Level

Provides a visual display of the current device

battery level.

Firmware Version

Provides a displayed statement of the current

RCX or NXT firmware version.Settings.vi Programmer Overview
Clicking Programmer from the ROBOLAB Software Screen opens the ROBOLAB Menu screen. Both Pilot and Inventor programming, with each of their four levels, are available from this screen. (The next page describes the difference between the two.)The Level section allows you to select one of the four levels. A single click on the Level shows the themes available. A single click on the theme shows the set of program choices available for each level and theme selected.

The Themes section lists the selection of ROBOLAB themes. My Programs is the default saving location for your work.

Available programs are shown in the Program window when the Level and Theme have been highlighted. You can add and remove themes in Administrator, ROBOLAB Settings.

Double clicking on a program you want to use opens it directly. Double clicking on the Pilot or Inventor level opens a default program for that level.

Highlighted programs can be deleted using the F10 function key. Be careful! Once it's deleted you cannot get it back.InventorMainScreen.jpg Programmer: Pilot vs. Inventor
The programming software has two options or phases. These phases are called Pilot and Inventor. Help windows are available for both phases.PilotInventorExample.jpgPilot

Pilot programming is the introductory phase. It uses an easy Click and Choose interface in a template that can be modified to your needs. Pilot has four levels, with Level 1 being the most simple and Level 4 having the most flexibility. The four levels build on each other, making it easy to advance to the next level as the user becomes familiar with the previous level's options. Pilot does not utilize all of the available functions of the RCX or NXT.Inventor

Inventor programming is the follow-up phase to Pilot. Programming is done by Picking and Placing the picture icons from the palette onto the Program window. Wiring them together creates your own program. Inventor programming has four levels, with Level 1 being the most simple and Inventor Level 4 having full flexibility and limitless possibilities. Programmer: Using Pilot 1
The Pilot phase comprises a series of templates that have a fixed format associated with them. This is an effective way to introduce the logical sequencing. It is impossible to modify any of the templates to create a program that fails. The program might not do what is expected, but it will run each time, and undertake the exact command sequence listed.

Start, End: The two traffic lights on the program template represent the start and end of the program. Between the two lights is a box showing the program that the RCX or NXT will run.

Run: Clicking on the white Run arrow will download the program to the RCX or NXT. If the hardware is off, or not connected to the computer, you will get an error message.

Below is an example Pilot 1 program. It turns on the motor connected to Port A. It then waits 4 seconds before ending the program. Clicking on the various components of the program allows you to modify them.MiniPilot1.vi Programmer: Other Pilot Levels
Each Pilot Level adds more functionality from the previous. For beginners, it is recommended to progress sequentially once you feel comfortable with the features of the current level.

The Pilot Level 4 template lets you carry out an unlimited number of sequential steps. However, while the program may contain multiple steps and all will be downloaded to the RCX or NXT, only one is visible on the computer screen at a time.

Insert: Click on this button to insert a step into the sequence.

Delete: Click on this button to delete this step from the sequence.

Previous: Click on this button to view the previous step.

Next: Click on this button to view the next step.

Pilot Level 4 can have as many steps as you need. Additional steps are added by clicking the insert button. The new step starts with all stop sign commands that may be changed. Above the step window is a counter that tells you which step you are viewing (e.g., Step #1 of 2).Pilot4Example.jpg Programmer: Using Inventor
Inventor Programming is the follow-up phase to Pilot. Programming is done by Picking and Placing the command icons from the Functions palette onto the Diagram window. Wiring them together creates your own limitless program. Inventor has four levels, with Level 1 being the simplest and Level 4 allowing full flexibility and creativity. Inventor uses the full power of the ROBOLAB environment.

Working in each of the four Inventor levels is very similar. There is a set of basic commands and procedures that are consistent throughout. What varies as you progress through the levels is the number of programming options available.

To help you become familiar with Inventor, the following are the several items that should appear on your screen after double-clicking on Inventor Level 1.Inventor1Example.jpg[Front Panel Window][Run Button]

to download[Diagram Window][Functions Palette]The Front Panel Window is not used for programming, but must be open (close it to return to Programmer menu). Programs are created in the Diagram Window, using icons from the Functions Palette.InvestigatorDownload.jpg Programmer: Inventor Tools
This is a list of the tools used to program in the Inventor levels. InventorTool1.jpg Position / Size / Select: Used to Pick and Place or move around the command icons. InventorTool2.jpg Scroll Window: Used to place command icons onto the Diagram window. InventorTool3.jpg Connect Wire: Used to connect (wire) command icons together. InventorTool4.jpg Edit Text: Used to change values or add text and labels to the program. InventorTool5.jpg Operate Value: Used to change numeric values.The Space Bar:

The space bar toggles back and forth between the Select tool and the Wire tool. These are the two you are most likely to use.

The Tab Key:

The tab key cycles through the Select, Change value, Text, and Wire tools.

The Programming Sequence:

In each of the Inventor levels there is a consistent order to developing a program.

1. Pick and Place command icons

2. Arrange command icons

3. Remove any unwanted command icons

4. Wire command icons together

5. Download the program and run on the RCX or NXT Programmer: Example Programs
Here are a series of example programs. Clicking on each will launch it in Inventor.InventorExample1.viSimple Motor Control:InventorExample2.viDrive back and forth repeatedly (in a loop):InventorExample3.viMore complex program with forks and containers: Investigator Overview
The ROBOLAB Software has datalogging capabilities in its Investigator section. Using ROBOLAB you can program the RCX or NXT (and the sensors attaced to it) to collect data at particular points in time. Once the data is uploaded from the hardware back into ROBOLAB it can be used in a variety of ways.

ROBOLAB Investigator includes components required to:

* Investigate questions using RCX/NXT-based inventions

* Write programs

* Upload data

* View data

* Compute with the data

* Discuss and document the investigation

Single-click a Theme to show a list of all the Projects in that Theme. Double-click on the Project you want to open. For a new project, single-click on the New Project button to name your project and select the theme under which it will be stored.InvestigatorHomepage.jpg Investigator: Starting Investigation
Within the Navigator of the Investigator project area, there are 5 essential tools located in the Project Navigation Dial. InvestigatorTool1.jpg Program Area:

* Used to write the programs for the RCX/NXT.

* Used for downloading the programs to the RCX/NXT. InvestigatorTool2.jpg Upload Area:

* Upload transfers the data from the RCX/NXT to the computer.

* Every set of uploaded data is stored on its own individual data page within the uploaded area. InvestigatorTool3.jpg View and Compare Area:

* Used to look at all of the data that has been gathered.

* Can view statistics (max, min, mean, etc.) of data.

* Can compare different sets of data to each other. InvestigatorTool4.jpg Compute Area:

* Used to adjust the data with arithmetic functions for calibration or scientific understanding.

* Includes five levels of computation, from simple statistics to more complex. InvestigatorTool5.jpg Journal Area:

* Used to document your project. For example, users can create pages for each part of their experiment: problem statement, hypothesis, predictions, results, conclusions.

* Used to import digital images or graphs to support your project. Investigator: Writing a Program
Selecting a project from the Investigator Menu screen opens the Project Working Area, located on the right. The Navigator (on the left) is always visible. Switching Project Working Areas is done using the Navigator.

The Navigator acts as a menu guide and reference for the project. The project Title at the top of the Navigator identifies the project. Below the title is the Project Navigation Dial. Selecting one of the five icons opens the corresponding Project Working Area.

The Program Area Level 1 template (shown above) is a simple Pilot-style program to capture data. The data is captured until the Wait For condition has been satisfied. The default Level 1 program uses a light sensor on input Port 1 to capture data. The time between samples is 1 second. Data points are taken by the RCX/NXT until 10 points have been captured.InvestigatorProgramLevel1.jpg Investigator: Uploading the Data
After you have completed your program, you can choose from two options:

1) You can download it to the RCX/NXT and store the program until you are ready to run it and capture data, or

2) You can choose Direct Mode which downloads the program to the RCX/NXT and begins capturing data and showing it on the computer immediately. InvestigatorDownload.jpg Download:

Click on the Run arrow to download the program to the RCX/NXT. Press the Run button on the RCX/NXT to start the program running. The RCX will start collecting the data internally, storing the information in its memory. InvestigatorDirect.jpg Direct Mode:

Click on the Direct Mode button to begin capturing data directly. The computer downloads the program to the RCX/NXT which then starts collecting data and uploading it as fast as it can. The computer displays data on-screen as the data uploads. Direct Mode is used as a test mode to see what is happening.InvestigatorUpload.jpgInvestigatorTool2.jpgOnce you have run the program to capture sensor data, you are ready to upload it for viewing, comparing, and other analysis. The Upload data template alows you to upload data from the RCX/NXT to the computer and view it on a graph. Click on the Data Upload button to send the data from the RCX/NXT to the computer. Investigator: View and Compare Data
The View and Compare area allows you to see all of the data in the project at the same time. The default template view shows a composite of all the plots.

The View and Compare area has three templates that can be used for looking at the data bins:

View: Allows the data plots in any color bin to be seen.

Compare: Allows the data plots in two different colored bins to be compared.

Measure: Allows basic statistical information about the data plots in any bin to be determined.InvestigatorTool3.jpgInvestigatorPlotTypes.jpgIn View, Compare, or Measure, the data can be displayed in several formats:

* Points and lines

* Lines

* Points

* Bar

* Numeric Table

If you want to do computations other than the statistics options available on the Measure template, go to the Compute Area. Investigator: Compute Tools
The Compute Area allows you to evaluate or manipulate the data that has been uploaded to the computer. You can view the data in a variety of graphical forms or as the numerical values in a table. The data can be analyzed with simple statistics and calibrated.

The Compute Tools 1 template has the capability to modify the data through basic algebraic relations. This is useful when a calibration is required. The math functions available are: add, subtract, multiply, divide, sin, cos, tan, exp, and natural log.InvestigatorTool4.jpgInvestigatorComputeTools.jpgCompute Tools 2 template is used to plot one set of data against another. This is useful when looking for relationships between light and temperature or other comparisons.

Compute Tools 3 template is used to calculate statistics, slopes, derivatives, and integrals of the data plots. Up to two functions can be performed on any bin.

Compute Tools 4 template is a modified LabVIEW programming environment, similar to Inventor Level programming, that provides a method to undertake multiple calculations on your data.

Compute Tools 5 provides a modified LabVIEW programming environment with unlimited capability to manipulate your data. Compute Tools 5 (also known as G Code) includes the Functions Palette with the Investigator data set icons from Compute Tools 4 as a series of LabVIEW sub-menus. (LabVIEW is a powerful graphical programming environment developed by National Instruments on which ROBOLAB is built.) More Resources
This concludes the Introduction to ROBOLAB.

For more information regarding the software, and for further resources including programming guides, activities, and additional information, please visit the following websites:

* LEGO Engineering:

http://www.LEGOengineering.com

The LEGO Engineering site contains more detailed manuals on using the ROBOLAB software with both the RCX and NXT, as well as classroom activities.

* The Center for Engineering Educational Outreach (CEEO) at Tufts University:

http://www.ceeo.tufts.edu

* The LEGO Education Homepage:

http://www.LEGO.com/education

* MINDSTORMS at National Instruments:

http://www.ni.com/company/education/mindstorms.htmRL_laptop.jpgRuling on templates: All must have the same set of boxes in the same order. Boxes with location 0,0,0,0 will be hidden and not available to the user. All must have the same page dimensions and header. Also all boxes must be on a separate line. NEWpagename
Type Text Here NEWEditImage NEWProgram NEWProgram NEWpagename
Type Text Here NEWEditImage NEWProgram NEWProgram NEWpagename
Type Text Here NEWEditImage NEWProgram NEWProgram NEWpagename
Type Text Here NEWEditImage NEWProgram NEWProgram NEWpagename
Type Text Here NEWEditImage NEWProgram NEWProgram NEWpagename
Type Text Here NEWEditImage NEWProgram NEWProgram Bud1%  @ @ @ @ E%DSDB` @ @ @g{\rtf1\mac \f4\fs20 {\fonttbl {\f0\fswiss Helvetica;} {\f4\fswiss Helvetica;} } ${\footnote Settings.vi} #{\footnote Settings_vi} K{\footnote Settings.vi} \b Settings.vi\par \b0 \par \par \b Connector Pane\par \b0 \{BMC :tempc.bmp\}\par \par \b Front Panel\par \b0 \{BMC :tempp.bmp\}\par \par \b Block Diagram\par \b0 \{BMC :tempd.bmp\}\par \par \b \par \b0 } 6BM6 6(  3f3f3f3fvBMv6(@