Presentation is loading. Please wait.

Presentation is loading. Please wait.

1chung 5 th Annual Robofest 2004 Informational Meeting Mar. 20, 2004 Chan Jin Chung Ali Khazaal Jason Lo Computer Science Lawrence Technological University.

Similar presentations


Presentation on theme: "1chung 5 th Annual Robofest 2004 Informational Meeting Mar. 20, 2004 Chan Jin Chung Ali Khazaal Jason Lo Computer Science Lawrence Technological University."— Presentation transcript:

1 1chung 5 th Annual Robofest 2004 Informational Meeting Mar. 20, 2004 Chan Jin Chung Ali Khazaal Jason Lo Computer Science Lawrence Technological University

2 2chung Agenda Introduction to Robofest and Game Rules Go to www.robofest.net and click on Announcement link Tech Resource link 9:15am: NQC Installation and Basics 10:45am: Java, LeJos, Eclipse setup Announcements

3 3chung NQC installation You must install RIS or RoboLab software to install the drivers for your IR tower. Tech Resource or CD-ROM given today Bricxcc 3.3.7.7

4 4chung NQC NQC complier – David Baum Brick Command Center (bricxcc) – IDE tool Tutorial: www.robofest.net - TechResource

5 5chung The first NQC program task main() { OnFwd(OUT_A); OnFwd(OUT_B); Wait(400); // 4 sec OnRev(OUT_A+OUT_B); Wait(400); Off(OUT_A+OUT_B); }

6 6chung Control Structures repeat(n) while if if else do while

7 7chung Using variables #define TURN_TIME 85 int move_time; // define a variable task main() { move_time = 20; // set the initial value repeat(50) { OnFwd(OUT_A+OUT_C); Wait(move_time); // use the variable for sleeping OnRev(OUT_C); Wait(TURN_TIME); move_time += 5; // increase the variable } Off(OUT_A+OUT_C); }

8 8chung Sensors task main() { SetSensor(SENSOR_1,SENSOR_TOUCH); OnFwd(OUT_A+OUT_C); until (SENSOR_1 == 1); Off(OUT_A+OUT_C); }

9 9chung A Simple Line Following #define THRESHOLD 40 task main() { SetSensor(SENSOR_2,SENSOR_LIGHT); OnFwd(OUT_A+OUT_C); while (true) { if (SENSOR_2 > THRESHOLD) { OnRev(OUT_C); Wait(10); // make smooth movement until (SENSOR_2 <= THRESHOLD); OnFwd(OUT_A+OUT_C); }

10 10chung Why Java? Write once, run anywhere Professional OO software development AP exam from C++ to Java, 2004-

11 11chung Install Java, LeJos, and Eclipse! 1. Install RCX or Robolab software to install the drivers for your Infrared Tower. RCX v1.X only supports the serial tower. RCX 2.x supports both the serial and USB versions of the Tower (You can skip this step if you have already installed RCX or Robolab) 2. Download Java J2SE SDK from http://java.sun.com/j2se/1.4.2/download.html Install the program by running it. This may take 4-5 minutes to install. (Windows 98 users may need to use the older 1.3.x version if there errors installing the newest version) Acknowledgement: Based on web page created by Jason Chien-Tai and updated by Tim Cahoon, a robofest coach

12 12chung 3. Dowload leJOS from http://lejos.sourceforge.net/download.html (Start with Version 2.xx) 4. Extract downloaded leJOS ZIP file to a directory (eg.C:\lejos) When doing the unzip, specify unzip to C:\. The zip file will build the lejos directory for you. 5. Download eclipse from http://www.eclipse.org/downloads/index.php (With Latest Release Start with Version 2.xx) 6. Extract downloaded eclipse ZIP file to a directory (eg. C:\eclipse) When doing the unzip, specify unzip to C:\. The zip file will build the eclipse directory for you. 7. Download the following zip-bundle org.lejos_1.0.2.zip

13 13chung 8. Unzip it into your eclipse plugin directory. (The files go into c:\eclipse\plugins ) 9. Start eclipse by double-clicking eclipse.exe under C:\eclipse (Double-click again if eclipse is not started) HINT: Make a shortcut for eclipse and put it on your desktop. 10. When eclipse is running, go to the leJOS preference page, using Window->Preferences->Lejos page or Lejos- >Preferences.

14 14chung Lejos Installation Directory = C:\lejos (where you installed Lejos files) RCX comm port = com1, com1, USB (depends on how infrared tower is connected) Data Transfer Rate = fast, slow (select fast. If you have problems try slow) 8 If lejos is not listed on the bar (with file, edit, source, etc..) at the top of eclipse, the lejos plugins were not put in the right directory. ( eclipse\plugins is where the files go). Exit eclipse and redo step 8 again.

15 15chung How to write a LeJos Java Program using Eclispe Create a project: File -> New -> Project Highlight leJOS Project and click Next (or double click leJOS Project) Type in your Project Name and Click on Finish Create a Java class file: File -> New -> Other; double click on Class Type a Java class name; check public static void main() and click on Finish

16 16chung

17 17chung Compile, download, and run Save the file (compile is done) Select: leJOS -> firmware download (for the first time run, takes more than 5 min) Select: leJOS -> bytecode download to download your program Press the green Run button to execute your program

18 18chung 1010 Announcement 4-3-03: RCX code and RoboLab Workshop 4-17-03 Warm-up Competition at Cranbrook Institute of Science. Only for 10 teams We need referees!


Download ppt "1chung 5 th Annual Robofest 2004 Informational Meeting Mar. 20, 2004 Chan Jin Chung Ali Khazaal Jason Lo Computer Science Lawrence Technological University."

Similar presentations


Ads by Google