40_Lisp for a simple mobile robot

This paper presents the RCXLisp library, an extension to Common Lisp that allows students to investigate a broad range of artificial intelligence and computer science topics using the LEGO MindStorms® platform. The library supports both remote control and on-board programming of MindStorms robots. It also supports targeted communication between multiple LEGO robots and command-center desktops. The package is the only one to be integrated into most popular Common Lisp programming environments. This paper also summarizes student experiences with the package over the years 2000-2003 in an Artificial Intelligence course.

1. A Tool for Integrating Lisp and Robotics in AI Agents Courses Frank Klassner Department of Computing Sciences Villanova University Villanova, PA 19085 610-519-5671 Frank.Klassner@villanova.edu ABSTRACT over the four semesters (2000-2003) that it has been used i n the AI course. The sixth section concludes with plans for This paper presents the RCXLisp library, an extension t o future use and development for RCXLisp. Common Lisp that allows students to investigate a broad range of artificial intelligence and computer science topics using the 2. MINDSTORMS BACKGROUND LEGO MindStorms® platform. The library supports both The RCX is the programmable brick at the heart of the LEGO remote control and on-board programming of MindStorms MindStorms kit. Figure 1 shows an RCX in a simple robot. robots. It also supports targeted communication between multiple LEGO robots and command-center desktops. The package is the only one to be integrated into most popular Common Lisp programming environments. This paper also summarizes student experiences with the package over the years 2000-2003 in an Artificial Intelligence course. 1. INTRODUCTION In Fall 1997 the Introduction to Artificial Intelligence (AI) course at Villanova University was reorganized around the concept of agent-oriented design [7]. This approach was augmented in the Fall 1999 offering with LEGO MindStorms [3] in order to have students explore the relationships among hardware, environment, and software organization in agent Figure 1. RCX unit. IR port is “in front,” at lower left. Sensor ports design. The course traditionally used Common Lisp in its are gray squares behind the IR port. Output ports are dark squares programming projects, but at the time of MindStorms’ located beyond the LCD display. adoption, there was no Common Lisp development environment for MindStorms. This situation led me to try Not The RCX has a 16MHz CPU (Hitachi H8/3292 microcontroller), Quite C (NQC) [1] for team-based robotics projects and 16KB RAM (and another 16K of ROM routines), and houses an Common Lisp for all individual projects in search, planning, infrared (IR) transmitter/receiver for sending and receiving and abstract machine learning. data and commands from a desktop PC or from other RCXs. The IR transceiver has a range of 15-25 feet, depending o n Student surveys indicated that the burden of working with two lighting conditions and reflectivity of walls. Version 1.0 of different languages distracted them from learning the AI the platform used a serial-port IR Tower for broadcasting concepts of the course. My students and I also found that the messages and software to the RCX from a desktop. Later NQC language was overly limited by the MindStorms firmware versions (the current version is 2.0) replaced the serial device to which it was targeted. We also found it difficult to try t o with a USB Tower whose IR receiving range is more limited: 8- coordinate several robots in the course’s semester-end contest 12 feet. The RCX unit has 3 input ports, 3 output ports in which teams of robots compete against each other in a (labeled A, B, and C), and a 5-“digit” LED display. LEGO 20’x9’ arena to capture and defend colored ping-pong balls. markets touch, light, temperature, and rotation sensors that can be connected to the RCX’s input ports; third-party vendors Based on these observations, I decided to develop a Common offer magnetic compass sensors, ultrasonic distance sensors, Lisp library, RCXLisp, for programming the MindStorms’ and infrared distance sensors. Motors, LEDs, and infrared platform. This paper describes how the RCXLisp library emitters can be attached to the output ports. augments the MindStorms platform as a tool for agent The RCX’s replaceable firmware models a primitive virtual pedagogy. Although it is targeted at symbolic-oriented AI, machine. It can be used in autonomous mode (the robot’s there is no inherent reason the library cannot support numeric- behavior depends only on the program loaded into its level AI projects such as neural networks. The second section memory) or in direct-control mode (a control program on a of this paper describes the MindStorms platform’s design desktop computer broadcasts a series of instructions to the insofar as it affected the design of RCXLisp. The paper’s third robot for on-board execution). Educators contemplating the section describes the RCXLisp library and support firmware. use of Lego’s Vision Command Camera system should note The fourth section presents experiences some projects that that the camera system is not connected directly to the RCX have been written in RCXLisp for the Villanova AI course. The but relies on direct-control mode to control the RCX based o n fifth section discusses student experiences with the package what the camera detects. The firmware supports 32 sixteen-bit

