1. Trang chủ
  2. » Công Nghệ Thông Tin

programming LEGO MINDSTORMS phần 10 pptx

43 303 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 43
Dung lượng 611,95 KB

Nội dung

www.syngress.com Fred Martin’s Unofficial Questions and Answers about MIT Programmable Bricks and LEGO MINDSTORMS (http://fredm.www.media.mit.edu/people/fredm/ mindstorms/index.html) Fred Martin tells the story of the Programmable Brick and provides some other useful information about the RCX. LEGO MINDSTORMS Internals (www.crynwr.com/ lego-robotics) Russell Nelson maintains a page that contains many technical details about the MINDSTORMS system as well as many useful links.This site also includes a directory of individuals who contributed to the reverse engineering of the RCX. Artificial Intelligence and Machine Learning (www.home.zonnet.nl/bvandam) Bert van Dam’s site is a mine of information about artificial intelligence in general. If you find the subtle link to Miscellaneous | General Information, you will discover a whole world of LEGO projects! MINDSTORMS RCX RCX Internals (http://graphics.stanford.edu/~kekoa/rcx) Kekoa Proudfoot documents all the internals of the LEGO firmware and ROM routines. He made the development of firmware like legOS and pbForth possible. Ole Caprani’s RCX Manual (www.daimi.au.dk/dArkOS/ Vaerktoejer.dir/RCX.vejledning.dir/Vejledning.html) Ole Caprani from the University of Aarhus, Department of Computer Science, has created a very informative manual about the internals of the RCX. It includes information on how the I/O ports of the microcon- troller are connected to the hardware. MINDSTORMS RCX Sensor Input Page (www.plazaearth.com/usr/gasperi/lego.htm) Michael Gasperi’s site describes the various sensors that can be con- structed; used in a leJOS environment, this is the starting point for any investigation into using sensors.The site also contains Brian Stormont’s suggestion to combine a touch sensor and a light sensor on the same Resources • Appendix A 401 177_LEGO_Java_AppA.qxd 4/2/02 2:54 PM Page 401 402 Appendix A • Resources port, and Tom Schumm’s trick to connect touch sensors in the AND configuration. Gordon’s Brick Programmer (www.umbra.demon.co.uk/ gbp.html) With its graphic-textual interface, Gordon’s Brick Programmer (GBP) acts as a bridge between RCX Code and the pure textual programming environments. Languages, APIs, and Tools legOS (http://legos.sourceforge.net) The legOS homepage.The latest releases, downloads, and developer notes for legOS can be found here. LegoSim (www.informatik.hu-berlin.de/~mueller/legosim) LegoSim is a UNIX-based simulator for legOS with an Applet-GUI, written by Frank Mueller,Thomas Röblitz, and Oliver Bühn. emulegOS (http://sourceforge.net/projects/emulegos) This is the homepage for the legOS emulator, which lets you run and debug your legOS programs on your Win/Linux PC. Started by Mario Ferrari and Marco Berti, emulegOS is currently an open source project managed by Mark Falco. Java Communications API (http://java.sun.com/products/ javacomm/index.html) The Java Communications API can be used to write platform-indepen- dent communications applications for MINDSTORMS robots. RCXPort—Java Interface to the LEGO MINDSTORMS RCX (www.slewis.com/rcxport) Scott Lewis’ RCXPort site for the Java interface he created for the pur- pose of interacting with a LEGO MINDSTORM RCX from a Java Virtual Machine. RCXJava (www.escape.com/~dario/java/rcx) A platform-independent Java library used to develop RCX applications, developed by Dario Laverde. Forte Tools—Forte for Java (www.sun.com/forte/ffj) Forte is an IDE written completely in Java. Forte provides a visual GUI creator, a debugger, and compilation functions—all the expected parts of www.syngress.com 177_LEGO_Java_AppA.qxd 4/2/02 2:54 PM Page 402 Resources • Appendix A 403 an IDE. Forte also has the seemingly unique ability to configure the compiler and Java runtime you use. Jini (www.javacommerce.com/tutorial/jini) Jan Newmarch’s Jini Tutorial featuring a chapter on LEGO MIND- STORMS Jad (http://kpdus.tripod.com/jad.html) Jad allows you to retrieve a compiled class file for editing, even if you have lost the source.This can be especially useful when an unwanted modification is saved, causing the program not to function. Decompiling a program you did not create can help you learn programming styles, ways to implement complex functions, or just how to better code for the RCX. Jlint (www.ispras.ru/~knizhnik/jlint/ReadMe.htm) Jlint is a Java version of the popular lint for C programs. Jlint can be useful, since debugging programs on the RCX, especially ones that deal with logic errors (such as an incorrect loop structures), can be difficult. It can also detect other “assumptions” you may have made, and tells you if they are incorrect. An Operating System in Java for the LEGO MINDSTORMS RCX Microcontroller (www.usenix.org/publications/library/ proceedings/usenix2000/freenix/nikander/nikander.pdf) A scientific paper by Pekka Nikander presented at the 2000 USENIX Annual Technical Conference NQC—Not Quite C (www.enteract.com/~dbaum/nqc/ index.html) Dave Baum’s NQC site contains the compiler and the documentation. Bricx Command Center (http://hometown.aol.com/ johnbinder/bricxcc.htm) Formerly known as the RCX Command Center, and based on Mark Overmars’ original source code (see LEGO Robot Pages), John Hansen’s Bricx Command Center (BricxCC) supports all the LEGO Programmable Bricks and introduces many new and interesting features. If you use NQC on a PC platform, this is a “must have.” www.syngress.com 177_LEGO_Java_AppA.qxd 4/2/02 2:54 PM Page 403 404 Appendix A • Resources LEGO Robot Pages (www.cs.uu.nl/people/markov/lego) The site of the original RCX Command Center, a very good IDE for NQC originally developed by Mark Overmars but not updated to the current version (see Bricx Command Center). Visual NQC (http://home.hetnet.nl/~myweb1/VisualNQC.htm) Ronald Strijbosch’s Visual NQC has its roots in the RCX Command Center, but is completely rewritten in Visual Basic.A very functional and complete IDE to NQC. NQCEdit (http://hem.passagen.se/mickee/nqcedit) Another front-end IDE for NQC, written by Mikael Eriksson. Currently less sophisticated than the RCX Command Center and Visual NQC, it’s an effective and solid alternative. NQC API Programmer’s Guide (www.cybercomm.net/ ~rajcok/nqc) Mark Rajcok’s guide to NQC API lists all NQC functions, their syntax, their supported programmable bricks and a few examples. General Paranoyaxc RCX Tools (www.rainer-keuchel.de/rcx/ rcx.html) A package that contains a port of the NQC compiler, a simple editor, and a remote control program to access your RCX from WinCE plat- forms. Hempel Design Group (www.hempeldesigngroup.com/lego/ index.html) Ralph Hempel’s site contains a copious amount of tools and informa- tion. Some of the highlights include ■ Information about Ralph’s maze solver, an application demonstrated during the 1999 MindFest at MIT. ■ Extremely helpful information on how to improve the reading range of the LEGO light sensor. ■ Information about Ralph Hempel’s programmable brick FORTH (pbForth) for MINDSTORMS (www.hempeldesigngroup.com/ lego/pbFORTH/index.html). ■ Schematics and detailed instructions on how to interface R/C Servos to the RCX. www.syngress.com 177_LEGO_Java_AppA.qxd 4/2/02 2:54 PM Page 404 Resources • Appendix A 405 ■ Home page of Ralph Hempel’s famous double-acting compressor. The same site also contains his Pressure Switch (www.hempeldesigngroup.com/lego/pressureswitch/index.html). Reactive Languages and LEGO MINDSTORMS (www.emn.fr/ richard/lego) Martin Richard’s Web site about using synchronous languages (Esterel, Lustre, Grafcet) to play with the LEGO MINDSTORMS kit. ADA for MINDSTORMS (www.usafa.af.mil/dfcs/ adamindstorms.htm) An ADA pre-processor to NQC.Also consult some of the documenta- tion at www.faginfamily.net/barry/Papers/AdaLetters.htm. Bot-Kit (www.object-arts.com/Bower/Bot-Kit/Bot-Kit.htm) An interface to programming the RCX in Smalltalk (based upon Dolphin Smalltalk). Brick Command (www.geocities.com/Area51/Nebula/8488/ lego.html) A simple textual programming language that incorporates a complete IDE. The PowerBook Source (www.pbsource.com/features/ LEGO_and_Macs.shtml) Information on how to control LEGO MINDSTORMS from a PowerBook with Common LISt Processing (LISP). QC (http://digilander.iol.it/ferrarafrancesco/lego/qc/ index.html) Francesco Ferrara’s QC, a mini OS (no multitasking) meant as an inter- face between C code and the ROM routines of the RCX. TCL—RCX (www.linux.org/docs/ldp/howto/mini/Lego/ tcl.html) Laurent Demailly and Peter Pletcher’s TCL RCX can either compile a TCL script into RCX bytecode, or it can remotely control the robot via either a script or an interactive TCL shell. WinVLL (www.research.co.jp/MindStorms/winvll/index-e.html) A simple tool by Shigeru Makino to control and program the Micro Scout from a PC. www.syngress.com 177_LEGO_Java_AppA.qxd 4/2/02 2:54 PM Page 405 406 Appendix A • Resources For Inspiration Ben’s LEGO Creations (http://unite.com.au/~u11235a/lego) Ben Williamson has created some very cool robots! BrickBots (www.brickbots.com) BrickBots is Richard Sutherland’s repository of building contests and best solutions.This is a nice site where you can attend “remote” chal- lenges.Although the contests are no longer running on a regular basis, the current repository of contest entries provides builders with great ideas. MindScope (http://baserv.uci.kun.nl/~smientki/Lego_Knex/ Lego_electronica/Mindscope.htm) Stef Mientki’s graphing utility is able to continuously monitor the sen- sors and produce a chart from the sampled values. Programming the LEGO Micro Scout (http://eaton.dhs.org/ lego) Doug Eaton explains how to program the Micro Scout through bar codes. www.syngress.com 177_LEGO_Java_AppA.qxd 4/2/02 2:54 PM Page 406 Programming LEGO MINDSTORMS with Java Fast Track This Appendix will provide you with a quick, yet comprehensive, review of the most important concepts covered in this book. Appendix B 407 177_LEGO_Java_AppFT.qxd 4/3/02 10:47 AM Page 407 408 Appendix B • Programming LEGO MINDSTORMS with Java Fast Track ❖ Chapter 1: Introducing LEGO MINDSTORMS The LEGO MINDSTORMS RIS Kit  The MINDSTORMS series comes from a collaboration between the LEGO Company and the Massachusetts Institute of Technology (MIT) Media Lab that led to the creation of a “programmable brick.”  The Robotic Invention System (RIS) is the basic kit, and the starting point for every MINDSTORMS robot of more than basic complexity.  The RIS includes everything you need to build and program robots: the RCX unit, three sensors, two motors, an infrared (IR) tower, manuals, more than 700 TECHNIC pieces and a software CD-ROM. RCX:The Robot’s Brain  The RCX is a microcomputer than interfaces with input and output devices. Programs can be written on a PC and then downloaded to the unit through the IR tower.  The RCX uses two types of memory: read-only memory (ROM) and mod- ifiable random access memory (RAM).The latter stores both user-written programs and the system firmware, which is the RCX’s operating system.  The RCX can be expanded in two ways: using a different programming software like NQC or the Java APIs, or replacing the default firmware with a new one (legOS, pbForth, and leJOS solutions). The RIS Software Environment  The RIS kit contains RCX Code, which is the standard programming language from LEGO. It contains tools for downloading firmware and a visual programming interface that makes writing code a very easy task.  RCX Code is targeted at kids and beginners; its capabilities are too limited for the development of more complex robots. RCX Bytecodes  The RCX architecture uses an interpreter-based virtual machine to execute commands statement by statement. www.syngress.com 177_LEGO_Java_AppFT.qxd 4/3/02 10:47 AM Page 408 Programming LEGO MINDSTORMS with Java Fast Track • Appendix B 409  Opcodes, the assembly commands, are used both by the RCX’s stored programs and the IR emitting devices, like a PC with an IR tower or a remote control. LEGO Expansion Kits  There are other robotics kits besides the RCX-based system: CyberMaster, Scout, Micro Scout, and Code Pilot. Each of these kits features only a subset of the full RIS’ capabilities.  Standard LEGO TECHNIC pieces can be used to expand building possibili- ties, as can sensors and other spare pieces that are available separately.  MINDSTORMS can be expanded with kits that contain sensors, motors, and special pieces. Further,Vision Command (VC) is a LEGO video camera with an advanced visual recognition system that can be used to add more functionalities to your LEGO MINDSTORMS robots. ❖ Chapter 2: The Java Communications API Overview of the Java Communications Extension API  The Java Comm API provides the mechanism for port enumeration and ownership as well as event driven notification of change of ownership.  Asynchronous and synchronous I/O is possible due to the standard Java- style event-driven architecture.  The SerialPort and ParallelPort classes provide a clean encapsulation for supporting the many platforms for which the JCE API is available. Installing and Configuring the Java Communications API  There are three deliverables: a jar file, a properties file, and a native shared runtime library.  Several options are available depending on ease-of-use versus ease-of- configuration.The simplest is to keep the three deliverable files together in the same folder so long as it is the application’s working folder. www.syngress.com Chapter 1 Continued 177_LEGO_Java_AppFT.qxd 4/3/02 10:47 AM Page 409 410 Appendix B • Programming LEGO MINDSTORMS with Java Fast Track  There are possible version control caveats, but fortunately the API has stabilized enough such that it’s not a big issue. Reading and Writing to Serial Ports  The Java Communications API comes with several simple examples that illustrate the usage of both parallel and serial ports.  Adding event-driven notifications is straightforward using EventListeners.  Working with the parallel ports is similar to working with any port that extends the CommPort abstract class. Debugging with Serial Ports:The Black Box Example  A close look at a specific advanced Java sample program that comes with the JCE illustrates all functionality of the serial port by serving as a serial port analyzer and line monitor.  The BlackBox sample program can be used as is as a serial proxy or sniffer tool without modifications.  The way that the output and input streams were used in the BlackBox example can be used as the basis of custom applications that provide similar functionality. Extending the Java Communications API  The mechanism for adding new functionality exists via the CommDriver, CommPort and CommPortIdentifier classes.  A step-by-step process of how a customized USB driver was implemented for use with the RCX 2.0 USB tower.  The limitations shown include the inability to add external packages as the source for new port drivers.This would break the package naming conven- tion of not adding to or changing the classes in the javax.comm hierarchy. www.syngress.com Chapter 2 Continued 177_LEGO_Java_AppFT.qxd 4/3/02 10:47 AM Page 410 [...]... capability of creating complex frameworks similar to the visual -programming interface that comes with the LEGO MINDSTORMS kit www.syngress.com 413 177 _LEGO_ Java_AppFT.qxd 414 4/3/02 10: 47 AM Page 414 Appendix B • Programming LEGO MINDSTORMS with Java Fast Track Chapter 4 Continued Direct Control Programming for the RCX Using Java With direct control programming, we are using the RCX’s “brain” to pass commands... can change the stack size by modifying the values in vmsrc/configure.h and recompiling the leJOS firmware www.syngress.com 177 _LEGO_ Java_AppFT.qxd 4/3/02 10: 47 AM Page 419 Programming LEGO MINDSTORMS with Java Fast Track • Appendix B Chapter 9 Continued ❖ Chapter 9: Programming LEGO MINDSTORMS with Jini Overview of Jini Jini is a Java technology built on top of RMI, enabling clients and services to interact... milliseconds LeJOS gives you a common programming language (Java) and environment for the RCX.The learning curve is not as steep as other firmware replacements like legOS A comparison to other Java environments shows the formidable achievement of cramming an entire Java VM into the RCX’s 32KB of memory www.syngress.com 177 _LEGO_ Java_AppFT.qxd 4/3/02 10: 47 AM Page 415 Programming LEGO MINDSTORMS with Java Fast Track... implemented, will use unnecessarily large amounts of memory An Advanced Programming Example Using leJOS The line-following type of robot can often become mired in a never-ending spin.Two techniques for avoiding that were presented www.syngress.com 415 177 _LEGO_ Java_AppFT.qxd 416 4/3/02 10: 47 AM Page 416 Appendix B • Programming LEGO MINDSTORMS with Java Fast Track Chapter 6 Continued The subsumption architecture... Robot, 163 Building applets, 139–147 Building Robots with LEGO MINDSTORMS book, 5, 18, 151, 162, 277 BuildTool, 389 Button class, 179 ButtonListener class, 179 Bytecodes See Opcodes 421 177 _LEGO_ Java_indx.qxd 422 4/3/02 1:50 PM Page 422 Index C Calibrator.java, 217 Callback listener, 38 Candy sorter, 97 105 CandySorter.java class, 99 CD-ROMs LEGO MINDSTORMS, 16 RIS software, 4–5 Ultimate Builders Set... See LEGO Java Operating System (leJOS); legOS replacement firmware; pbForth language Firmware for Infrared (IR) towers, 10 11 Firmware for LEGO Java Operating System (leJOS) debugging, 322–323 description, 304–305 leJOS Virtual Machine, 305–306 scheduler, 305 thread states, 305–306 Firmware for Robotics Command Explorer (RCX) description, 10, 17 installing, 16 new features, using, 28 reloading, 10 11... compiler and Java runtime you use Using the leJOS Visual Interface The leJOS Visual Interface (lVI) is a custom IDE especially configured for use with leJOS www.syngress.com 177 _LEGO_ Java_AppFT.qxd 4/3/02 10: 47 AM Page 417 Programming LEGO MINDSTORMS with Java Fast Track • Appendix B Chapter 7 Continued The options in the Tools menu allow you to automatically compile, link, and download programs, as well as... entry classes containing the main method You can store data persistently by using thelibrary’s josx.platform.rcx.PersistentMemoryArea class www.syngress.com 417 177 _LEGO_ Java_AppFT.qxd 418 4/3/02 10: 47 AM Page 418 Appendix B • Programming LEGO MINDSTORMS with Java Fast Track Chapter 8 Continued You can inspect and modify the contents of the RCX’s memory by using the methods in the library class josx.platform.rcx.Memory...177 _LEGO_ Java_AppFT.qxd 4/3/02 10: 47 AM Page 411 Programming LEGO MINDSTORMS with Java Fast Track • Appendix B ❖ Chapter 3: Communicating with the RCXPort API Overview of the RCXPort Java API The code in the RCXPort Java API establishes... scenes The proxy architecture is especially suitable when providing services for devices that are not capable of running Jini themselves www.syngress.com 419 177 _LEGO_ Java_AppFT.qxd 420 4/3/02 10: 47 AM Page 420 Appendix B • Programming LEGO MINDSTORMS with Java Fast Track Chapter 9 Continued A RCX Jini Proxy Service Since the RCX is not capable of running Jini itself, it is a very good candidate for . B 407 177 _LEGO_ Java_AppFT.qxd 4/3/02 10: 47 AM Page 407 408 Appendix B • Programming LEGO MINDSTORMS with Java Fast Track ❖ Chapter 1: Introducing LEGO MINDSTORMS The LEGO MINDSTORMS RIS Kit  The MINDSTORMS. visual -programming interface that comes with the LEGO MINDSTORMS kit. www.syngress.com Chapter 4 Continued 177 _LEGO_ Java_AppFT.qxd 4/3/02 10: 47 AM Page 413 414 Appendix B • Programming LEGO MINDSTORMS. firmware. www.syngress.com Chapter 8 Continued 177 _LEGO_ Java_AppFT.qxd 4/3/02 10: 47 AM Page 418 Programming LEGO MINDSTORMS with Java Fast Track • Appendix B 419 ❖ Chapter 9: Programming LEGO MINDSTORMS with Jini Overview

Ngày đăng: 13/08/2014, 15:21

TỪ KHÓA LIÊN QUAN