launching into ai's october sky with robotics and lisp

16
Robotics projects coupled with agent-oriented trends in artificial intelligence education have the potential to make introductory AI courses at liberal arts schools the gateway for a large new generation of AI practitioners. However, this vision’s achieve- ment requires programming libraries and low-cost platforms that are readily accessible to undergrad- uates and easily maintainable by instructors at sites with few dedicated resources. This article presents and evaluates one contribution toward imple- menting this vision: the RCXLisp library. The li- brary was designed to support programming of the Lego Mindstorms platform in AI courses with the goal of using introductory robotics to motivate un- dergraduates’ understanding of AI concepts within the agent-design paradigm. The library’s evalua- tion reflects four years of student feedback on its use in a liberal-arts AI course whose audience cov- ers a wide variety of majors. To help establish a context for judging RCXLisp’s effectiveness this ar- ticle also provides a sketch of the Mindstorms- based laboratory in which the library is used. I n the movie October Sky, a group of high school students become inspired to learn how to build high-altitude rockets after watching Sputnik glide across the night sky soon after it was launched in October 1957. To- day AI should be poised to capture students’ in- terest and imaginations in the same way that movie showed one application in physics and astronomy capturing them in the 1950s and 1960s. Look at what today’s undergraduates are seeing and hearing about AI in popular culture. Besides the popularity of the AI-inspired fiction in the movies I, Robot and A.I., consider the highly publicized success of the Mars rovers Spirit and Opportunity, the ESPN coverage of the DARPA autonomous vehicle Grand Challenge, the lust among gamers after cleverer computer opponents, and the prevalence of word proces- sor speech-recognition systems. Students are not just hearing about AI applications—they are experiencing them more directly than did the students in October Sky gazing up at Sput- nik’s starlike dot. Today’s college and high school students can evaluate AI applications firsthand (for example, in games, robotic vacu- um cleaners, and intelligent search engines). More importantly for AI, the immediacy of their experience often makes them feel they could replicate or even improve the applica- tions’ capabilities—if only they understood the AI theory behind the application. And this situation definitely is enticing stu- dents into trying out introductory AI courses at liberal arts colleges. The difficulty for instruc- tors at such schools is retaining these students’ interest in the field after their first exposure to formal AI. In many smaller schools’ computer science departments there is at most one facul- ty member with AI training, usually with few dedicated resources. Instructors from such schools have attested at AAAI and SIGCSE sym- Articles SPRING 2006 51 Copyright © 2006, American Association for Artificial Intelligence. All rights reserved. 0738-4602-2006 / $2.00 Launching into AI’s October Sky with Robotics and Lisp Frank Klassner AI Magazine Volume 27 Number 1 (2006) (© AAAI)

Upload: tranxuyen

Post on 08-Feb-2017

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Launching Into AI's October Sky with Robotics and Lisp

■ Robotics projects coupled with agent-orientedtrends in artificial intelligence education have thepotential to make introductory AI courses at liberalarts schools the gateway for a large new generationof AI practitioners. However, this vision’s achieve-ment requires programming libraries and low-costplatforms that are readily accessible to undergrad-uates and easily maintainable by instructors at siteswith few dedicated resources. This article presentsand evaluates one contribution toward imple-menting this vision: the RCXLisp library. The li-brary was designed to support programming of theLego Mindstorms platform in AI courses with thegoal of using introductory robotics to motivate un-dergraduates’ understanding of AI concepts withinthe agent-design paradigm. The library’s evalua-tion reflects four years of student feedback on itsuse in a liberal-arts AI course whose audience cov-ers a wide variety of majors. To help establish acontext for judging RCXLisp’s effectiveness this ar-ticle also provides a sketch of the Mindstorms-based laboratory in which the library is used.

In the movie October Sky, a group of highschool students become inspired to learnhow to build high-altitude rockets after

watching Sputnik glide across the night skysoon after it was launched in October 1957. To-day AI should be poised to capture students’ in-terest and imaginations in the same way thatmovie showed one application in physics andastronomy capturing them in the 1950s and

1960s. Look at what today’s undergraduates areseeing and hearing about AI in popular culture.Besides the popularity of the AI-inspired fictionin the movies I, Robot and A.I., consider thehighly publicized success of the Mars roversSpirit and Opportunity, the ESPN coverage of theDARPA autonomous vehicle Grand Challenge,the lust among gamers after cleverer computeropponents, and the prevalence of word proces-sor speech-recognition systems. Students arenot just hearing about AI applications—theyare experiencing them more directly than didthe students in October Sky gazing up at Sput-nik’s starlike dot. Today’s college and highschool students can evaluate AI applicationsfirsthand (for example, in games, robotic vacu-um cleaners, and intelligent search engines).More importantly for AI, the immediacy oftheir experience often makes them feel theycould replicate or even improve the applica-tions’ capabilities—if only they understood theAI theory behind the application.

And this situation definitely is enticing stu-dents into trying out introductory AI courses atliberal arts colleges. The difficulty for instruc-tors at such schools is retaining these students’interest in the field after their first exposure toformal AI. In many smaller schools’ computerscience departments there is at most one facul-ty member with AI training, usually with fewdedicated resources. Instructors from suchschools have attested at AAAI and SIGCSE sym-

Articles

SPRING 2006 51Copyright © 2006, American Association for Artificial Intelligence. All rights reserved. 0738-4602-2006 / $2.00

Launching into AI’s

October Skywith Robotics

and LispFrank Klassner

AI Magazine Volume 27 Number 1 (2006) (© AAAI)

Page 2: Launching Into AI's October Sky with Robotics and Lisp

ficiencies can supply partial source code for AIsystems (like planners or search algorithms) forstudents to complete. Those who want to en-courage students’ deeper understanding of atopic through attention on “knob-turning” ex-periments (Cohen 1995) can supply completedsource code sets from the same corpus.

All three trends have strongly influenced theAI curriculum at Villanova University. In thefall of 1997 the introduction to AI course CSC4500 was reorganized around the concept ofagent-oriented design. This approach was aug-mented in the fall of 1999, offering with team-based Lego Mindstorms (Klassner 2002) pro-jects in order to have students explore therelationships among hardware, environment,and software organization in agent design.Since the spring 2001 course we have used theRCXLisp library developed at Villanova for pro-gramming Mindstorms in Common Lisp. Thisarticle describes the RCXLisp library with re-spect to these trends, focusing on its develop-ment, its uses in CSC 4500, and student feed-back on both the course and its library. To helpthe reader evaluate RCXLisp’s effectiveness,this article also provides a sketch of the Mind-storms-based laboratory in which the library isused.

Choosing Mindstorms and LispThe CSC 4500 course is an elective with no for-mal programming prerequisites. Computer sci-ence majors typically take the course in theirfourth year, by which time most of these stu-dents have taken a programming languagescourse that introduces them to Lisp. The courseis also open to third- and fourth-year cognitivescience concentrators and computer engineer-ing majors, who generally have no program-ming experience in Lisp and as little as one se-mester of introductory programming in Javafrom their first year. The cognitive science stu-dents hail from a variety of majors: biology, po-litical science, and physics, to name a few.