2.global integer registers that can be shared by up to 10 threads.  create and compile RCXLisp programs for Each thread can allocate up to 16 private registers. Only downloading to RCXs “on the fly,” from within integer arithmetic is supported by the standard firmware. Common Lisp desktop environments,  simultaneously control more than one RCX from a From the hardware perspective, I do not believe that the single MindStorms infrared transceiver tower available set of sensors for MindStorms is any more limiting  set up a network of RCX units that can communicate for AI or robotics work at the collegiate level than that with each other in a targeted manner. available at considerable greater cost for other robotics platforms. However, the RCX’s 16KB of non-upgradeable The RCX libraries support both the older serial-port infrared onboard RAM does represent a problem for projects involving transceivers and the newer USB-port towers that LEGO i s large-footprint real-time schedulers and planners. currently shipping. It is also possible to use the libraries t o control more than one tower, opening up the possibility of LEGO firmware uses a broadcast protocol. It does not support extending the remote-control radius of a desktop through targeted message-passing. If one has three RCXs in the same strategic placement of multiple IR towers in one room. vicinity, two of them cannot exchange messages without the third inadvertently receiving the messages. Furthermore, it i s RCXLisp has two components. The first is “Remote RCXLisp,” not possible to have a desktop application coordinate several which is a collection of macros, variables, and functions for robots of a team without a mechanism to address the robots’ remotely controlling RCX units from a desktop. The second i s RCXs individually. The firmware’s lack of support for a call “RCXLisp” proper, which is a subset of Common Lisp that can stack limits on-board programs’ use of abstraction because be cross-compiled to run on RCX firmware for autonomous nested function or procedure calls are not possible. LEGO control of the unit. The next two subsections provide details firmware does not support dynamic memory allocation. on the two parts of the language library, with the goals of showing the tight integration among Lisp environment, RCX, and desktop control processes the library makes possible, and 3. RCXLISP the Common Lisp language features that the library encourages students to learn about as they set up robotics- 3.1 Extended Firmware inspired projects. Both as means of overcoming the problems cited earlier and as part of a larger project aimed at improving the MindStorms platform’s usefulness in collegiate computer science curricula, 3.2.1 Remote RCXLisp I have developed the RCXLisp programming libraries. This Since “Remote RCXLisp” is intended to run within a desktop package allows one to work with the RCX unit from the LEGO Common Lisp environment, the design goal of this language MindStorms® kit using Common Lisp. was to adhere as closely as possible to the Common Lisp standard in Guy Steele’s text, “Common Lisp: The Language, “ The RCXLisp package is compatible with LEGO’s firmware. It 2 nd edition (aka “CLTL2”). is, however, designed primarily to work with extended The “Remote RCXLisp” library provides users with the with- firmware my student Andrew Chang and I designed that open-com-port and with-open-rcx-stream macros to set up supports wireless networking and most of the bytecodes from communication environments for contacting the RCX units. version 1.0 of LEGO’s firmware. This extended firmware i s These macros are modeled closely on Common Lisp’s “with- called “Mnet firmware,” and supports directed IR open-stream” macro. With-open-com-port is used to specify communication by adding source and target fields to the basic the communication port (serial or USB) over which an RCX i s LEGO protocol and by allowing each RCX to set a 1-byte ID to be contacted, and with-open-rcx-stream is used to define the value for itself. Mnet firmware allows an RCX to restrict from RCX-unit-specific data stream that will use a port stream. The what other RCXs it will accept messages. code in Figure 2 shows how the macros are used and provides an example of the functions that can be invoked to control an As of version 1.3, Mnet firmware does not support dynamic RCX from within the macros’ communication environment. memory allocation. Future versions are expected to include There are 45 functions defined for RCX control. Common Lisp this capability (along with garbage collection) in order t o functions are capitalized for easy readability. support a larger subset of Common Lisp’s functionality. I believe this lack of functionality is mitigated by RCXLisp’s The body of the “full-speed-ahead” function contains the ability (discussed later) to integrate desktop remote control following examples of “Remote RCXLisp” functions for with on-board autonomous programs; problems requiring controlling an RCX: set-effector-state (for initializing and recursive or nested function calls can be solved on a desktop controlling motors), set-sensor-state (for initializing how an Lisp environment and the results can be communicated to the input sensor port will be used to gather data), and sensor (for RCX’s on-board control program. accessing the current value of a sensor port). The testing function uses alivep to determine if the RCX is in range and responding. It is useful to note for later discussion that the 3.2 Language Design language includes a var function which asynchronously Moving from hardware-oriented issues, let us now discuss the queries for the value stored in a given variable register. design and organization of the RCXLisp language itself. Specifically, RCXLisp lets one All “Remote RCXLisp” functions take an optional final stream  remotely control the RCX from a Common Lisp argument (“r” in full-speed-ahead, and “rcx10” in testing). program running on a desktop computer, One can forego repetitious typing of the stream argument, b y  write RCXLisp programs to run on the RCX, using the using-rcx macro as in figure 2 to define a default stream for enclosed RCXLisp functions. This macro is closely

