Teaching Fundamentals of Robotics to Computer Scientists NOURDINE ALIANE Universidad Europea de Madrid, Villaviciosa de Odo´n, s/n (28670) Madrid, Spain Received 11 October 2008; accepted 2 February 2009 ABSTRACT: This article presents a methodology to reinforce the teaching of fundamentals of robotics to computer scientists. The pedagogical basis is focused on engaging students in an in-depth study of the subject using computing in a substantive way. The approach consists in complementing the lectures by programming assignments focused on giving students a deeper understanding of how robotic systems work from the inside. This article presents the author’s experience in the use of this approach, as well as a set of proposed assignment projects. ß 2009 Wiley Periodicals, Inc. Comput Appl Eng Educ 19: 615620, 2011; View this article online at wileyonlinelibrary.com/journal/cae; DOI 10.1002/cae.20342 Keywords: fundamentals of robotics; teaching/learning through programming; Matlab
INTRODUCTION As a multidisciplinary subject, robotics encompasses a diversity of topics ranging from mathematics and physics, to mechanics, automatic control, electronics, and computer sciences. An adequate profile of a robotics course depends on the curricula to which it belongs [1], the most frequent being mechanical engineering, electrical engineering, and computer engineering, among others. Robotics is also recognized as an excellent vehicle for involving students in science and engineering, and is used in a variety of ways and for a multitude of purposes. Within the wide scope and use of robotics in education, the present article deals with the teaching of fundamentals of robotics to computer scientists. The traditional method for teaching fundamentals of robotics courses includes lectures and problem-solving sessions, where the theoretical framework is complemented by the use of some simulators such as the Robotics Toolbox for Matlab [2,3], or hands-on laboratory robotic systems [4,5]. The syllabus outline for introducing fundamentals of robotics is well presented through existing textbooks, such as the texts written by Craig [6], Spong et al. [7], or Sciavicco and Siciliano [8], to cite a few. These texts have been written from a mechanical and electrical engineering perspective. Computer scientists interested in learning fundamentals of robotics are faced with the problem that existing bibliography contain a lot of mathematics, and provide little intuition. Textbook [6], however, is somewhat different, since it emphasizes many computational aspects, and its third edition includes exercises and programming assignments oriented towards the use of the Robotics Matlab
Correspondence to N. Aliane (
[email protected]). ß 2009 Wiley Periodicals Inc.
Toolbox [2,3], which makes it an appropriate reference for computer scientists. It is easy to realize, while glancing at any book on fundamentals of robotics, that many of the basic concepts, such as spatial localization, kinematics, dynamics, or trajectories planning, are formulated as mathematical problems. In fact, several topics require a mathematical background beyond the undergraduate level and various central concepts, such as homogenous transforms or cubic-spline interpolation, to cite only two examples, are presented to students for the first time in the robotics course. Many students are then surprised to discover that robotics involves so much mathematical machinery. The preponderating amount of mathematics in robotics is neither well received, nor perceived as important by the students. Many robotics topics should not be presented to computer scientists in the same way they are presented to mechanical or electrical engineering groups. The main challenge then, for the robotics instructor, is teaching the material and making sure that the lectures do not become pure mathematical dissertations. Fundamentals of robotics can be confusing due to the mathematical machinery involved, rather than the complexity of the material. From a computer science perspective, robotics is an authentic context for computing. Thus, to give computer science students the opportunity to acquire the knowledge embodied in the course, the pedagogical basis is focused on engaging them in an in-depth study of the subject, using computing in a substantive way. The approach consists in complementing the traditional lectures by programming assignments focused on giving students a deeper understanding of how robotic systems work from the inside. The programming assignments, undertaken as small software projects, are exploited to alleviate the mathematical core and promote interest in robotics among students. The remainder of the article is organized as follows. The second section describes the motivation of the approach and gives key considerations in the pedagogy. The third section presents
615
616
ALIANE
some of the proposed homework assignments. The fourth section discusses pedagogical issues offering some thoughts on the approach, as well as presenting the students’ feedback. Finally, conclusions are reported in the last section.
KEY CONSIDERATIONS IN PEDAGOGY Robotics is a prolific field for interactions between mathematics and computer science, and such interactions should be discovered in a natural way. To do so, key considerations in pedagogy consists in focusing classroom activities on programming assignments, and exploiting computer science students’ skills and abilities as programmers. On the other hand, to stimulate the students and make them more involved in their own learning process, the assignment projects are focused on designing small robotics applications with some sort of visualization and animated graphs. Obviously, the projects require an understanding of the mathematical representations behind the topics being studied, and this practice would enhance and consolidate the students’ theoretical knowledge gained from the lectures.
Advantages of Programming Activities In general, students make connections between the material they are learning and their prior knowledge, and taking advantage of their skills would be beneficial to the learning/teaching process. In this aspect, we expect computer science students to be good at programming techniques. Thus, the learning of fundamentals of robotics concepts can be undertaken from an algorithmic and programming point of view by exploring the algorithms and designing programs that real robotic systems execute. Programming is an effective activity in the learning process. Students act as software developers and systems designers. Programming represents an analysis and design activity at the same time. The task of formulating an algorithm as a correct executable program involves many steps: understanding the problem, coming up with a solution, designing the algorithm and implementing it, debugging the program and testing the solution. All these steps together constitute an excellent exercise for the students to construct their own knowledge and learn about the concepts involved in the problem. In this sense, programming facilitates rigorous thinking and helps students understand many abstract concepts. According to Marvin Minsky [9], ‘‘Programming is a good medium for expressing poorly understood and sloppily formulated ideas. In expressing many poorly understood concepts in a computer program, we come to understand them better.’’ Programming was also considered fundamental in an early article [10], where authors claimed that ‘‘Programming provides a set of experiences for discussing mathematical concepts and problems. Programs are more discussable than mathematics activities: students can talk about their structures and developments, and ultimately discuss the original problem.’’ Thus, suitable programming activities can contribute to a better learning of fundamentals of robotics, and students can acquire more insight from the designing, testing, and debugging processes, than from traditional lectures.
Visualization and Animation Visualization and graphics animation are widely used to illustrate abstract concepts in many areas of engineering education [11].
Visualization is a natural way to convey knowledge. In robotics, indeed, many of the basic ideas can be explained better using some sort of visualization. For example, animated graphs would be advantageous for explaining spatial localization, kinematics, and many others concepts, compared to the use of static figures. In Ref. [12], the author suggests that students should build their own visualizations. Such constructions enable them to gain insight into what is important about the problem under study, and programming visual applications constitutes a great stimulus for developing the students’ intuition. Thus, our approach is that the proposed assignments consist in designing robotics simulations with some sort of visualization and animated graphs. Pedagogically, visualization and animated graphs are used as a means, not only for enhancing the conceptualization of mathematics concepts, but also to stir up students’ curiosity for learning.
Matlab Environment Although the programming language is not the main focus, it still plays an important role in the development of the projects. What is suitable programming software for developing the assignments? Firstly, we should be concerned about how clearly the theoretical topics will be handled, as well as how easy it is to program and visualize these topics. Secondly, the programming tool should not add a cognitive load on the students. Considering this perspective, Matlab was chosen as the platform for developing the assignments, since it meets the conditions mentioned above. Indeed, Matlab is a high performance language for technical computing, which integrates computation, visualization and programming in an easy-to-use environment. Furthermore, it is the ‘‘lingua franca’’ of engineering programming and is by far more productive than many other high level programming languages. Therefore, using the fast development capabilities of Matlab coupled with students’ imagination, constitutes the basis for providing the desired pedagogical outcomes.
Methodology Each assignment is set up through a comprehensive tutorial, which provides a brief theoretical background and some resources, such as Matlab code (m-files), illustrative graphics, and some hints for developing the project. The assignments are given to students in advance and they start working on their project at the same time as they attend lectures. The time allotted for each project is about 3 weeks. Engineers and scientists usually work in groups. Thus, courses such as robotics should serve to improve the students’ teamwork skills for their future professions. We therefore suggest that students work in groups of two’s or three’s. In order to facilitate working in teams, they are allowed to organize the groups on their own. Each group should submit a final report and give an oral presentation. The reports focus on the technical aspects of the projects, and include some scripts as ready-made demonstrations to show their achievements. The oral presentations have somewhat of a free format. A single group would take about 510 min for the presentation, and another 510 min for discussion. The presentations are aimed at sharing the students’ accomplishments and experiences.
ROBOTICS TO COMPUTER SCIENTISTS
The assignments were graded on a competitive basis, with only one project judged as the best, receiving 100% of the possible grade. This lead to each group keeping their project development and design a secret in the hopes that they would receive the highest grade.
THE ASSIGNMENT PROJECTS The following are four proposed assignments. The first assignment is aimed at the use of homogenous transformation matrices for rendering solid objects. The second one deals with the use of DeneavitHartenberg convention for simulating a simple manipulator. The third deals with path control, placing emphasis on the simulation of a 2-dof planar robot following a straight-line using linear and cubic-spline interpolation techniques and so forth. Finally, the fourth assignment deals with the joint control and digital implementation of PID controllers. Some of the mfiles of these projects can be downloaded from the Web [13], and readers can run the accompanying scripts.
Spatial Localization and Homogeneous Transforms The aim of this project is to explore the use of homogeneous transformations, and simulate spatial moves of simple geometrical objects. The models used are elementary forms represented by facets such as cube, prism, pyramid, etc. In this assignment, students are asked to build their own rendering engine. The project includes the development of various functions, such as handling 3D objects, handling the rotation about a given vector that passes through a given point by an angle, or the translation about a given vector, etc. Many other functions concerning rendering graphical objects with respect to a fixed or local frame are also necessary to perform simple animations. Students are free to build their own compounding rotations and translations to define sophisticated moves, such as screw and spiral movement. Figure 1 shows the screenshot of a simulation performing spatial moves of a cube, and Table 1 shows a model of scripts that students have to write to perform their tests and demonstrations. With this assignment, the students are more concerned with the mathematical aspect of spatial localization, and they easily grasp the meaning of homogenous transformations and their use in robotics.
Figure 1
Simulation of a cube performing spatial moves.
617
Table 1 Script Controlling the Simulation Given in Figure 1 % Rotation of a cube about a vector v % that passes through the point p % by an angle a followed by a translation init; objeto(‘cubo’); % Loading a cube object v ¼ [0 0 1]; p ¼ [1.5 1.5 0]; a ¼ pi; % Rotation rotar_x (v, p, a); % translation v ¼ [3 0 0]; trans_x(v);
Simulation of an SCARA Manipulator The aim of this project is to study motion robot simulation, and design an animation of manipulators in a realistic fashion. This project covers issues such as forward and inverse kinematics, workspace calculation, etc. An SCARA manipulator is chosen as an example. It is complex enough to demonstrate nearly all the principle used in a general manipulator simulation. The graphical representation of the arm is done by means of rectangular shapes. The students are asked to write functions that perform tasks such as loading data of the links of the SCARA to Matlab workspace, calculating the direct and inverse kinematics, displaying the graphical representation of the SCARA skeleton, returning Cartesian and joint positions, checking if a specified Cartesian (or joint) position lie within the workspace, etc. Many other functions related to rendering the SCARA skeleton are also needed. Figure 2 shows the screenshot of a simulation of the SCARA skeleton after the execution of the script given in Table 2. In this project, concepts such as forward and inverse kinematics, multiple solutions, workspace calculation, etc, are discovered by the students in a natural way.
Trajectory Generation The goal of this assignment is to study trajectory generation in its different aspects, and the project is composed of two parts. The first part deals with the velocity control algorithms, such as parabolic, trapezoidal and sinusoidal profiling. In the second part,
Figure 2
Simulation of an SCARA manipulator.
618
ALIANE
Table 2
Script Controlling the Simulation Given in Figure 2
% Simple moves of SCARA skeleton init scara; % loading SCARA init_s; % Initial position % Cartesian move x ¼ [1 0 0 pi]; move_x(x); % Joint move q1 ¼ [pi/2 0 0.5 0]; move_q(q1); % Cartesian move x ¼ [0 1 0.2 pi]; move_x(x); % interpolating moves s1 ¼ [1 0 0.2 0]; s2 ¼ [1 0 0.5 0]; ss ¼ [s1; s2]; move_s(ss);
algorithms for generating trajectories using linear and cubicspline interpolation techniques are addressed. A 2-dof planar manipulator is used as a model to test all these strategies simulating individual axis moves, point-to-point motion, and straight-line motion. The graphical representation of the manipulator is done by means of rectangular shapes. In this assignment, students re-use parts of the first and second projects. However, many other algorithms are addressed, such as following a straight line with a predefined accuracy using Taylor’s algorithm, or applying parabolic or trapezoidal profiling in Cartesian space. Figure 3 shows the screenshot of a simulation of a 2-dof planar manipulator performing three straight-line moves generated through cubic-spline interpolation: the first move uses two intermediate points, the second uses four points, and the third uses six intermediate points, generated by the script given in Table 3.
Figure 3 Simulation of a 2-dof planar manipulator performing straightline moves.
Table 3
Script for Performing the Simulation Given in Figure 3
% Cartesian moves using cubic-spline init title (‘Click on 4 points’); [X, Y] ¼ ginput(4); T ¼ 3; % Time of each move % Move with one (1) intermediate point N ¼ 1; PosInicial ¼ [X(1) Y(1)]; P ¼ [X(2) Y(2)]; moves(P, N, T); % Move with 2 intermediate points N ¼ 2; PosInicial ¼ P; P ¼ [X(3) Y(3)]; moves(P, N, T); % Move with 4 intermediate points N ¼ 4; PosInicial ¼ P; P ¼ [X(4) Y(4)]; moves(P, N, T);
At the beginning, students believe that generating a straightline trajectory is a simple task. However, with the help of this assignment, they realize that this is not the case.
Dynamics and Control In this project, the joint control of one degree of freedom (1-dof) robot manipulator is addressed. The control is focused on the single-loop control using a PID controller. The tutorial of this assignment provides the students with some Matlab/Simulink resources containing a dynamic simulation and a graphical animation of the 1-dof arm manipulator. It also includes a Simulink model of a single joint manipulator masked in a unique sub-system, which can be used as a block in a closed loop control, as depicted in Figure 4. As it can be seen in this diagram, the controller is a simple Matlab function, rather than the typical continuous or discrete block function. This block is used to tackle the digital implementation and programming aspect of the PID controller. In the tutorial, students are also provided with the technique of transforming continuous transfer functions to discrete ones by using one of the many approximation methods that maps the s-domain into z-domain, such as Euler’s or Tustin’s methods. The implementation of the PID controller (as a Matlab function) using Euler’s approximation is given in Table 4. This function uses the constants and variables defined in the secondary script. Finally, a graphical animation of the arm (provided by Simulink demo package) is added to the simulation (Fig. 5).
Figure 4 Simulink diagram for simulating control of 1-dof arm manipulator.
ROBOTICS TO COMPUTER SCIENTISTS
Table 4
Matlab Function of a PID Controller
% Digital PID controller % Kp, Ki, Kd: PID gains, T, sample period % A ¼ Kp þ Ki*T þ Kd/T; % B ¼ Kp 2*Kd/T; % C ¼ Kd/T; function [u] ¼ pid(e) global A B C global u_1 e_1 e_2 % Control signal u ¼ u_1 þ A*e þ B*e_1 þ C*e_2; % Variables actualization e_2 ¼ e_1; e_1 ¼ e; u_1 ¼ u;
Results of the simulation can then be viewed in different ways: through the animation of the arm itself and through time-series plots. In this assignment, students are asked to perform several simulations to explore the effect of tuning parameters. At a first stage, students should get a feel for the qualitative aspects of control, exploring what happens if a given tuning parameter is increased or decreased. The quantitative aspects do not matter as much. This routine enables students to quickly perceive the significance of a closed loop and understand the meaning of the controller’s tuning parameters better. In a second part, they are also asked to perform a simulation of a two-link planar arm with two revolute rigid links and perform joint control using a discrete decentralized PID. The digital implementation is now drawn from Tustin’s approximation.
DISCUSSION This approach was implemented in a robotics course offered to students in their final year of computer engineering, for five consecutive years from 2000 to 2005 at Universidad Europea de Madrid. The class consists of 4 h weekly: 2 h of lecture and 2 h of laboratory work dedicated to working on the assigned projects. By the end of the course, the laboratory sessions are dedicated to
619
programming industrial robots. The robotics class had an average of 15 students over the last 5 years. Students responded well to the method, and in general they did not have problems understanding and tackling the assignments’ challenges from a programming point of view. The first project, which deals with homogenous transforms, is clearly the most important, and several m-files developed in this assignment have been re-used in the succeeding assignments. The fourth one is the least demanding, since students have no background in dynamics and control. From a pedagogical point of view, programming activities fall under a student-centered education methodology. When students undertake these types of activities, they are immersed in a self-learning dynamic, and therefore take an active role in their learning process. Students continually analyze their programs and the effectiveness of their ideas, which ultimately enables them to construct their knowledge, rather than memorize abstract formulae. Concerning the use of Matlab, although almost 30% of the students had not used the software before and there was very little formal instruction given in class on Matlab, they were enthusiastic about the language because it is easy to learn, and allows for coding relatively complex programs quickly compared to traditional languages, such as C/Cþþ. However, some students suggested the use of alternative software, such as Python or the Java 3D package. The students’ opinions are also important for the teacher. To this end, a focus group interview [14] and the traditional course survey are used to find out the students’ perceptions of the methodology and how effectively the programming activities helped them understand the material. The interview consists in debating a set of questions. A numerical rate is also attributed to the topics being discussed. The questionnaires from two consecutive academic years, from 2003 to 2004 and 2004 to 2005, are summarized in Table 5. Basically, students uniformly agreed that the methodology is effective in supplementing the course material, and they believe that the programming approach helped them gain more insight and understanding of the material than a purely mathematical approach would have. Most of them also agreed that the incorporation of visual elements and animated graphs in the assignments made them more active and involved in their own learning process. They were also grateful for the flexibility of working at their convenience, and many of them suggested decreasing the lecture part and extending the homework assignments. In this aspect, many students advocated to shift to the project-based learning methodology. Basically, the interview findings and survey results were consistent with the teacher’s observations. Table 5 Student Questionnaire: A Total of 28 Students Took Part in the Interview and Survey No. 1 2 3 4 5
Figure 5 Graphical animation of a 1-dof arm manipulator.
Questionnaire
Score
The programming approach is helpful in understanding the material The tutorials are useful for developing the projects The time allocated for the project is sufficient The Matlab is adequate for developing the projects The robotics course is motivating
The mean scores express the level of convenience from 1 to 5.
4.2 3.8 3.3 4.5 4.1
620
ALIANE
CONCLUSION In this article, a methodology for teaching fundamentals of robotics to computer scientists has been addressed. The instruction of the subject is focused on the computational issues that govern robotic systems. The approach is based on taking advantage of students’ abilities as computer practitioners and complementing lectures with programming assignments. The programming activities are used as instruments to help students grasp robotics concepts without being weighed down by the complexity of mathematical machinery. Some assignment projects are also included. This approach is appropriate for computer science students, and seems to be effective, since software activities stimulate and capture their interest, and make the robotics course more enjoyable.
REFERENCES [1] A. Casals, J. Aranda, J. Ferna´ndez, and M. Frigola, Evaluation of learning technologies in robotics, Proc of the IEEE Inter. Conf. on Robotics and Automation, Washington, DC, 2002, pp. 27. [2] P. I. Corke, A robotics toolbox for MATLAB, IEEE Robot Automat Mag 3 (1996), 2432. [3] P. I. Corke, Matlab toolboxes: Robotics and vision for students and teacher, IEEE Robot Automat Mag 14 (2007), 1617.
BIOGRAPHY Nourdine Aliane obtained the electrical engineering degree in 1990 from the E´cole Nationale Polytechnique d’Alger, and the PhD in physics in 1995 from the Universidad Complutense de Madrid. He is currently a professor of control engineering and robotics at the Universidad Europea de Madrid, Spain. His interests include control systems, robotics, and education.
[4] I. Verner and E. Korchnoy, Experiential learning through designing robots and motion behaviors: A multi-tiered approach, Int J Eng Educ (Special Issue ‘‘Trends in Robotics Education’’) 22 (2006), 758765. [5] I. Verner and D. Ahlgren, Conceptualizing educational approaches in introductory robotics, Int J Electr Eng Educ 41 (2004), 183201. [6] J. J. Craig, Introduction to robotics: Mechanics and control, 3rd edition, Pearson Education, Harlow, 2004. [7] M. W. Spong, S. R. Hutchinson and M. Vidyasagar, Robot modeling and control, 1st edition, John Wiley, New York, 2005. [8] L. Sciavicco and B. Siciliano, Modelling and control of robot manipulators, 2nd edition, Springer-Verlag, New York, 2001. [9] G. J. Sussman, Why programming is a good medium for expressing poorly understood and slooply formulated ideas, Proc 20th Conf on ACM SIGPLAN, San Diego, CA, 2005, p 6. [10] W. Feurzeig, S. Papert, Mo. Bloom, R. Grant, and C. Sol, Programming languages as a conceptual framework for teaching mathematics, Interface 4 (1970), 1317. [11] R. Kelly, S. Dormido, C. Monroy, and E. Dı´az, Learning control of robot manipulators by interactive simulation, Robotica 23 (2005), 515520. [12] J. Stasko, Using Student-built Algorithm Animations as Learning Aids, Proc 28th ACM SIGCSE on Computer Science Education, San Jose, 1997, pp. 2529. [13] Project-Assignments [On-line]: http://www.esp.uem.es/aliane/ prac_rob/prac_rob.zip. [14] B. M. Olds, B. M. Moskal, and R. L. Miller, Assessment in engineering education: Evolution, approaches, and future collaborations, J Eng Educ 94 (2005), 1325.