The course uses Common Lisp in its pro-gramming projects for two reasons. The first isto leverage Lisp’s support for rapid prototypingagainst the large body of open-source AI Lispsystems. The second is to reinforce computerscience majors’ Lisp experience from their pro-gramming languages course, thereby offeringstudents another option besides C/C++ formeeting the department goal that graduates befamiliar with at least one language beyond Ja-va.

Once the decision was made in 1997 to orga-nize CSC 4500 around the agent paradigm, as-signments using robotic agent simulations

posia that they must tread carefully between abreadth-first survey style that downplays fullsystem implementation experience and adepth-first concentration on subfields thatmight not directly relate to popular applica-tions without exorbitant software or hardwareinvestments. A heavily unbalanced course, ineither direction, can leave undergraduates withunrealistic (or worse—nonexistent) views ofhow real-world AI systems can be designed andimplemented to meet real-world performancegoals.

Fortunately, three trends are helping tomaintain the balance that AI education needsfor inspiring students from smaller schools.The first is the growth of the intelligent agentdesign framework (Russell and Norvig 2003)that emphasizes study of the limits and capa-bilities of different AI techniques in producingactions appropriate to an agent’s environment.Because it stresses identification of the weak-nesses as well as the strengths of these tech-niques, this framework also naturally encour-ages exploration of how to integrate two ormore AI techniques (as might be covered in amore breadth-first oriented course) into hybridsystems so as to mitigate their individual weak-nesses.

The second trend is the increasing availabil-ity of low-cost robotics platforms1 that can playthe same motivating role in AI education thatmodel rockets and toy telescopes did for as-tronomy and physics education in the pastcentury. Pure software-oriented projects such asgaming agents or simulations can indeed moti-vate students, but there is no denying the in-creased registration levels seen in elective AIcourses the first time a new robot-developmentcomponent is announced for them.

The third trend is vital to the success of thesecond. It is the growing body of open-sourcesoftware systems and programming tools forrobot kits that allows students with limited re-sources to move quickly from learning about AItechniques in the abstract to actually buildingartifacts with them (Yuasa 2003).2 It is notenough to give students a robot platform thatrequires a whole semester to learn how to pro-gram. After installing the platform’s program-ming tools, students should be able to get past“Hello Robot” trials quickly in order to grapplewith moderately complex programs with con-fidence-boosting results. From a small-collegeinstructors’ perspective, the most effective ele-ments in this software collection allow them toextend the depth of their courses’ coverage invarious ways. Those instructors who want toencourage students’ deeper understanding of atopic through attention to implementation ef-

Articles

52 AI MAGAZINE

Page 3: Launching Into AI's October Sky with Robotics and Lisp

were tried but did not generate significant en-thusiasm among students. Based on studentfeedback and positive reports on robots’ use inthe computer science education literature(Beer, Chiel, and Drushel 1999; Kumar andMeeden 1998; Mazur and Kuhrt 1997; andStein 1996), the decision was made to try usingphysical robots in the course. The choice of ro-bot platform was based on four criteria: pro-gramming environment, cost, flexibility, and“student comfort level.” In 1999 there was nolow-cost robot kit that supported CommonLisp programming, so this criterion played anegligible role in the decision. A Mindstormskit with 750 construction pieces, sensors, andprogrammable hardware cost approximatelyUS$200. This was one quarter the cost of someHandy Board–based robot kits and one tenththe cost of an ActivMedia-based robot kit—twoof the other platforms considered. In the timesince this evaluation was conducted Lego hasreleased a “RoboChallenge” kit for US$150 thathas fewer construction pieces (250) for courseswhere a sophisticated robot chassis is unneces-sary. In terms of flexibility the Mindstorms kitsupports the creation of effectors such as arms,grippers, legs, tread casings, and so on, oftennot available in other basic kits. The HandyBoard platform, however, was similarly exten-sible. The final decision hinged on the “studentcomfort level” criterion. Many students hadplayed with Lego as children and felt more fa-miliar with those kits. The Mindstorms plat-form’s reusable snap-together sensors and ef-fectors allowed computer science majors tofocus more quickly on programming issues. Fi-nally, compared with an uncushioned HandyBoard, Mindstorms was judged to be moredurable in the face of inevitable drops andbumps in a computer lab setting.

At the time of Mindstorms’ adoption, therewas no Common Lisp environment for Mind-storms, and LeJOS—a popular Java environ-ment for Mindstorms—was still under develop-ment and not complete enough for classroomuse. There was a Scheme compiler targeted toMindstorms’ firmware, but it was a Unix-basedutility not integrated into any Lisp program-ming environment. This situation led to thedecision to use Not Quite C (NQC) for team-based robotics projects and Common Lisp forseparate course projects in search, planning,and machine learning. NQC was judged tohave a syntax that would be recognizable bymost students coming into CSC 4500, yetwould hide certain complexities like pointersand dynamic allocation from nonmajors.

Student surveys, however, indicated that theburden of working with two different lan-

guages distracted students from learning the AIconcepts of the course. We also found the lan-guage had little support for coordinating teamsof robots, though this problem is due more toNQC’s dependence on Lego’s firmware than toany design flaws in NQC itself.

Extending Mindstorms for a Lisp Environment

Against this historical background the decisionwas made to develop the Common Lisp libraryRCXLisp for programming the MindstormsRCX microcontroller. The RCX is the program-mable yellow brick at the heart of the LegoMindstorms kit, shown on the right in figure 1.

The RCX has a 16-megahertz central process-ing unit (CPU) (the Hitachi H8/3292 microcon-troller) and 32 kilobytes of random-accessmemory (RAM), and it houses an infrared (IR)transmitter/receiver for sending and receivingdata and commands from a desktop PC or fromother RCXs. The IR transceiver has a range of15–25 feet, depending on lighting conditions.The RCX is powered by six AA batteries. Theplatform supports both serial-port and univer-sal serial bus (USB) IR towers for broadcastingmessages and software to the RCX from a desk-top (a USB IR tower is shown on the left in fig-ure 1). RCX units have three input (sensor)ports, three effector ports, and a five-characterliquid crystal display (LCD) display. Lego mar-kets touch, light, temperature, and axle-rota-tion sensors that can be connected to the RCX’sinput ports; third-party vendors offer magnetic

Articles

SPRING 2006 53

Infrared (IR) Tower

LCDDisplay

EffectorPorts

IR PortSensorPorts

Figure 1. The Lego Mindstorms Infrared Transceiver Tower (Left) and the RCX Unit (Right).

Page 4: Launching Into AI's October Sky with Robotics and Lisp

have several teams of students in the same labcontrol their own robots without interference.It is also not possible for a single desktop appli-cation to coordinate several robots of a teamwithout a mechanism to address the robots’RCXs individually.

To address this communication shortcom-ing, a firmware version named Mnet (for Mind-storms networked) was developed at VillanovaUniversity. Mnet replaces Lego’s standardfirmware. It supports directed IR communica-tions by extending the Lego protocol withsource and target fields and by allowing eachRCX and host desktop to set a 1-byte ID valuefor itself. Mnet firmware also allows an RCX torestrict the RCXs from which it will accept mes-sages. To support compatibility with other pro-gramming environments targeted to the RCX,Mnet recognizes the same byte-code set as thestandard Lego firmware.