3.modeled on Common Lisp’s “using-slots” macro for object- (the MindStorms Java virtual machine developed originally oriented programming. It also serves to define for the by Jose Solarzano) and Wick et al.’s Lego/Scheme compiler [8] programmer a symbolic environment in which the desktop acts require a separate command-line system program to download as a director telling some particular RCX what to do next. compiled code or firmware into the RCX. The recursive- descent parser+compiler in rcx-compile-and-download i s implemented in Lisp. (DEFUN full-speed-ahead (r s dir) “This will make the rcx in R go at speed S in direction DIR until touch 3.2.2 “RCXLisp” Proper sensor on its ‘2’ port returns 1.” RCXLisp is the subset of Common Lisp (with a few non- (LET ((result 0)) standard additions) that can be compiled and downloaded t o (set-effector-state ‘(:A :B :C) :power :off r) run on an RCX unit autonomously. As with “Remote ;in case things are in an inconsistent state, RCXLisp,” the design goal was to follow CLTL2’s standard as ;turn everything off first (set-effector-state ‘(:A :C) :speed s r) closely as possible, and to maintain compatibility with Lego (set-effector-state ‘(:A :C) :direction dir r) firmware as well as Mnet extended firmware. However, because ; dir is eq to :forward, :backward, or :toggle ; no motion will occur until the even the extended firmware does not yet support indirect ; next call to set-effector-state addressing or call stacks, some of the “functional” nature of (set-sensor-state 2 :type :touch :mode :boolean r) (set-effector-state ‘(:A :C) :power :on r) Common Lisp is still missing. For example, some RCXLisp (LOOP ;this loop will repeat forever until sensor 2 returns a 1 functions cannot accept variable values for some arguments; (SETF result (sensor 2 r)) they can only accept constants. (WHEN (AND (NUMBERP result) ;needed to keep = from causing error if ;sensor function returns nil. For consistency with “Remote RCXLisp,” and to make it more (= result 1)) straightforward to transfer desktop Lisp code to the RCX, (RETURN))) (set-effector-state ‘(:A :C) :power :float r)))) RCXLisp implements all of the RCX-control functions i n “Remote RCXLisp.” In RCXLisp however, control functions like set-sensor-state do not have an optional final stream (DEFUN testing () argument since it is assumed that the Lisp code will only be (with-open-com-port (port :LEGO-USB-TOWER) executed on the RCX unit itself. If an RCX needs to control (with-open-rcx-stream (rcx10 port :timeout-interval 80 :rcx-unit 10) the behavior of another RCX unit, it does not download ; increase/decrease serial timeout value of 80 ms depending on programs into the other RCX. Instead, it sends integer-valued messages that the other RCX must interpret to determine what ;environmental factors like ambient light. action to take. (WHEN (alivep rcx10) (full-speed-ahead rcx10 5 :forward))))) RCXLisp supports analogs to the following subset of Common Lisp control expressions, along with their standard Figure 2. Sample “Remote RCXLisp” code semantics defined in CLTL2: DOTIMES, COND, IF, LOOP, PROGN, RETURN, and WHEN. The RCXLisp language supports 16-bit signed integer arithmetic with the following operators: (DEFUN full-speed-ahead (r s dir) +, -, *, and / (integer division). RCXLisp provides the >, >=, <, “This will make the rcx in R go at speed S in direction DIR until touch <=, =, /=, and EQUAL Common Lisp comparison operators i n sensor on its ‘2’ port returns 1.” their full functionality. Just as Common Lisp allows one t o (LET ((result 0)) use comparison invocations such as “(< 2 x 6)” to test for (using-rcx r when the value of x is between 2 and 6, so too does RCXLisp. (set-effector-state ‘(:A :B :C) :power :off) It also provides a limited version of the Common Lisp ;in case things are in an inconsistent state, RANDOM function. ;turn everything off first (set-effector-state ‘(:A :C) :speed s ) RCXLisp also supports the not, and, and or boolean operators, (set-effector-state ‘(:A :C) :direction dir ) ; dir is eq to :forward, :backward, or :toggle along with their CLTL2 semantics (including the “boolean ; no motion will occur until the short-circuit”). RCXLisp does not support floating point ; next call to set-effector-state (set-sensor-state 2 :type :touch :mode :boolean) arithmetic, but it does support the boolean data type (i.e. T and (set-effector-state ‘(:A :C) :power :on ) NIL) and certain keyword constants (although new keywords (LOOP ;this loop will repeat forever until sensor 2 returns a 1 (SETF result (sensor 2 )) cannot be defined yet). (WHEN (AND (NUMBERP result) ;needed to keep = from causing error if Constants are declared in RCXLisp programs with defconstant, ;sensor function returns nil. which follows the semantics of the Common Lisp (= result 1)) (RETURN))) DEFCONSTANT form, and global variables can be declared (set-effector-state ‘(:A :C) :power :float )))) with defvar, whose semantics are only partially the same as those of the Common Lisp DEFVAR form. Values (signed 16- Figure 3. Using ‘using-rcx to clean up “Remote RCXLisp” code. bit integers and T and NIL) can be stored into variables using Programs that are intended to be executed on an RCX are first setq, which is similar to the Common Lisp SETQ form. compiled within the RCXLisp desktop environment and then Currently there is n o analog in RCXLisp to the Common Lisp downloaded through the IR Tower to the RCX. Firmware is also SETF macro. loaded from the desktop Lisp environment. These two actions Since general function calls are not supported, RCXLisp does are accomplished with the download-firmware and rcx-compile- not have an analog to the Common Lisp DEFUN form. In an and-download functions. It is important to note that these effort to support some kind of code abstraction, the language functions are native to the Lisp environment. That is, no non- design borrows inspiration from NQC’s emphasis on macros Lisp mechanism is needed for these actions. Both LeJOS [6]

