By Univ.-Prof. Dr.-Ing. Til Aach, RWTH Aachen University and Univ.-Prof. Dr.-Ing. Alexander Behrens, RWTH Aachen University
In a lab that we call "MATLAB® meets LEGO Mindstorms," more than 300 first-year students at RWTH Aachen University build and program their own robots. One student team’s robot can translate a brief message into Morse code. Another can locate a bottle on a table and determine how full it is. Other robots park themselves autonomously or target and scan three-dimensional objects.
The lab work is the culmination of “Mathematical Methods of Electrical Engineering,” a new, required course for freshmen that is the first step in the University’s transition from a Diploma degree program to a Bachelor’s and Master’s degree program. This shift was driven by the Bologna Process, an initiative designed to bring consistency to degree programs across the European Union.
The course links mathematics taught in the first term with digital signal processing (DSP) applications. It focuses on discrete signals and system theory, covering topics including signal sampling, LSI systems, Fourier transforms, vector spaces, and matrix operations. In addition to a two-hour introduction to MATLAB, students receive MATLAB example code and examples, and links to other mathematics courses that focus on linear algebra. After two months, the associated lab brings all the material together as the students build their robots (Figure 1).
We designed the course to enable the students not only to learn math and signal processing theory but also to apply it by implementing MATLAB algorithms in machines that move, that actually do something. We chose MATLAB as a basis for the course because with MATLAB, taking an algorithm developed on a white board to a working implementation is straightforward. Many of the class lectures require matrix and vector operations, which we can map directly to MATLAB algorithms. MATLAB is a natural environment for these kinds of operations, providing students with an easy way to learn mathematical methods using real applications.
In addition, MATLAB is used in many departments throughout RWTH Aachen University for research, development, prototyping, and more. Introducing freshmen to MATLAB early gives them a foundation for their entire university careers and beyond.
We knew that in completing the lab projects, students would also be developing the soft skills required in engineering, such as the ability to present their results, work around hardware limitations, and collaborate in teams.
Students construct their robots using components from the LEGO MINDSTORMS NXT education kit (Figure 2). Each kit contains sensors (for touch, sound, light, and ultrasonic distance measurement), motors, a programmable microcontroller, and static building blocks.
The LEGO MINDSTORMS NXT kits are designed to let students develop control programs offline and download them to the embedded microcontroller. We decided to take a different approach and have the students design and develop their control algorithms in MATLAB and run them on a PC. In addition to MATLAB, the students have access to Image Processing Toolbox™, Optimization Toolbox™, and Signal Processing Toolbox™.
This approach offers several advantages. First, MATLAB is used in courses at every level at RWTH Aachen University, and we wanted to prepare the students for their future work. Second, running the control algorithms on a host computer provides more memory and other resources, enabling the students to develop more complex and sophisticated robots. Third, by working in MATLAB, students interact with the algorithms during development and visualize their systems using plots and graphs. Finally, because RWTH Aachen University maintains a Total Academic Headcount license, students can access MathWorks products on their PCs, enabling them to work independently outside the lab whenever they want to.
To enable a MATLAB program running on a PC to read the robot’s sensors and control its motors, we developed the RWTH –Mindstorms NXT Toolbox. This downloadable, open-source toolbox uses the MATLAB serial I/O capability to communicate with LEGO MINDSTORMS NXT via a wireless Bluetooth connection.
Using the RWTH-Mindstorms NXT Toolbox, students execute high-level commands in MATLAB to interact with sensors and motors. For example the following commands read the ultrasonic sensor to determine its distance (in centimeters) from an object:
distance = GetUltrasonic...
Using the framework provided by the toolbox, students can implement an autonomous robot in three basic steps:
This approach eliminates the time-consuming and often complex work needed to compile an application and download it to the embedded processor.
When they begin the class, few students have any programming experience, and still fewer are familiar with MATLAB. Because of the tight time frame, teaching the students enough Java™ or C++ to enable them to complete the project would be very difficult. MATLAB is much easier to teach and learn because of its intuitive support for matrix and vector operations. MATLAB provides built-in functions that the students need, such as filter operations, giving them plenty of time to grasp the programming concepts and apply them effectively.
The students have just eight days to complete the lab assignments. In the first five days, they work in pairs on tasks designed to familiarize them with LEGO MINDSTORMS NXT capabilities. Each pair uses MATLAB to access the Bluetooth interface, read and process sensor data, activate the motors, create graphical user interfaces (GUIs), and apply simple programming structures, such as functions, loops, and conditional branches. In the final exercise, they build an explorer robot that uses the ultrasonic sensor to scan the local environment, process the data with simple filter operations, detect signal edges, plot a 360-degree distance profile, and autonomously drive through an opening in its enclosure.
In the remaining three days, groups of four students complete their final projects. Each group can either develop a proposal of their own or select one of three pre-approved projects: a robot that maps and exits a maze, a robot arm that picks up and sorts colored balls, or a robot arm that scans images.
In addition to constructing the robot, the students use MATLAB to apply concepts learned in class, including data processing, programming and algorithm development, data visualization, and GUI construction (Figure 3).
For example, groups that choose to implement the image-scanning robot must develop algorithms that traverse the image, convert polar and Cartesian coordinates, process light sensor data, and interpolate it to produce a scanned image. Some students apply advanced 3-D data visualization, such as mesh and surface plats generated by an environmental scanner targeting 3-D objects (Figure 4).
On the final day of the lab, each group presents its work to the class. In these 15- minute presentations, demonstrations of numerous creative applications are followed by honest discussions of the lessons learned.
Freshmen engineers often complain that course material is too difficult to learn or too theoretical, but their evaluations of this course have been quite different. Almost 90 percent of the students rated their MATLAB programming skills as excellent or good after taking the course. Almost all said that they would participate in the lab again, and 87 percent rated their motivation as excellent or good. When asked to identify positive aspects of the lab, students cited several benefits, including the opportunity to confront problems not mentioned in lecture, the ability to link theoretical foundations to practical problems, and the practical application of concepts with MATLAB.
This high level of motivation is reflected in the number of extra hours the students devoted to their projects. We knew we had achieved our objectives when students demanded that we set up a workshop so that they could continue working with the robots in their free time.
Some of the students are helping us improve the RWTH–Mindstorms NXT Toolbox. In future classes, the toolbox will include support for a USB connection, providing a more responsive communications link between MATLAB and the robots.
Now that the RWTH–Mindstorms NXT Toolbox has been released as an open-source product, we hope that more universities will adopt this approach. One student in the U.K. has already used it in her Bachelor’s thesis. The School of Information Technology and Engineering at the University of Ottawa, Canada, uses it in a control systems course. Closer to home, the Industrial Engineering department at RWTH Aachen University is considering integrating the lab into their curriculum.
Published 2008 - 91583v00