Mnet does not support garbage collection orcall stacks. This decision was made to speed upfirmware development and to keep thefirmware footprint reasonably small. Lest thelack of garbage collection seem too limiting forRCXLisp, it should be noted that LeJOS, too,does not currently implement a garbage collec-tor in an effort to keep the JVM footprint assmall as possible (Cohen 1995). Our RCX-basedlisp system, RCXLisp, developed atop this Mnetfirmware.

RCXLisp Language DesignThe first goal of RCXLisp was to help AI stu-dents start quickly with designing basic soft-ware for controlling individual robots and ro-bot teams. It achieves this by augmenting theCommon Lisp language with an applicationprogram interface (API) of primitive functionsthat represent a programmer’s, rather than anengineer’s, view of a robot and its communica-tion abilities. It adheres as closely as the Mnetfirmware permits to the Common Lisp specifi-cation of the second edition of Steele’s Com-mon Lisp: The Language (1990).

The second goal of RCXLisp was to supportintegration of Mindstorms with sophisticatedAI systems. Since such integration will natural-ly produce distributed systems, this goal in-cluded the ability to coordinate processes onthe RCX with processes within a Lisp desktopenvironment. Table 1 summarizes the featuresthat RCXLisp provides in support of this goal.

The RCXLisp libraries are currently support-ed in the LispWorks environments on bothWindows (98 through XP) and Mac OS X. It isalso available for use on Digitool’s MCL for theMac platform, but currently only for Mac OS 9.

compass sensors, ultrasonic distance sensors,and infrared distance sensors. Motors, light-emitting diodes (LEDs), and infrared emitterscan be attached to the effector ports. Lego alsooffers a computer-tethered video camera foruse with the RCX.

The 32 kilobytes of nonupgradeable RAM onthe RCX represents a significant limitation forAI robotic agent projects involving schedulers,planners, or neural networks with large foot-prints. However, this can be mitigated by judi-cious use of the system’s firmware.

The Lego-supplied firmware models a primi-tive virtual machine with support for threadingand 16-bit integer arithmetic. There is no callstack; programmers must watch for accidentalunbounded recursion problems. There is alsono dynamic allocation support. A key featureof the firmware is that it supports two styles ofprogram control: on-board programming andremote-control programming. In the first stylethe robot’s behavior depends only on the pro-gram loaded into its memory. In the secondstyle a control program on a desktop computerbroadcasts individual instructions to the robotfor immediate execution.

Thus, it could be possible for large AI systems(with accompanying needs for call stack anddynamic allocation support) to be used withMindstorms as long as they are modified tocontrol RCX robots remotely from a desktopcomputer. Unfortunately, Lego firmware uses abroadcast protocol for sending control mes-sages to RCXs. It does not support targetedmessage passing. It therefore is not possible to

Articles

54 AI MAGAZINE

Control an RCX from a Common Lisp program on a desktop computer.

Create and compile RCXLisp programs for downloading to RCXs ìon t he fly,” from within Common Lisp desktop environments.

Control more than one RCX from a single MindStorms IR Tower simultaneously.

Set up networks of RCXs that can communicate with each other in a targeted manner.

Table 1. RCXLisp Features That Support Integration of Common-Lisp AISystems with the Mindstorms RCX.

Page 5: Launching Into AI's October Sky with Robotics and Lisp

A version for Allegro (Franz) is under develop-ment.

RCXLisp has both a remote and local com-ponent. The first is remote RCXLisp, a collec-tion of macros, variables, and functions for re-motely controlling RCX units from a desktop.The second is local RCXLisp, a subset of Com-mon Lisp that can be cross-compiled to run onboth Lego and Mnet firmware for on-boardcontrol of the unit.

The next two subsections detail these twoparts of RCXLisp, with the aim of showing thetight integration among the Lisp environment,the RCX, and the desktop control processes thelibrary makes possible. The example code sup-ports the claim that RCXLisp facilitates linkingAI systems with Mindstorms robots. The dis-cussion occasionally makes comparisons be-tween RCXLisp functions and Common Lispfunctions of the same name. For clarity’s sakeall RCXLisp functions will appear in italics.

Remote RCXLispThe remote RCXLisp library provides with-open-com-port and with-open-rcx-stream macrosto set up communication environments forcontacting RCX units. These macros are mod-eled closely on Common Lisp’s with-open-stream macro. With-open-com-port specifies thecommunication port (serial or USB) for con-tacting an RCX, and with-open-rcx-stream de-fines the data stream through a port for a spe-cific RCX unit. The macros offer users severalarguments to modify low-level port character-istics such as data transmission rate, timeoutinterval, and retry limit. This flexibility is im-portant especially when ambient lighting andother environmental conditions change. Thecode in figure 2 shows how these macros areused and provides an example of the functionsthat can be invoked to control an RCX fromwithin the macros’ communication environ-ment.

In keeping with RCXLisp’s design goal ofhelping programmers focus on programmingrather than lower-level communication issues,the language contains a tell-rcx macro thatcombines the two port and stream macros’ ar-gument lists and builds in flexible default val-ues for port settings loadable from a site config-uration file. This level of abstraction helpsbeginning Lispers new to macros and streammanagement.

Ordinarily one would type the functions infigure 2 into an editor and then load them intoa desktop environment for invocation at theLisp listener prompt as (testing). The full-speed-ahead example contains the following remoteRCXLisp functions for controlling an RCX: set-

effector-state (for controlling motors), set-sensor-state (for configuring input types), and sensor(for accessing the current reading from a sensorinput). The testing function uses alivep to deter-mine whether the RCX is in range and re-sponding. It is important to note for later dis-cussion that the language includes a varfunction that asynchronously queries for thevalue stored in one of the RCX’s 32 globally-ac-cessible registers.

All remote RCXLisp functions take an op-tional stream argument (for example, “r” infull-speed-ahead). One can forego repetitioustyping of the stream argument, with the using-rcx macro as in figure 3 to define a defaultstream for enclosed RCXLisp functions. Thismacro is closely modeled on Common Lisp’susing-slots macro for object-oriented program-ming. It also serves to define a symbolic envi-ronment in which the desktop acts as a directortelling some particular RCX what to do next.

Programs that are intended to be executedon an RCX are first compiled within theRCXLisp desktop environment to Mnet bytecode and then downloaded through the IRtower to the RCX. This is accomplishedthrough the rcx-compile-and-download utilityfunction in remote RCXLisp. The Mnetfirmware (and standard Lego firmware) is alsoloaded from the desktop Lisp environmentwith the download-firmware utility function inremote RCXLisp.

It is important to note that these functionsare native to the Lisp environment. That is, nonon-Lisp mechanism is needed for these ac-tions. Both LeJOS3 and Wick, Klipsch, andWagner’s Lego/Scheme compiler4 require a sep-arate command-line system program to down-load compiled code or firmware into the RCX.The compiler in rcx-compile-and-download is im-plemented in Lisp. It is this feature that allowsRCXLisp to interface cleanly with other AI sys-tems written in Common Lisp. The rcx-compile-and-download utility supports on-the-fly compi-lation of both dynamically generated RCXLispforms (by a planner, for example) and staticforms in prewritten files for execution on a ro-bot.