4.for code abstraction and includes a defmacro form that follows the complete semantics of Common Lisp’s DEFMACRO form. RCXLisp also borrows from Rodney Brooks’ much earlier (and 4. PROJECTS WITH RCXLISP proprietary) “L” language [2] a desire for simplicity (many advanced Common Lisp functions are not available in that 4.1 MindStorms Equipment language) and memory-conservation that is necessary for The AI course at Villanova uses RCXLisp and MindStorms i n squeezing as much programming as possible into the small team-based active-learning projects. Each team’s kit for memories available on most robot platforms even today. constructing LEGO robots contained the following hardware: The language also provides two special-purpose forms that are (a) 3 Mindstorms Robotic Invention Systems packages neither in the “Remote RCXLisp” language nor the Common (b) 3 more light sensors beyond the three in (a) Lisp language. The first form is defregister, which is used t o (c) 3 more touch sensors beyond the six in (a) bind symbolic variable names to particular RCX variable registers. Defregister allows a programmer to tie a symbolic (d) 3 more motors beyond the six in (a) variable name to a given register so that a “Remote RCXLisp” (e) 2 LEGO rotation sensors program on a desktop using var to query a register can be guaranteed to access the intended variable value. (f) 2 HITECHNIC magnetic compass sensors The second non-standard form is defthread, which is used t o (g) 1 HITECHNIC infrared distance sensor define RCX threads to run on an RCX unit. Calling this form (h) 2 HI-TECH STUFF limit-switch adapters for motor ports “non-standard,” however, is less of an indictment of RCXLisp (i) 24 rechargeable batteries than of the Common Lisp spec itself since as of 2003 n o progress has been made in formalizing threading in the (j) 1 large lockable toolbox to hold all of the above as well language! as a partially-completed robot. (defconstant *receiver* 1) The robotics laboratory also has a few extra sensors such as (defregister 4 *LIMIT* 16) two HITECHNIC ultrasound distance sensors and two LEGO Vision Command cameras for special projects as they arise. (defthread (signaller) () (loop Hitechnic (www.hitechnic.com) has ceased operations, but the (send-message 78) third party manufacturer hi-techstuff (www.hitechstuff.com) (sleep 15) ;; this is to leave the IR port silent for a ;; short time in case a desktop is sending a message. offers many similar sensors except unfortunately for the )) compass sensor. We are in negotiations to get a new source of (defthread (alpha :primary t) ( ) compass sensors, since we have found them to be very useful (let ((diff1 0) in navigation problems. (diff2 0)) (set-sensor-state *receiver* :type :light :mode :raw) (setq diff1 (abs (- (sensor *receiver* :raw) 4.2 Project Descriptions (sensor *receiver* :raw)))) (setq diff2 (abs (- (sensor *receiver* :raw) The following RCXLisp-based projects have been developed (sensor *receiver* :raw)))) for the course: (start-rcx-thread signaller) (loop I. Simple-Reflex Robot Design (and RCXLisp Orientation). This (when (>= (abs (- diff1 diff2)) *LIMIT*) 10-day project’s goal was to show students how robots with (play-tone 500 1)) (setq diff1 diff2) simple stimulus-response rules and no model of the (setq diff2 (abs (- (sensor *receiver* :raw) environment could achieve effective behaviors. This project (sensor *receiver* :raw))))))) asked students to design a robot based on a tread-wheeled Figure 4. Multi-threaded RCXLisp Sample Code “Pathfinder” model described in LEGO’s user manual. Students were required to start with this basic design in order to reduce Figure 4 shows a sample RCXLisp program that illustrates time spent on distracting mechanical engineering issues, but many of the features described above. The program will beep they were encouraged to mount sensors as needed. whenever the RCX is carried too close to a reflective object. Students first built a robot that used a compass sensor t o This code makes the IR port on an RCX work together with a maintain a bearing (team 1 goes North, team 2 goes South, etc.) light sensor on sensor port 1 to implement a simple proximity They next added code to monitor either (a) whether a robot i s sensor. The “signaler” thread repeatedly sends out an arbitrary too close to a wall, or (b) whether, via feedback from mounted integer message through the RCX’s IR port. When the front of light or touch sensors that the robot was about to roll over a the RCX gets too close to a tall obstacle, the IR signal from the dark tile on the floor. In both cases the robot had to back u p IR port will reflect back, and the light sensor will pick this and/or turn to avoid the obstacle for a brief time, then resume echo up. As the reflections increase in intensity, the light moving ahead on the bearing. This was implemented twice sensor’s value will jump more wildly. The value of *LIMIT* using RCXLisp and “Remote RCXLisp.” may need to be experimented with. It is declared as a register variable because this allows it to be modified dynamically b y II. Robot Odometry. This 2-week project’s goal was to help a "Remote RCXLisp" program on a desktop, by using var t o students understand the major factors that can introduce error access and set register 4. into a robot’s internal representation of where it believes i t currently located in the world – an important issue in any 3.3 Platform Support navigation process. It also introduced them to the importance The RCXLisp libraries are supported on the Allegro (Franz), of maintaining a representation of state (the robot’s position). MCL (Digitool), and Xanalys Common Lisp environments, o n both Windows (98, 2000, and XP) and Mac OS X.

