Download presentation
Presentation is loading. Please wait.
1
Robotics Invention System 2.0 http://shop.lego.com/product.asp?p=3804
2
RCX Programming cycle zProgram Mindstorm PC-side software, i.e. RCX code or Robolab zRCX code translates your code to “Bytecode” zUse IR tower between PC & RCX to put your program in RCX RAM zFirmware interprests bytecode to m/c code zRCX processor executes machine code
3
InfraRed receiver must face IR Tower
4
This is a sensor port, NOT a motor port.
5
Sensor ports Motor ports
6
Logical Structure
7
RCX: The Robot’s Brain
8
What is sensing?
9
Why do robots need sensors?
10
PC side Software zLego RCX code zRoboLab zNQC (Not Quite C) zJava APIs (Application Programming Interfaces) It is a set of command libraries allow user to use JVM-equipped computer to communicate with RCX using original firmware
11
Firmware zlegOS (C/C++) zpbForth (Forth) zleJOS (LEGO Java OS)
12
Programming Legos with Java zhttp://www3.ltu.edu/~chung/os/Lego- leJOS.htm
13
HelloRCX C:\>lejosfirmdl Use --help for options. Transferring "/Apps/lejos/bin/../bin/lejos.srec" to RCX... 100% C:\>
14
HelloRCX.java import josx.platform.rcx.*; public class HelloRCX { public static void main(String[] args) { Motor.A.forward(); Motor.C.forward(); try { Thread.sleep(2000); } catch (InterruptedException ie) {} Motor.A.stop(); Motor.C.stop(); } }
15
Compilation C:\>lejosc HelloRCX.java C:\>
16
Running C:\>set RCXTTY=COM2 C:\>lejos HelloRCX C:\>
17
RCX zTransfer & run on RCX zUse a PC-side emulator
18
Line Follower Robot zLine is darker than the floor zRobot will follow the left border of the line (e.g. it turna right to go toward the line, left to go away from line) zO/P port A, C to control wheel (motors) zO/P port B to ocntrol the arm
19
Main methd Int floor, line; Task Main() { initialize(); Calibrate(); Go_Straight(); While (true){ Check_Bumper(); Follow_Line(); }
20
Programming concepts zMutlitasking zStep-By-Step event driven scheme zPriority
21
Java Programming Concepts zThreads and Timing zMemory usage: yMinLCD, LCD, TextLCD ySound yMinSound zGarbage Collection
22
Debugging zEmulator zLCD (5 c/c) zPlay Sounds zleJOS displays uncaught exception
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.