XS (Yuasa 2003) is a Scheme interpreter forMindstorms developed after RCXLisp. It too issupported by native libraries for a Scheme desk-top environment. The difference between re-mote RCXLisp and XS is that XS sets up thedesktop as a listener and the RCX as the evalu-ator, while remote RCXLisp evaluates all formson the desktop and sends byte codes to theRCX. XS enjoys the advantages over RCXLispof a garbage collector and full call stack supporton the RCX but requires higher bandwidth in

Articles

SPRING 2006 55

Page 6: Launching Into AI's October Sky with Robotics and Lisp

some of the functional nature of CommonLisp.

For consistency with remote RCXLisp, andto simplify the transfer of desktop Lisp code tothe RCX, local RCXLisp implements all of theRCX control functions in remote RCXLisp. Inthe local version, however, control functionslike set-sensor-state do not have an optional fi-nal stream argument. It is assumed that thecode will only be executed on the RCX unit it-self. If an RCX needs to control the behavior ofanother RCX unit, it can do so through integer-valued messages for the other RCX to interpretrather than by outright code transfer.

Figure 4 shows how the “full-speed-ahead”function in figure 2 would be expressed in local

communication since remote control isachieved through the transmission of completeASCII expressions to the RCX for evaluation bythe on-board XS interpreter.

Local RCXLispLocal RCXLisp is a subset of Common Lispwith a few nonstandard additions that can becompiled and downloaded to run au-tonomously on an RCX. As with remoteRCXLisp, the design goal was to follow Steele’sstandard (Steele 1990) as closely as possible andto maintain compatibility with both Legofirmware and the Mnet extended firmware. Yetbecause neither firmware supports indirect ad-dressing or call stacks, local RCXLisp still lacks

Articles

56 AI MAGAZINE

(DEFUN full-speed-ahead (r s dir)“This will make the rcx in stream R go at speed Sin direction DIR until touch sensor on its ‘2’ port returns 1.”(LET ((result 0))

(set-effector-state ‘(:A :B :C) :power :off r);in case things are in an inconsistent state,;turn everything off first

(set-effector-state ‘(:A :C) :speed s r)(set-effector-state ‘(:A :C) :direction dir r)

; dir is eq to :forward, :backward, or :toggle; no motion will occur until the; next call to set-effector-state

(set-sensor-state 2 :type :touch :mode :boolean r)(set-effector-state ‘(:A :C) :power :on r)(LOOP ;this loop will repeat forever until sensor 2 returns a 1

(SETF result (sensor 2 r))(WHEN (AND (NUMBERP result)

;needed to keep = from causing error if;sensor function returns nil due to timeout.(= result 1))

(RETURN)))(set-effector-state ‘(:A :C) :power :float r))))

(DEFUN testing ()(with-open-com-port (port :LEGO-USB-TOWER)

(with-open-rcx-stream (rcx10 port :timeout-interval 80 :rcx-unit 10); increase/decrease serial timeout value of 80 ms depending on;environmental factors like ambient light.(WHEN (alivep rcx10)

(full-speed-ahead rcx10 5 :forward)))))

Figure 2. Sample Remote RCXLisp Code Illustrating Sensor-Based Motor Control.

Page 7: Launching Into AI's October Sky with Robotics and Lisp

RCXLisp for execution on board a robot. Notethat threads do not accept input arguments inRCXLisp yet, so parameters must be made intoglobal variables. Figure 5 demonstrates how de-fregister can set variables’ values from a desk-top program.

Local RCXLisp supports analogs to a coresubset of Common Lisp control expressions,Boolean operators, and data types, along with16-bit signed integer arithmetic including themost commonly used operators. For example,just as Common Lisp allows one to use compar-ison invocations such as “(< 2 x 6)” to test forwhen the value of x is between 2 and 6, so toodoes local RCXLisp. It provides a limited ver-sion of the Common Lisp RANDOM function, al-lowing on-board experimentation with proba-bilistic control algorithms.

Local RCXLisp does not support floating-point arithmetic. The ability to define new key-words is also lacking, but constants may be de-clared with defconstant and global variables canbe declared with defvar. Setq provides value-as-signment, but there is currently no analog inlocal RCXLisp to the Common Lisp SETFmacro.

Since general function calls are not support-ed, local RCXLisp does not have an analog tothe Common Lisp DEFUN form. In an effort tosupport some kind of code abstraction, thelanguage design borrows inspiration fromNQC’s emphasis on macros for code abstrac-tion and includes a defmacro form that follows

the complete semantics of Common Lisp’sDEFMACRO form. RCXLisp also borrows fromBrooks’s much earlier L language (Brooks 1993)a desire for simplicity and memory conserva-tion that is necessary for squeezing as muchprogramming as possible into the small mem-ories available on most inexpensive robot plat-forms even today.

The language provides two special-purposeforms that are neither in the remote RCXLisplanguage nor the Common Lisp language. Thefirst form is defthread, which is used to definethreads to run on an RCX unit. Calling thisform nonstandard, however, is less of an indict-ment of local RCXLisp than of the CommonLisp specification itself since as of 2005 littleprogress has been made in formalizing thread-ing in the language! The second form, defregis-ter, allows a programmer to tie a symbolic vari-able name to a given register so that a remoteRCXLisp program on a desktop using var toquery a register can be guaranteed to access theintended variable value on an RCX.

Figure 5 summarizes and illustrates many ofthe features just described. The program beepswhenever the RCX is carried too close to a re-flective object. This code makes the RCX IRport work together with a light sensor attachedat port 1 in order to implement a simple prox-imity sensor. The signaler thread repeatedlysends out an arbitrary integer message throughthe IR port. When the front of the RCX getsclose to an obstacle, the IR port’s signal reflects

Articles

SPRING 2006 57

(DEFUN full-speed-ahead (r s dir)“This will make the rcx in stream R go at speed S in direction DIR until touchsensor on its ‘2’ port returns 1.”(LET ((result 0))

(using-rcx r(set-effector-state ‘(:A :B :C) :power :off)(set-effector-state ‘(:A :C) :speed s )(set-effector-state ‘(:A :C) :direction dir )(set-sensor-state 2 :type :touch :mode :boolean)(set-effector-state ‘(:A :C) :power :on )(LOOP

(SETF result (sensor 2 ))(WHEN (AND (NUMBERP result)

(= result 1))(RETURN)))

(set-effector-state ‘(:A :C) :power :float ))))

Figure 3. Cleaning up Remote RCSLisp Code with the using-rcx Macro.

Page 8: Launching Into AI's October Sky with Robotics and Lisp

Setting up a Mindstorms Robotics Lab

The high school student protagonists in Octo-ber Sky required more than just reliable fuel andconstruction materials to achieve their goal ofa high-altitude rocket; they needed a testingfield. Besides a control system like RCXLisp, AIstudents need appropriate facilities to designand test their robot agents. The CSC 4500course has a 15 by 30 foot computer lab dedi-cated for its projects during a semester, but, aswill be seen from the following description, theroom’s setup can be duplicated without toomuch overhead even at schools where space isat a premium and labs must be shared amongcourses.