5.Each team was required to design and build a robot that would colored. Scattered throughout the field were black, white, and measure the perimeter of a convex black shape on a light yellow ping pong balls. For each ball that was in a team’s nest background on the floor. The reported measurement (over 190 at the end of the contest, the following points were awarded: cm) had to be accurate to within +/- 3 cm, and had to be white +1, yellow +5, black –1. The playing field was marked obtained within 1 minute from the time the robot was started. with a black 1x1-foot grid whose lines were 1 cm wide. Figure The project allowed use of dead-reckoning and landmark- 5 shows a view of one such contest layout. based navigation techniques. Although all teams succeeded i n this project, all were surprised at how short the 1-minute time limit soon appeared in light of the accuracy constraint. If Teams were encouraged to try a wide variety of game strategies, students elected to use a compass sensor to record orientation, some of which required landmark-based navigation via the then the shape was allowed to be either convex or concave. grid, others of which required state-space hill-climbing, and still others of which relied on probabilistic observations III. Robotic 8-Puzzle Solver. This 2-week project had the goal about the environment. Teams were also encouraged to make of showing students that knowledge representations (data their use of strategies time-dependent: as the contest abstractions) that speed up search-based problem solvers can progressed, robots could switch strategies based on their produce solution representations that are not easily translated current state (e.g. estimated score, position on field). Since into control programs for hardware. robots were permitted to “attack” other nests and scatter or steal balls, there was a very wide variety of approaches that a The project had two stages. In the first stage students had t o team could explore, minimizing the risk of teams develop a knowledge representation and Lisp search program unintentionally duplicating their efforts. to solve the 8-Puzzle. The team developed a set of four operators that involved conceptually moving the “space” up, Students were also encouraged to mix RCXLisp and “Remote down, left, or right, rather than 32 operators for moving each of RCXLisp” usage. the numbered tiles up, down, left, or right. The students observed that this design decision dramatically reduced the branch factor of the search tree (4 vs. 32), leading to a faster execution time for the game-solver. 5. STUDENT EXPERIENCE WITH RCXLISP The second stage required students to write a “Remote 5.1 Student Background RCXLisp” program that sent remote-control messages to a The elective AI course at Villanova has no formal Mindstorms robotic arm mechanism to move pieces in an 8- programming prerequisites. Computer science majors Puzzle according to the solution developed by stage 1’s typically take the course in their fourth year, by which time programming. It was in this stage that students discovered most majors have taken a Programming Languages (PL) course that the search space reformulation trick ultimately cost them that briefly introduces them to Lisp or Scheme. in the complexity of the translation their second program had to perform on the “move space” operator list to “move tile at The course is also open to cognitive science minors and (2,2) to (2,1)” types of commands. computer engineers, who generally have no programming experience in Lisp and at most one semester of introductory programming in Java. 5.2 Student Experience Reports RCXLisp make extensive use of keyword and optional arguments, as well as streams and macros – concepts not often explored in depth in Common Lisp in courses like Programming Languages (PL) and almost never in Lisp-based AI courses simply because of a lack of motivating material. Students who I have taught in both courses have commented on how the RCXLisp environment’s use of extended function argument capabilities helped them understand the benefits and pitfalls of these features better than when they briefly encountered them in the PL course. Several cognitive science minors have commented on how they felt they could get past coding details faster in RCXLisp (and Common Lisp) than i n Figure 5. Capture-the-Balls Competition. Later competitions allow Java because of the Lisps’ lack of typing. dangling of RCX IR Towers over the playing field for better remote- control approaches. Both my students and I noticed the reduced overhead i n learning how to program the RCXs. Since RCXLisp is just an IV. Capture-the-Balls Contest. This final project’s goal was t o extension of the Common Lisp they were already using the AI help students tie the skills they developed in projects I-III. and PL courses, they could spend more time on the application Each team was required to design and build a team of two or problem rather than on learning yet another language. three robots each no larger than 1 cubic foot. The robots’ task The library’s support for “on-the-fly” program generation and was to play in a 20-minute contest against other teams’ robots. download also helped students appreciate the power of Contestants had to play in a 20x9 sq. ft. walled playing area i n Common Lisp’s lack of differentiation between code and data. which each team had a 1 sq. ft. nest area, colored dark purple. Since Common Lisp function declarations are themselves All other portions of the playing field were light-yellow

