CREATING AN UPPER-LEVEL UNDERGRADUATE ROBOTICS ELECTIVE IN COMPUTER SCIENCE Kevin Workman and Stephanie Elzer Millersville University {kaworkman,elzer }@cs.millersville.edu Abstract Robotics as an upper-level undergraduate computer science class has a lot of potential, since it allows students to apply their skills in a new and novel domain, and since many students find it motivating to obtain the immediate, concrete feedback of seeing their program control a robot. Because of both cost concerns and the practical constraints of the available robotic platforms, the traditional approach to teaching a robotics class has been to select a single platform and write code using an API specific to that platform. However, as the price of various robotic platforms decreases, and the selection increases, it is becoming feasible for universities to purchase a variety of robots. Microsoft Robotics Studio provides a useful way to utilize multiple robotic platforms in one class without wasting time on learning multiple platformspecific APIs. This paper documents our experience utilizing Microsoft Robotics Studio, along with Legos NXTs and iRobot Creates, in an upper-level undergraduate robotics elective. way for students to apply programming techniques they learned in previous classes. An upper level robotics course provides a valuable combination of applying students’ knowledge and exposing them to an exciting emerging technology. The Traditional Approach to Teaching Robotics The robotics industry includes many diverse robotics platforms with a wide assortment of functions, domains, and abilities. This diversity actually complicates teaching a robotics course. The robotics field is full of options, but an undergraduate class does not have the time or resources to cover them all. Instead, most modern robotic classes concentrate on one platform, and students in the class work with only one robot throughout the entire class. This approach eliminates the time spent learning multiple platform-specific APIs but greatly limits the ability to introduce different robotic ideas and paradigms to the class. Introduction Microsoft Robotics Studio In January 2007, Microsoft released Robotics Studio, a developing environment geared towards the control of various robotics platforms. Bill Gates stated in his article “A Robot in Every Home” that robotics will impact the next 30 years in the same way that personal computing impacted the last 30 years. [1] One of the jobs of an undergraduate computer science department is to introduce its students to up and coming technologies. During the fall semester of 2007, Millersville University offered robotics as an upper level computer science elective for the first time in ten years. Because the course had experienced such a long hiatus from the schedule, it was completely revamped, from the robotics platforms being utilized to the software used to control those robots. After evaluating the developments that had occurred in robotics education over the last decade, the decision was made to utilize the newly available Microsoft Robotics Studio, along with Lego NXTs, and iRobot Creates to complete various goals in a lab environment. Not only did the robotics course offer undergraduate students the opportunity to gain exposure to the potential within the robotics field, but Microsoft Robotics Studio provided a In developing the course, we chose to utilize Microsoft Robotics Studio because of its ability to control multiple robotic platforms using the same interface. By exposing the students to different kinds of robots, the class more effectively introduced theories and examples that would have otherwise been difficult to illustrate. Eliminating the need to learn a new syntax for each platform allowed the students to instead focus on the more important underlying semantics of robotics design and implementation. It also provided a concrete example of the benefits of abstraction and object-oriented design of software. To briefly describe Microsoft Robotics Studio, some terms must be defined. Almost every action is performed by a service, which controls a specific software or hardware entity. The services interact with each other much like threads. The Concurrency and Coordination Runtime, or CCR, oversees the execution of each service and the interaction between them. The Decentralized Software Service, or DSS, organizes, creates, and manipulates the services. The DSS also handles higher- level creation of projects, which conveniently creates a shell of a new service that a user can use, append, and link to other services to produce complex functionality. A manifest file provides the link between the software and the hardware and can easily be replaced to link to different hardware platforms. [3] For example, a user can program commands for a basic drive behavior, then replace the manifest file in the project with any manifest file from a robot with a drive system. The service automatically converts the higher level commands to low level instructions exclusive to each robot. This is a main selling point of Robotics Studio: the ability to quickly switch which robot the code controls without changing the code itself. In addition to these features, Robotics Studio also includes a powerful simulation runtime. In the simulation environment, users can recreate any number of complicated scenes including classrooms, labs, mazes, real world environments, etc. Then any robot compatible with Robotics Studio can be placed in the scene and interact with the environment. A physics engine accurately handles all collision, gravity, and other realistic force calculations so objects react in real time the way they would in the outside world. Users can even create new robots and items based on components of preexisting models. The simulation environment makes it possible to introduce students to robotic platforms with prohibitively high cost or size and environments too complicated or dangerous to realistically model in real life. Our Approach We approached robotics with a focus on artificial intelligence techniques and intelligent robots. Basing the lecture material on An Introduction to AI Robotics by Robin Murphy, we focused on the various robotic paradigms (hierarchical, reactive and hybrid deliberative/reactive) and the design process involved in building intelligent robots [2]. In the class, sound software design shared the same importance as logical hardware choice. Examples of real life robots actually used in the field supplemented theory, and the lab assignments gave the students a chance to apply the concepts which they had learned. Robotics Studio users can program in any .NET language, and the class used C# because of the students’ familiarity with C-based languages. By choosing a language that resembled other languages the students have used, the students’ learning curve was greatly reduced. After using some simple instructions to send cursory commands to the robots, the students quickly delved into the more powerful options offered by C# that they might have not seen in other classes. Laboratory Exercises The laboratory section of the class consisted of six assignments, and the students had several weeks to complete each before starting the next one. Students worked in pairs of their choosing because of the limited number of robots available. Each group shared one Lego NXT robot and one X10 camera, and the class shared three Lego extension kits, two iRobot Creates, and one Pioneer P3-DX. The laboratory assignments paired closely with lessons taught in lecture, and allowed the students to apply their knowledge in a very concrete manner. They could actually see the fruits of their labors, which turned out to be extremely rewarding at times and extremely frustrating at others. Lab 1: Introduction to Microsoft Robotics Studio and Lego NXT The first assignment instructed the students to work through the first three basic tutorials for Microsoft Robotics Studio, available from the Microsoft Developers Network website. The first tutorial introduces the students to the idea of services, a main component of Robotics Studio. A service is an object oriented entity that controls a specific piece of hardware or software, and by combining multiple services, a user can program complex behaviors. The second tutorial focuses on how to combine services. At the end of the second tutorial, students could switch on and off a motor output through a push button input. With this knowledge and a bit of creativity, they could easily add another button, and increase or decrease the motor speed depending on which button was pressed. The third tutorial adds more functionality to this. Using the same types of services from tutorial two, tutorial three builds a simple robot with two wheels and two bumpers. The robot travels forward until a bumper comes into contact with an obstacle, at which point the robot rotates a certain number of degrees depending upon which bumper was pressed and repeats the process. An important note is that even at this early stage, Microsoft Robotics Studio allowed the students to quickly swap robots. The same code that worked for a Lego NXT works for an iRobot Create with just a few minor changes, covered later in this paper. By the end of the third tutorial, students had a working understanding of Robotics Studio. This lab was one of the more straightforward assignments. Students simply had to follow the online directions to learn the basics of Robotics Studio. The students reused topics learned in lab one in every single other lab. Creating a project, accessing a service, and linking to other services all continued to be crucial skills throughout the class. The only downside to these tutorials was the amount of time required for completion. It took a surprisingly long time for students to work through the exercises. The initial hardware configuration took longer than expected, which increased the time frame of the entire lab. The lab assignment initially included the fourth tutorial, but due to time restraints, the fourth tutorial turned into a separate lab assignment. Lab 2: Teleoperation The second lab assignment, based on robotics tutorial four, applied the knowledge learned in the first lab. To further demonstrate the topic of teleoperation, which was covered in the lecture, the second lab called for the students to build a robot using Lego NXT kits and a GUI to control the robot remotely. The students then attached cameras to their robots and navigated an obstacle course using only the GUI they created and a live camera feed. Like most teleoperation situations, the students could not actually see the robot or the course, only the image sent back by the camera. Students quickly learned the importance of the topics covered in lecture as their robots crashed into walls and tripped over obstacles. students’ grades. The obstacle course served as a fun motivator, but it may be worth considering awarding some extra credit to the students whose robots performed the best Lab 3: Wander Behavior and Floor Covering The third lab supplemented another topic covered in lecture: wander behaviors. After covering different approaches to designing wandering behavior in robots in the lectures, the students had the opportunity to design and implement their own algorithms. They used an iRobot Create and attempted to design an effective floor covering algorithm, either by themselves or based on existing theories. The techniques with which the students approached the problem varied from straightforward applications to complicated algorithms based on existing theories. This lab introduced the iRobot Create. Without Robotics Studio, the students would have had to waste precious lab time learning the syntax for the new domain, but our students were able to jump right into the real action. The students applied their experience with the Lego NXT to the iRobot Create and used the same kind of commands to operate the robot. Even though the iRobot Create includes several sensors not available through Lego NXT, students accessed the new readings very similarly to how they accessed Lego NXT readings. Robotics Studio simplified the transition from one robot to another, and the students wasted little time adjusting. Figure 1: Students observing a robot navigating the obstacle course in Lab 2 This lab relied heavily on the techniques learned in the first lab. The first lab consisted of a few simple examples, and the second lab collected those examples into a useful application. The fun and competitive nature of the obstacle course drove the students to improve their robotic designs and GUI to outdo their peers, which lead to some interesting and unexpected improvements above and beyond what the lab requested. In this first iteration, the robots’ performance in the obstacle course did not actually count towards the Figure 2: iRobot Create and various hardware components After they had an acceptable floor covering algorithm worked out on the iRobot Create, they had to modify it to avoid obstacles as well using a Lego sonar service. Switching back to the Lego NXT robots to solve a similar problem showed the similarities and differences between the robots. Students saw in practice a lesson taught in lecture: different types of sensor suites can solve the same problem. There is no “right answer” as long as the robot effectively handles the situation. The wander behavior and floor covering lab fit in well with the lecture lessons. The iRobot Creates showed a real-life application of floor covering since the success of the iRobot Roomba vacuum product line relies heavily upon floor covering and wander behaviors. The students also saw that a simple approach is sometimes better than an overly complicated plan as some simpler algorithms outperformed more complex programs. Lab 4: The Reactive Paradigm: Modeling Biological Behaviors Lab Four gave the students quite a bit of freedom in applying topics from lecture in lab. The lab gave the students the goal of modeling biological behaviors seen in nature, specifically collecting food and avoiding predators. The students decided how to accomplish those goals, what kind of gathering system to use, whether to use wheels or legs, how to react to predators, etc. The robots utilized a camera, and by using a Robotics Studio service for an image processing software product called RoboRealm [4], the students programmed the ability to tell the difference between food and predators based on color. already extensive Lego NXT kits each group shared. The robots came in many forms. The methods of collecting the food, in this case blue colored plastic balls, varied greatly from robot to robot. One robot used four legs instead of two wheels, a first for this class. The robots also reacted differently to predators, in this instance red colored plastic balls. Some robots ran directly away, while others flanked the danger. The variations in the robots mirrored variations in behavior in the natural world. Students first learned how existing roboticists model their robots after animals found in nature and then designed their own robots themselves. Again, it is difficult to quantify creativity, but generally the students who worked the hardest received the best grades. Lab 5: Line Following Lab Five handled a common educational robotics problem: line following. The students modified the functionality of built-in cliff sensors in iRobot Creates to detect lines instead of cliffs, and created programs to make the iRobots follow a path marked by lines. Students also used a camera attached to a Lego NXT robot and used RoboRealm with Robotics Studio to follow a line based upon camera input as well. This lab demonstrated the versatility of the iRobot Create platform. The cliff sensors are actually designed to detect sudden drop offs, preventing the robots from falling down stairs or off desks. However, by delving into the lower levels of the programming, the cliff sensors can be modified to detect the reflectivity of the surface beneath them, perfect for line detection. Lab 6: Object Counting Figure 3: A Lego robot designed to throw balls at a target The students were limited only by their creativity and the amount of Lego pieces they had at their disposal. The Lego extension kits solved the latter, supplementing the The sixth and final lab assignment gave the students the goal of counting objects using any of the ideas introduced in the other labs. The point of this lab was to show that the students could easily adapt previously learned topics to tackle new problems. Almost every group used a Lego NXT robot with sonar to drive by objects and count them based upon their sonar readings. The antithesis of the first lab, this lab took a surprisingly short amount of time to complete. After all the problems the students solved, this one seemed easy by comparison. The fact that the students completed this lab in a short amount of time proved the effectiveness of the other labs. Final Project In addition to the labs, the students also had the option of writing a research paper or tackling a larger-scale robotics project of their choosing. A surprising number of students chose to write a paper, but the robots the students did build were very interesting. Two students created ball launchers that automatically tracked their targets using cameras and the RoboRealm service. One student created a robot that draws pictures and attempted to have the drawings based on camera input. Another student created a robot that, when given a can, found a recycling bin and recycled the can. The final project gave the students enough freedom to explore any aspect of robotics in which they had an interest but that may not have been covered in class. learned how professional roboticists used certain theories to develop robots for specific applications and applied the same principles to the problems given to them in the assignments the very next lab meeting. The labs also shared a difficulty in terms of evaluation. How does an educator quantify creativity? Students who worked the hardest on their robots should be rewarded. However, if they worked very hard on an idea that didn’t quite translate to a successfully functioning robot, it can be difficult to appropriately assess their effort. This problem occurs in other domains (such as complex programming projects) as well, but it seems to be more acute within the robotics realm, where the problem could actually be in the hardware (inaccurate sensors, etc.) Experimentation and trial and error are important components of the creative process in the sciences. On the other hand, an important aim in any computer science project is to end up with a working product. So, the question becomes how one can motivate students if their grade is not solely based on performance but avoid punishing students who developed a great theory that unraveled in practice. Implementation Suggestions Figure 4: Recycling Robot built on iCreate base A final project helps bring together the concepts introduced earlier in the class and allows the students to explore their own interests within the subject. The students can demonstrate their knowledge more completely by applying what they’ve learned to an encompassing problem than separating each subject into individual lab assignments. While a paper also allows this, to some degree, we found that the projects were more challenging, and to a large degree, more rewarding to the students who undertook the challenge. Pros and Cons of the Setup of the Class All of the laboratory assignments shared common strengths and weaknesses. Each assignment paired very successfully with the topics covered in lecture. Students Microsoft Robotics Studio provided a great link between the language syntax already known to students and unfamiliar robotics semantics. We highly recommend using it as a main focus in the laboratory section of the course. It has an increasing amount of third party support, which gives users many robotics and software platforms as compatible options. RoboRealm is an example of one such software platform. The program focuses on machine vision. By using the service the company released, Robotics Studio can interact with RoboRealm to give robots advanced vision capabilities. Neither Robotics Studio nor RoboRealm cost anything for education purposes. To help motivate the students to design creative robots instead of robots that simply fulfill the requirements of the lab, we suggest having a grading system based on design as well as performance. As seen in the second lab, friendly competition between students drove them to work harder on designing creative robots. Basing the students’ grade on both performance and design enables the instructor to reward hard working students without punishing students whose theories simply did not work out. Because grading the assignments is not just a matter of running the code, but also of connecting to particular robots and testing the code, we suggest having the student demonstrate the functionality of the code for the instructor of the class. We also found it helpful to have the students include a written description of their algorithms and thought processes regarding the development of their labs. Future Work We are currently researching the usefulness of yet another robotic platform called Lynxmotion. The company has released the support files necessary to make their robots work with Microsoft Robotics Studio, and controlling them is just a matter of finding out what exactly each command does. Robotics Studio may not fully support all of the capabilities of a robotic family like Lynxmotion right out of the box, but users can add functionality to Robotics Studio, expand the platform, and create services for anything not yet included. For example, our Pioneer P3DX is equipped with a sonar suite that Robotics Studio does not yet support. However, the Pioneer software includes low level signal handlers, and we created a new Pioneer sonar service by feeding the signals into a higher level generic sonar service. Now we can interact with the sonar on the Pioneer through Robotics Studio even though Robotics Studio did not originally include this ability. Similarly, we can add any missing functionality to new robots by routing low level signals through high level handlers, which provides new opportunities for independent studies outside of the classroom. Conclusion We see an exciting future in this class. Although iterative improvements are always possible (particularly after major curriculum development), we were quite satisfied with the new software and hardware being utilized in the course. The increasing availability of various robotic platforms provides students with more room to express their programming creativity, and Microsoft Robotics Studio allows increased experimentation with different hardware. Although we might have to develop our own functionality for some robots, this can take the shape of new independent studies. In fact, robotics offers many opportunities for undergraduate student research projects. Thus offering robotics improves the major by not only increasing class options but also by opening up educational opportunities outside the classroom. About the Authors The work described in this paper was funded by a PASSHE Professional Development Grant awarded to Dr. Stephanie Elzer. The grant allowed Kevin Workman, a senior at Millersville University, to work fulltime on this project, under Dr. Elzer's supervision, during the summer of 2007. The Robotics course was offered during the Fall 2007 semester. The work has continued as an independent study project on incorporating Lynxmotion robots into Microsoft Robotics Studio during Spring 2008. References [1] Bill Gates, A Robot in Every Home. American Magazine, January 2007 Issue. Scientific [2] Robin Murphy, Introduction to ai robotics (Cambridge, Massachusetts: The MIT Press, 2000). [3] Microsoft Robotics Studio. MSDN. http://msdn2.microsoft.com/en-us/robotics/default.aspx [14 February 2008] [4] Free Robotic Machine Vision Software. RoboRealm. http://www.roborealm.com/ [14 February 2008]