The course uses team-based active-learningrobotics projects. Students are grouped inthrees or fours, with each team having at leastone nonmajor. Accordingly, the lab has fourPCs—one per team—for programming robots.Each PC has an IR tower suspended from theceiling not only so that its signal will be inrange of the group’s RCXs on the floor but alsoso that the likelihood of someone accidentallyblocking the IR signal is reduced. The room’slighting is under the complete control of stu-dents, since sometimes bright sunlight or fluo-rescent lighting can interfere with the IR sig-nals used in the distributed control systemssupported by RCXLisp. For some projects, it isuseful to have a navigational grid on the floor,so a temporary grid of electrical tape markingout the 1–square-foot tiles on a portion of theroom is put down at the beginning of each se-mester CSC 4500 is offered. Figure 7 gives a pic-ture of this setup’s implementation. Note theIR towers at upper right suspended from theceiling and facing down for maximum rangefor remote control projects. The entire room is15 by 30 feet and accommodates four teams offour students.

Kits are prepared for the teams to use on allprojects throughout the semester. Table 2 liststhe equipment in a typical kit.

The robotics laboratory also has a few extrapieces of equipment: two Hitechnic ultrasonicdistance sensors, three Lego vision commandcameras, and ten Techno-stuff limit switchesfor special projects as they arise. Hitechnic5 is acontractor firm that manufactures Lego-com-patible sensors. Techno-stuff’s6 limit switchesallow one to link a touch sensor directly to amotor’s power connection. In this way thetouch sensor can detect when a motor-drivenarm, wheel, and so on, has reached some limitof movement and stop the motor without be-ing attached to one of the RCX’s three input

back, and the light sensor picks this echo up. Asthe reflections increase in intensity, the lightsensor’s value jumps more wildly. The value of*LIMIT* may need to be adjusted for environ-mental conditions or the light sensor’s sensitiv-ity. It is declared as a register variable so that aremote RCXLisp program can modify it on thefly. Figure 6 shows the remote RCXLisp code forachieving this. The :raw mode setting for thelight sensor means that the sensor returns un-interpreted 10-bit sensor values.

Articles

58 AI MAGAZINE

(defvar *dir* :forward)(defvar *s* 5)(defthread (full-speed-ahead :primary t) ( )

(set-effector-state ‘(:A :B :C) :power :off)(set-effector-state ‘(:A :C) :speed *s*)(set-effector-state ‘(:A :C) :direction *dir*)(set-sensor-state 2 :type :touch :mode :boolean)(set-effector-state ‘(:A :C) :power :on)(loop

(when (= (sensor 2) 1)(return)))

(set-effector-state ‘(:A :C) :power :float))

Figure 4. Local RCXLisp Code That Performs the Same Actions as “full-speed-ahead” in Figure 3.

Figure 5. Multithreaded Local RCXLisp Sample Code.

(defconstant *receiver* 1)(defregister 4 *LIMIT* 16)

(defthread (signaller) ()(loop(send-message 78)(sleep 25) ;; leave IR port silent for short time

;; in case desktop is sending message.))

(defthread (alpha :primary t) ( )(let ((diff1 0) (diff2 0))(set-sensor-state *receiver* :type :light :mode :raw)(setq diff1 (abs (- (sensor *receiver*) (sensor *receiver*))))(setq diff2 (abs (- (sensor *receiver*) (sensor *receiver*))))(start-rcx-thread signaller)(loop

(when (>= (abs (- diff1 diff2)) *LIMIT*)(play-tone 500 1))

(setq diff1 diff2)(setq diff2 (abs (- (sensor *receiver*)

(sensor *receiver*)))))))

Page 9: Launching Into AI's October Sky with Robotics and Lisp

ports. Thus the limit switch is an excellent re-source for increasing the RCX’s sensory band-width.

Because of the course’s emphasis on pro-gramming teams of agents, the cost for oneteam’s kit (with three RCXs) is approximatelyUS$900, and Lego now has piece sets availablethat could reduce the cost to US$750. Curriculafocusing on design of one robot per studentteam could use one Mindstorms set (with oneextra light sensor, one extra touch sensor, oneextra motor, and one axle-rotation sensor) perstudent team for approximately US$300.

Course Project DescriptionsSince 2000, RCXLisp has been used to imple-ment the following projects in the CSC 4500course’s laboratory. Typically three or four ofthe projects are assigned and completed in agiven semester. Some are used to help studentsdevelop skills for the course’s final robot com-petition (see the “Capture the Balls Contest”section). Although the majority are symbolicAI projects, there is nothing in the RCXLisp li-brary that would prevent it from supportingnumeric-level AI projects such as neural net-works.

Simple-Reflex Robot Design (andRCXLisp Orientation)This 10-day project is always assigned to showstudents how robots with simple stimulus-re-sponse rules and no model of the environmentcan achieve effective behaviors as well asdemonstrate emergent behavior. Students de-sign a robot based on a tread-wheeled“Pathfinder” model described in the Mind-storms user manual. Students start with this ba-sic design in order to reduce time spent on dis-tracting mechanical engineering issues, butthey are free to mount sensors on the chassis asneeded.

Students first build a robot that uses a com-pass sensor to maintain a given bearing: team 1goes north, team 2 goes south, and so on. Theynext add code to monitor, using data frommounted light sensors, whether the robot wasabout to roll over a dark tile on the floor. Insuch cases the robot has to back up and/or turnto avoid the obstacle for a brief time, afterwhich it resumes its bearing. In programmingefforts where the threads for the two behaviorsare well-balanced (that is, avoidance turns arekept short and forward motion on the requiredbearing is steadily maintained), students ob-serve the emergent behavior of a robot per-forming edge-following along dark tiles. Stu-dents implement this project first using local

RCXLisp and then remote RCXLisp to gain anunderstanding of the reaction times for teth-ered and untethered operation.

Robot OdometryThis two-week project’s goal is to help studentsunderstand the major factors that can intro-duce error into a robot’s internal representationof its current location in the world—an impor-tant issue in any navigation process. It also in-troduces them to the importance of maintain-ing a representation of state—in particular, therobot’s position.

Each team designs and builds a robot thatwill measure the perimeter of a convex blackshape on a light background on the floor. Theseshapes are printed on reusable laminated sheets(see figure 8). The reported measurement (over200 cm) should be accurate to within plus orminus 3 cm and should be obtained within 90

Articles

SPRING 2006 59

;;;;Example 1(tell-rcx (38 :port :LEGO-USB-TOWER :retries 3)

(SETF (var 4) 19))

;;;;Example 2(with-open-com-port (p :LEGO-USB-TOWER)

(with-open-rcx-stream (s p :rcx-unit 38 :retries 3)(using-rcx s

(SETF (var 4) 19))))

Figure 6. Remote RCXLisp Code Allowing a Desktop to Update the Contentsof Register 4 on RCX with Unit ID Number of 38.

3 Mindstorms Robotic Invention Systems packages3 Lego light sensors beyond the three in the Mindstorms Systems packages3 Lego touch sensors beyond the six in the Mindstorms Systems packages3 Lego motors beyond the six in the Mindstorms Systems packages2 Lego axle-rotation sensors1 Hitechnic magnetic compass sensor18 rechargeable batteries1 large lockable toolbox to hold all of the above as well as a partially completed robot (for an idea of size, see the box in the middle of the floor or the black box on the grid in figure 7).

