Robotics Invention System 2.0 .
-
Upload
ulysses-kippes -
Category
Documents
-
view
215 -
download
1
Transcript of Robotics Invention System 2.0 .
![Page 1: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/1.jpg)
Robotics Invention System 2.0
http://shop.lego.com/product.asp?p=3804
![Page 2: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/2.jpg)
RCX Programming cycle
Program Mindstorm PC-side software, i.e. RCX code or Robolab
RCX code translates your code to “Bytecode”
Use IR tower between PC & RCX to put your program in RCX RAM
Firmware interprests bytecode to m/c code
RCX processor executes machine code
![Page 3: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/3.jpg)
InfraRed receiver must face IR Tower
![Page 4: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/4.jpg)
This is a sensor port, NOT a motor port.
![Page 5: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/5.jpg)
Sensor ports
Motor ports
![Page 6: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/6.jpg)
Logical Structure
![Page 7: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/7.jpg)
RCX: The Robot’s Brain
![Page 8: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/8.jpg)
What is sensing?
![Page 9: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/9.jpg)
Why do robots need sensors?
![Page 10: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/10.jpg)
PC side Software
Lego RCX codeRoboLabNQC (Not Quite C)Java 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
![Page 11: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/11.jpg)
Firmware
legOS (C/C++)pbForth (Forth)leJOS (LEGO Java OS)
![Page 12: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/12.jpg)
Programming Legos with Java
http://www3.ltu.edu/~chung/os/Lego-leJOS.htm
![Page 13: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/13.jpg)
HelloRCX
C:\>lejosfirmdlUse --help for options.Transferring "/Apps/lejos/bin/../bin/lejos.srec" to RCX...100%
C:\>
![Page 14: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/14.jpg)
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(); }}
![Page 15: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/15.jpg)
Compilation
C:\>lejosc HelloRCX.java
C:\>
![Page 16: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/16.jpg)
Running
C:\>set RCXTTY=COM2
C:\>lejos HelloRCX
C:\>
![Page 17: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/17.jpg)
RCX
Transfer & run on RCX Use a PC-side emulator
![Page 18: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/18.jpg)
Line Follower Robot
Line is darker than the floorRobot will follow the left border of
the line (e.g. it turna right to go toward the line, left to go away from line)
O/P port A, C to control wheel (motors)
O/P port B to ocntrol the arm
![Page 19: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/19.jpg)
Main methd
Int floor, line;Task Main(){
initialize();Calibrate();Go_Straight();
While (true){Check_Bumper();Follow_Line();}
}
![Page 20: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/20.jpg)
Programming concepts
MutlitaskingStep-By-Step event driven schemePriority
![Page 21: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/21.jpg)
Java Programming Concepts
Threads and TimingMemory usage:
MinLCD, LCD, TextLCD Sound MinSound
Garbage Collection
![Page 22: Robotics Invention System 2.0 .](https://reader030.fdocuments.in/reader030/viewer/2022032517/56649cbb5503460f949838e7/html5/thumbnails/22.jpg)
Debugging
EmulatorLCD (5 c/c)Play SoundsleJOS displays uncaught exception