6.merely formatted linked lists, students could generate plans as 7. ACKNOWLEDGMENTS linked lists within a planner and then download the same data LEGO MindStorms and RCX are trademarks of the LEGO to the RCX as an immediately executable form. Group, which does not sponsor, authorize, or endorse any of Students have also commented on the immediacy of working the third-party work cited in this article. The author of this with RCXs via the Common Lisp Listener: simply by invoking article has no financial relationship with the LEGO Group a function in the Listener, an RCX can be made to respond. except for a discount purchase plan for MindStorms This has helped them understand the differences and equipment for seminars run under NSF Grant No. 0306096. similarities between compiled and interpreted code. I am grateful to Andrew Chang for his graduate independent The library’s integration with low-level system functions such study work that led to extending the MindStorms’ firmware. as infrared USB communication helps students get past the uninteresting details of port communication and instead This material is based upon work supported by the National concentrate on the AI-oriented problems of environmental Science Foundation under Grant No. 0088884 and Grant No. noise, sensor sensitivity, and environmental nondeterminism. 0306096. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the 6. CONCLUSIONS AND FUTURE WORK author and do not necessarily reflect the views of the National Science Foundation. RCXLisp is the first open-source Lisp approach for programming physical robots that supports both remote control and on-board programming of robots as well as targeted 8. REFERENCES communication between multiple robots and command-center [1] Baum, D. Not Quite C (NQC), Sept. 2003, desktops. Coupled with the low cost and adaptability of http://www.baumfamily.com/nqc/ MindStorms, RCXLisp should help make it easier for cost- [2] Brooks, R. A. (1993), L: A Subset of Common Lisp, conscious schools to add robotics-inspired projects to AI and Technical report, Massachusetts Institute of TechnologyArtificial Intelligence Lab. courses, without having to turn computer science students into [3] Klassner, F., A Case Study of LEGO Mindstorms'TM mechanical or computer engineers. Suitability for Artificial Intelligence and Robotics Courses a t The library has separate standalone API functions for accessing the College Level, in Proceedings of the 3 3rd SIGCSE serial ports generically and USB ports with MindStorms IR Technical Symposium on Computer Science Education (2002). [4] Martin, F., The MIT HandyBoard Project, September 2003. Towers attached, making it a useful basis for designing Lisp http://lcs.www.media.mit.edu/groups/el/Projects/handy-board solutions for interfacing with other serial devices, but not for [5] Noga, M. LegOS, September 2003, and USB devices. I have (ambitious?) plans to extend the API http://www.noga.de/legOS to cover USB generically. [6] Solorzano, J. LejOS, Sep 2003, http://lejos.sourceforge.com [7] Russell, S. and Norvig, P. Artificial Intelligence: A Modern Improvements remain. One important goal is to add call stack Approach. 2nd edition, Prentice Hall, 2003. support and memory management support to the Mnet [8] Wick, A., Klipsch, K., and Wagner, M. LEGO/Scheme firmware. This would extend the Lisp functionality of the on- compiler, http://www.cs.indiana.edu/~mtwagner/legoscheme board language for RCXs (e.g add DEFUN and list-manipulation functions). Lest the lack of garbage collection seem too limiting for RCXLisp right now, it should be noted that leJOS [6] also does not currently implement a garbage collector in an effort to keep the JVM footprint as small as possible. A related possibility would be to eliminate firmware and target the H8 processor directly, as LegOS does [5]. Another goal is to integrate the LEGO Vision Command Camera into the RCXLisp library. This would give students a low-cost yet powerful tool for exploring machine vision problems at the undergraduate level. From the standpoint of courseware improvements, I am working on a formal integration of RCXLisp with one or more open-source planners. The goal here would be to define several primitive action forms using RCXLisp. At issue would be deciding how low-level the plan operators should be. Alternatively, one could just supply RCXLisp with a vetted planner and leave the combination up to the students. This would most likely make the project too complicated for an undergraduate AI course, though.