Table 2. Equipment in a CSC 4500 Kit.

Page 10: Launching Into AI's October Sky with Robotics and Lisp

and Common Lisp search program to solve theeight-puzzle on a desktop. The team first tries asearch formulation that defines four opera-tors—”move up,” “move down,” “move left,”and “move right”—for each piece in the puzzle.They find that the formulation can lead to asearch algorithm with a branching factor of 32.The team then develops a set of four operatorsthat involve conceptually moving the “space”up, down, left, or right, rather than 32 opera-tors for moving each of the numbered tiles up,down, left, or right. The students observe thatthis design decision dramatically reduces thebranching factor of the search algorithm (4 ver-sus 32), leading to a faster execution time forthe game-solver.

In the second stage students write a remoteRCXLisp program for a Mindstorms roboticarm mechanism that moves pieces in an eight-puzzle according to the solution developed bystage 1’s programming. In this stage studentsfind that the search space reformulation trick

seconds. The project permits use of dead reck-oning (for example teams used one rotationsensor to measure the distance being traversedand a second one to estimate when the robot’sorientation had completed one rotationaround its body’s axis) and landmark-basednavigation (for example, some teams used asecond RCX as a beacon to tell the robot whenit had reached the point at which it had start-ed) techniques. Although all teams generallysucceed in this project, many find the time lim-it challenging in light of the accuracy con-straint.

Eight-puzzle SolverThis two-week project has the goal of showingstudents that data abstractions that facilitatesearch can produce solution representationsthat are not immediately translated into con-trol programs for hardware.

The project has two stages. In the first stagestudents develop a knowledge representation

Articles

60 AI MAGAZINE

Figure 7. Robotics Lab at Villanova.

Page 11: Launching Into AI's October Sky with Robotics and Lisp

ultimately costs them in the complexity oftheir second program as it spends time translat-ing the “move space up/down/left/right” oper-ator list to a list of “move tile at (2,2) to (2,1)”commands.

Search-Based Path PlanningIn this three-week project students design aCommon Lisp search program to solve the nav-igation problem of having a robot traverse afield of obstacles whose corners are defined bypoints in a plane while trying to minimize dis-tance traveled between its start point and itsgoal. Students then use remote RCXLisp to in-terface the search algorithm with a prebuilt ro-bot and have the robot follow the prescribedpath. This project has been used many times inAI courses with graphical simulations. Butwhen students see even the best-designed ro-bots incur too much location uncertainty usingsimple geometric dead reckoning, they gain abetter appreciation for the need to augmentplanning with sensor-based localization andnavigation techniques.

Decision-Tree ControlIn this project students run a prebuilt robotwith light sensors and touch bumpers on a ran-dom walk through a simple maze, recordingsensor readings when an obstacle is encoun-tered. Although the Mindstorms RCX has onlythree input ports, it is possible to multiplex upto three touch sensors or three light sensors ona single port. Thus a total of nine sensors can bearrayed on the robot. Students record the ro-bot’s correct action (move forward, turn left,turn right, or back up) for each situation (vec-tor of all sensors’ readings). They then developa decision tree that tries to capture the essentialsensor readings for guiding the robot throughthe maze. The decision tree is incorporated intoeither a remote RCXLisp program or a localRCXLisp program for evaluation and refine-ment.

Robotic Agent PlanningIn this individual independent-study project, astudent used a planner (Carver and Lesser 1993)to control a robot through remote RCXLisp.Some plan primitives were precompiled, andthese local RCXLisp programs were loaded intothe robot for execution as each primitive actioncompleted. Other plan primitives included re-mote RCXLisp queries about the current state ofthe robot. This project has considered “Wum-pus World” scenarios thus far, but could be for-malized for a more intricate environment toprovide students a chance to investigate bothreactive and incremental planning.

Capture-the-Balls ContestThis project serves as a capstone that ties to-gether skills students have developed throughthe course. It also generates an exciting finishto the semester. The contest is based on the pa-per by Beer, Chiel, and Drushel (1999), withsome adaptations to fit the RCX’s capabilities.Each student team designs and builds two ro-bots, each no larger than 1 cubic foot, to com-pete against other teams’ robots in a 20-minutecontest. Contestants play in a walled arena thathas ranged from 64 square feet to 160 squarefeet in area (depending on what classrooms areavailable each year). When large classrooms areavailable for the contest (that is, those that per-mit a playing field larger than 120 square feet),student teams are allowed to field teams ofthree robots.

Each robot team has a 1-square-foot dark-colored goal area. All other portions of theplaying field are light-colored. Black, white,and yellow Ping-Pong balls are scatteredthroughout the field. Robots gather balls andbring them back to their goal for points. Eachyellow ball in a team’s goal earns five points;white ones add one point; black balls subtracta point. A 1-foot-square grid of half-inch-thickblack tape lines the playing field. Figure 9shows one such contest layout. To aid in navi-gation, the walls’ corners have RCXs mountedto bathe the immediate area in IR signalsuniquely identifying the region. Robots are per-mitted to scatter or steal balls already in oppos-ing teams’ goal areas. They are also able to

Articles

SPRING 2006 61

Figure 8. Example Shape Sheets for the “Robot Odometry” Laboratory Project.

Page 12: Launching Into AI's October Sky with Robotics and Lisp

strategies over the years. Some have incorporat-ed time-dependent approaches. For example, asthe contest progresses, robots generally pushballs toward the walls of the field; some teamstherefore designed ball-scooping robots withsearch patterns whose coverage regions ex-panded probabilistically toward the wallswhenever too few “scoops” occur. Some teamshave tried with varying degrees of success tocombine elaborate planners on their controldesktop with very limited planners on boardtheir robots for recovering from breakdowns inremote-control IR communication that happenwhen robots’ RCXs lose line-of-sight contactwith the control desktop’s IR tower.

When three-robot teams were permitted (on-ly twice in the last five years), some studentteams have attempted to use distributed-agentapproaches whereby one of the robots is de-signed as an “information gatherer” that peri-odically traverses the playing field to findwhere concentrations of balls are located and

place balls in opposing teams’ goal areas. Ro-bots are permitted to block opposing robots’movements physically. However, robots are notallowed to “park” closer than one foot from agoal area, and robots are not permitted to usebehaviors that clearly would damage other ro-bots (for example, ramming or piercing). Com-petitions allow students to dangle IR towersover the playing field for remote-control ap-proaches.

Teams used both local and remote RCXLispin the project. Student teams are encouraged toexplore a variety of navigation techniques andplay strategies. Navigation strategies employedin past competitions have included landmark-based navigation using the grid lines, hill-climbing based on the strength of infrared bea-cons hung over a goal square, and, mostrecently, sonar-based particle filtering that usedthe playing field’s walls to aid in position esti-mation.

Student teams have developed many play

Articles

62 AI MAGAZINE

Figure 9. 2003 Capture-the-Balls Competition Setup.

Page 13: Launching Into AI's October Sky with Robotics and Lisp

reports this information over IR transmissionsto “ball gatherer” robots that react dynamicallyto the news.

Because of the public attention the contestdraws, students become invested in the compe-tition and try their best in designing their ro-bots and control code. However, there was atendency during the first three competitionsfor student teams to focus less on programminggeneral AI techniques into their contest entriesand to rely more on “contest engineering” ap-proaches limited to reflexive agent designs. Toreduce this tendency, since last year studentsare required to include in their final report a de-scription of how their design uses at least oneAI technique discussed in class or adapted fromInternet research.

Student Experience ReportsThe addition of robots with RCXLisp to CSC4500 has had several noticeable impacts on stu-dents’ quality of experience in the course.

Before 1999 the CSC 4500 course was offeredonce every two years, with enrollments rarelyreaching the level of 10 students. Since the in-troduction of robots, demand for the coursehas necessitated annual offerings, with enroll-ments typically over 15 students. The onlytime this level was not achieved was in a semes-ter when there were five electives scheduled(usually there are only four electives scheduled)and the course was scheduled as an eveningcourse—a time period avoided by most stu-dents. Under those circumstances, the total en-rollment was 8. Thus, one can argue that al-though a robotics element in AI courses isusually a strong interest generator, there aresome factors that it will not overcome! Fourcourse graduates have gone on to pursue grad-uate work in artificial intelligence areas (twoPh.D. candidates and two Master’s degree can-didates, one of whom is applying this year foradmission to doctoral work in AI) since the ro-botic element was added. While it can be de-bated whether those students would have goneon to graduate AI work even without exposureto robotics projects, it is interesting to note thatprior to the robot projects’ addition no coursegraduates had pursued graduate AI work.

The robotics component has definitelyadded to department camaraderie. The Capturethe Balls Contest has been widely publicized inthe department, and each year some coursegraduates attend the following year’s competi-tion to regale current participants with tri-umphs and tragedies from the past.

Although the RCX transceiver often picks upIR signals reflected from walls, students have

Articles

SPRING 2006 63

Figure 10. Synchro-Drive Chassis Design That Allows RCXsMounted on Top to Face the Same Direction at All Times While the

Lower Wheels Turn on Their Own Axes.

Page 14: Launching Into AI's October Sky with Robotics and Lisp

agent design as an organizing princi-ple for the study of intelligent arti-facts, the increasing availability oflow-cost robotics platforms, and thegrowing number of accessible robotsoftware libraries for undergraduatesare important trends in AI education.Each trend has had a significant posi-tive impact on student experience inVillanova’s CSC 4500 AI course be-cause of the adoption of RCXLisp.

The projects described in this articledemonstrate that students in the AIcourse have been able to use RCXLispprojects to explore the design of exam-ple agents from every one of the class-es described in Russell and Norvig’s in-telligent agent taxonomy (Russell andNorvig 2003), with the exception ofthe utility-based agent class. This ex-ception is due to the late coverage ofthe topic in the course. Our depart-ment has recently added a course onmachine learning. With the move-ment of that material from the AIcourse to the new course, we expect tobe able to start coverage of utility-based agents early enough in the AIcourse to permit work on utility-basedrobotic agents.

Combined with the low cost andadaptability of Mindstorms, RCXLispmade it possible to add robotics-in-spired projects to our AI course cost-ef-fectively, without having to distractstudents with many mechanical orcomputer engineering issues. Studentfeedback, enrollment levels, and grad-uates’ continued interest in AI overthe last four years of using RCXLispand Mindstorms in our course lendsupport to this claim. The RCXLisp li-brary’s integration with Common Lispenabled students to adapt Lisp AI soft-ware from the Internet and from Rus-sell and Norvig’s sample code corpusto robot applications with little diffi-culty.

RCXLisp was first developed to ad-dress needs of an AI course, but hassince been subsumed into a larger ini-tiative—Thinking Outside the (Desk-top) Box—to support the use of Mind-storms in combination with otherprogramming languages across the fullcomputer science curriculum (Klass-ner and Anderson 2003).8

Students’ imaginations are not theonly place where RCXLisp and Mind-

Since Common Lisp function declara-tions are themselves merely formattedlinked lists, students can generateplans as linked lists within a plannerand then download the same data tothe RCX as an immediately executableform.

Students have reported that debug-ging local RCXLisp programs involvesmore effort than debugging remoteRCXLisp programs within CommonLisp environments. They usually re-sort to adding commands to a remoteRCXLisp program to play musicaltones or to light up LEDs in order todebug program control flow problems.

Another recurring challenge stu-dents have noted is that the librarydoes not provide built-in support forsynchronized message passing eitherbetween threads on the RCX or be-tween RCX threads and desktopthreads. At the start of each course of-fering, computer science majors areencouraged to develop their ownmacros and functions for their teamfor these purposes so as to reinforcethe process synchronization skills theytypically learn in the second semesterof their sophomore year. There is noCommon Lisp standard for process co-ordination. Nevertheless, in an effortto make RCXLisp more useful in awider array of computing curricula,the next version of RCXLisp will in-clude simple ad hoc synchronous mes-sage-passing macros for local RCXLispthreads. However, construction of ageneral mechanism for synchronizingdesktop access to RCX registers on topof RCXLisp’s var function will requiregreater care. Any high-level synchro-nization constructs added to remoteRCXLisp should be expected to inter-face well with the threading con-structs in whichever Common Lispenvironments they are used.

Conclusions and Future Work

RCXLisp is the first open-source Com-mon Lisp library for Mindstorms thatsupports both remote control and on-board programming of robots as wellas targeted communication betweenmultiple robots and command-centerdesktops.

The growing role of intelligent

sometimes been frustrated in main-taining wireless control of a robotwhen it turns its transceiver awayfrom its control desktop PC’s IR tower.To mitigate this problem (and theproblem of having nonengineeringstudents spend too much time oncomplex chassis design) the coursesupplies teams with a prebuilt synchrodrive chassis based on the Lego Mind-storms Syncro Drive7 (see figure 10).This chassis design can keep an RCXmounted on it pointed in the same di-rection since the base does not turn asthe wheel casings below it turn. Thus,the chassis can keep its RCX unitsaimed at an IR communication toweras the robot maneuvers on the floor.

Regarding RCXLisp itself, severalcognitive science concentrators andengineers have commented on howthey felt they could get past coding de-tails faster in RCXLisp and CommonLisp than in Java because of those lan-guages’ lack of typing. The prominentuse of RCXLisp in our department’s AIcourse has had the effect of raising stu-dents’ interest in understanding howto program in Lisp in our department’sprogramming languages course.

Students have also commented onthe immediacy of working with RCXsusing the Common Lisp Listener: sim-ply by invoking a function in the Lis-tener, an RCX can be made torespond. This is definitely an exampleof satisfaction with being able to getpast the “hello robot” stage of pro-gramming quickly.

The library’s integration with low-level system functions such as infraredUSB communication helps studentsget past the uninteresting details ofport communication and instead con-centrate on the AI-oriented problemsof environmental noise, sensor sensi-tivity, and environmental nondeter-minism. For most students, the libraryand the robot projects gave them theirfirst experience with coordinating re-sponses to real-time data sources (sen-sors) whose values could change “evenwhen the program isn’t watching,” asone student put it.

The library’s support for “on-the-fly” program generation and down-load helps students appreciate thepower of Common Lisp’s lack of differ-entiation between code and data.

Articles

64 AI MAGAZINE

Page 15: Launching Into AI's October Sky with Robotics and Lisp

storms have had an October sky effect.RCXLisp’s design team continues tomake improvements to the package.In addition to the future work de-scribed in the previous section, an im-portant goal is to add call stack sup-port and memory managementsupport to the Mnet firmware. Thiswould extend the Lisp functionality ofthe on-board language for RCXs. A re-lated possibility would be to eliminatefirmware and target the H8 processordirectly, as the C++ BrickOS library forMindstorms does.

Another future project is to inte-grate the Lego vision command cam-era into the RCXLisp library. Thiswould provide a low-cost tool for ex-ploring machine vision problems. Itwould also provide an additional datachannel for student teams to use inthe capture the balls contest in coordi-nating robots’ coverage of playingfield areas.

The RCXLisp library already hasgeneric serial API functions, making ita useful basis for Common Lisp solu-tions for interfacing with serial de-vices. However the library’s USB inter-face functions currently only workspecifically with Mindstorms USB IRtowers. Work is underway to extendCommon Lisp streams to supportgeneric USB devices so that not onlythe vision command camera but alsoother USB-based sensors and devicescan be used in RCXLisp (Jacobs, Jor-gage, and Klassner 2005).

In January, 2006, Lego announced anew version of Mindstorms, NXT.Based on released information aboutthe new platform, I expect thatRCXLisp will be portable to NXT.

AcknowledgmentsI am grateful to Andrew Chang for hisgraduate independent study work thatdeveloped the Mnet firmware, mygraduate students Drew Jacobs and Er-ic Clark for their work in the design ofreliable USB communication librariesfor RCXLisp, and my undergraduateresearch assistant Christopher Conti-nanza for his work in the design of ro-bust Lego chassis for the AI course pro-jects. I also thank the reviewers andeditors for comments that improvedthis article.

Lego Mindstorms and RCX are

trademarks of the Lego Group, whichdoes not sponsor, authorize, endorse,or support any of the third-party workcited in this article. The author has nofinancial relationship with the LegoGroup except for a discount purchaseplan for Mindstorms equipment fortraining seminars run under NSFGrant No. 0306096.

This material is based upon worksupported by the National ScienceFoundation under Grant No. 0088884and Grant No. 0306096. Any opin-ions, findings, and conclusions or rec-ommendations expressed in this ma-terial are those of the author and donot necessarily reflect the views of theNational Science Foundation.

Notes1. Such as ActivMedia Robotics (www.ac-tivrobots.com) and Lego Mindstorms,www.legoMindstorms.com/. See also F.Martin, The MIT HandyBoard Project, De-cember 2005, http://lcs.www.media.mit.edu/groups/el/Projects/handy-board.

2. See www.noga.de/legOS; lejos.sourceforge.com; Not Quite C (NQC), bricxcc.source-forge.net/nqc; and the LEGO/ Scheme com-piler, Oct. 2005 (www.indiana.edu/~legob-ots/legoscheme/), by A. Wick, K. Klipsch,and M. Wagner.

3. See lejos.sourceforge.com.

4. See www.indiana.edu/~legobots/legoscheme/.

5. www.hitechnic.com.

6. www.techno-stuff.com.

7. See www.visi.com/~dc/synchro.

8. Installation files for RCXLisp and hand-outs for the assignments described in thisarticle are available for download from theweb site for this project at robotics.csc.vil-lanova.edu.

ReferencesBeer, R. D., Chiel, H. J., and Drushel, R. F.1999. Using Autonomous Robotics toTeach Science and Engineering. Communi-cations of the ACM 42(6)(June): 85–92.

Brooks, R. A. L. 1993. A Subset of CommonLisp. Technical Report, Massachusetts Insti-tute of Technology Artificial IntelligenceLaboratory, Cambridge, MA.

Carver, N., and Lesser, V. 1993. A Plannerfor the Control of Problem Solving Sys-tems. IEEE Transactions on Systems, Man,and Cybernetics, Special Issue on Planning,Scheduling, and Control 23(6): 1519–1536.

Cohen, P. 1995. Empirical Methods for Arti-ficial Intelligence. Cambridge, MA: The MITPress.

Jacobs, D.; Jorgage, B.; and Klassner, F.2005. A Common Lisp USB Communica-tion Library. Paper presented at the 2005International Lisp Conference, Stanford,CA, June 19–22.

Klassner, F., and Anderson, S. 2003. LegoMindstorms: Not Just for K–12 Anymore.IEEE Transactions on Robotics and Automa-tion Magazine 19(3): 12–18.

Klassner, F. 2002. A Case Study of LegoMindstorms’™ Suitability for Artificial In-telligence and Robotics Courses at the Col-lege Level. In Proceedings of the Thirty-ThirdSpecial Interest Group on Computer ScienceEducation Technical Symposium on ComputerScience Education, 8–12. New York: Associa-tion for Computing Machinery.

Kumar, D., and Meeden, L. 1998. A RobotLaboratory for Teaching Artificial Intelli-gence. In Proceedings of the Twenty-NinthSpecial Interest Group on Computer ScienceEducation Technical Symposium on ComputerScience Education. New York: Association forComputing Machinery.

Mazur, N., and Kuhrt, M. 1997. TeachingProgramming Concepts Using a Robot Sim-ulation. Journal of Computing in Small Col-leges 12(5): 4–11.

Russell, S., and Norvig, P. 2003. Artificial In-telligence: A Modern Approach, 2nd ed. En-glewood Cliffs, NJ: Prentice Hall.

Steele, G. 1990. Common Lisp: The Lan-guage, 2nd ed. Woburn, MA: Digital Press.

Stein, L. 1996. Interactive Programming:Revolutionizing Introductory ComputerScience. ACM Computing Surveys28(4es)(December): 103.

Yuasa, T. 2003. XS: Lisp on Lego Mind-storms. Paper presented at the 2003 Inter-national Lisp Conference, New York, Octo-ber 12–15.

Frank Klassner earnedB.S. degrees in computerscience and in electron-ics engineering from theUniversity of Scranton.He earned his M.S. andPh.D. in computer sci-ence from the Universityof Massachusetts at

Amherst. He is an associate professor in Vil-lanova University’s Department of Com-puting Sciences. In addition to AI and ro-botics, his interests include adaptive signalprocessing and Lisp modernization for thetwenty-first century. He can be reached [email protected].

Articles

SPRING 2006 65

Page 16: Launching Into AI's October Sky with Robotics and Lisp

Articles

66 AI MAGAZINE

We invite you to participate in theFifteenth Annual AAAIMobile Robot Competition and Exhibition

Sponsored by the American Association for Artificial Intelligence, the Competition brings together teamsfrom universities, colleges, and researchlaboratories to compete and todemonstrate cutting edge, state of the art research in robotics and artificial intelligence.

The 2006 AAAI Mobile Robot Competitionand Exhibition will be held in Boston,Massachusetts, as part of AAAI-06, from July 16–20, 2006.

The program will include the Robot Challenge, the Open Interaction Task, the Scavenger Hunt, the Robot Exhibition, and the Mobile Robot Workshop.

Registration and information is availableat palantir.swarthmore.edu/aaai06/.

AAAI-06 conference details:www.aaai.org/Conferences/AAAI/aaai06.php