Gaining Control Knowledge Through an Applied Mobile Robotics Course

In this chapter the use of an open mobile robot platform as an innovative educational tool in order to promote and integrate control science knowledge is presented. The idea of including applied interdisciplinary concepts is an important objective in engineering education. Future work in Electrical and Computer Engineering education is pointing towards gaining the ability to understand the technical details of a wide variety of disciplines (Antsaklis et al., 1999, Murray et al., 2003). Moreover, experimental developments have helped to breathe life into theoretical concepts found in text books and have thereby greatly changed the educational experience of students (Hristu-Varsakelis and Brockett, 2002). Students react positively to realism, since the models used for such experiments are in general accurately described by some relatively simple differential equations. Within this framework, the challenge of using mobile robots becomes evident. Thus, realistic platforms that incorporate engineering standards and realistic constraints increase student skills and experience through engineering practices. In this sense, mobile robot platforms can be used as educational tools to promote and integrate different curriculum subjects. Control system world and computer science share a mutual interest in robotics. Therefore, in the educational community, the Robotics Education Lab becomes a resource for supporting courses with an academic curriculum in a broad range of subjects. Some important institutions have developed various teaching activities by introducing the mobile robots as a necessary academic tool in a broad sense in order to extend the student’s previously acquired knowledge (Carnegie Mellon University, 2011, Qu and Wu, 2006). In this context, many universities take advantage of mobile robot competitions in engineering education. This allows real world problem projects to be tackled, and fundamental concepts by increasing motivation and retention purposes to be reinforced. Thus, for example, FIRST (For Inspiration and Recognition of Science and Technology) mobile robot contest attracts young people to careers in engineering, technology and science. Robotics competition encourages students to apply knowledge gained throughout their engineering degree, it also offers all students a chance to serve as members of interdisciplinary engineering teams, and introduces both freshmen and sophomores to engineering concepts. Moreover, university curriculum is reinforced by the knowledge gained throughout applied experiences that embrace a wide spectrum of subjects (Wilczynski and Flowers, 2006). The educational and research objectives can also be achieved through the use of configurable, small, low-cost such as LEGO mobile robot kits (Valera, 2007).


Introduction
In this chapter the use of an open mobile robot platform as an innovative educational tool in order to promote and integrate control science knowledge is presented.The idea of including applied interdisciplinary concepts is an important objective in engineering education.Future work in Electrical and Computer Engineering education is pointing towards gaining the ability to understand the technical details of a wide variety of disciplines (Antsaklis et al., 1999, Murray et al., 2003).Moreover, experimental developments have helped to breathe life into theoretical concepts found in text books and have thereby greatly changed the educational experience of students (Hristu-Varsakelis and Brockett, 2002).Students react positively to realism, since the models used for such experiments are in general accurately described by some relatively simple differential equations.Within this framework, the challenge of using mobile robots becomes evident.Thus, realistic platforms that incorporate engineering standards and realistic constraints increase student skills and experience through engineering practices.In this sense, mobile robot platforms can be used as educational tools to promote and integrate different curriculum subjects.Control system world and computer science share a mutual interest in robotics.Therefore, in the educational community, the Robotics Education Lab becomes a resource for supporting courses with an academic curriculum in a broad range of subjects.Some important institutions have developed various teaching activities by introducing the mobile robots as a necessary academic tool in a broad sense in order to extend the student's previously acquired knowledge (Carnegie Mellon University, 2011, Qu andWu, 2006).In this context, many universities take advantage of mobile robot competitions in engineering education.This allows real world problem projects to be tackled, and fundamental concepts by increasing motivation and retention purposes to be reinforced.Thus, for example, FIRST (For Inspiration and Recognition of Science and Technology) mobile robot contest attracts young people to careers in engineering, technology and science.Robotics competition encourages students to apply knowledge gained throughout their engineering degree, it also offers all students a chance to serve as members of interdisciplinary engineering teams, and introduces both freshmen and sophomores to engineering concepts.Moreover, university curriculum is reinforced by the knowledge gained throughout applied experiences that embrace a wide spectrum of subjects (Wilczynski and Flowers, 2006).The educational and research objectives can also be achieved through the use of configurable, small, low-cost such as LEGO mobile robot kits (Valera, 2007).

•
Computer Science includes issues such as: computer structure and technology (first year); digital systems and microcomputers (second year); architecture of computers, industrial computer science and robotics (third year).It is noted that topics such as computer vision and control, which are also highly related with the proposed course, are included within the optional subjects.Furthermore, some students are attracted to perform their "final degree project" by continuing and developing issues related with some practical aspects of the mobile robotics course.The students who pass the course successfully are awarded 5 credits on their degree which corresponds to 50 hours of teaching activities.It consists of theoretical and laboratory sessions, related to the following different topics: PSE (power system electronics), DPED (design & programming of electronic devices), MCS (modeling and control systems), TPC (trajectory planning and control) and CVS (computer vision systems).The theoretical parts are presented during 11 classroom hours, which are scheduled as follows: 1. Course and platform presentation.Introduction of power drivers (PSE).2. Hardware description.Digital systems and PLD (programmable logic devices) (Wakerly, 1992).Theoretical introduction of DPED practices.3. Hardware description.Digital systems and microprocessors (Barnett, 1994).Theoretical introduction of DPED practices.4. Introducing the MCS block.System identification (Ljung, 1989).Discrete and continuous systems (Kuo, 1996). 5. Developing the MCS block.System reduction, observers and filters (Aström and Wittenmark, 1988).6. Introducing the TPC block.Configuration space and trajectory following (Schilling, 1990).Fuzzy rules.7. TPC & MCS integration.Trajectory following.Design of PID controllers.
8. TPC & MCS integration.Trajectory following.Introducing MPC (model predictive control) (Maciejowski, 2002).9. Introducing the CVS block (Horn, 1998).10.Practicing within CVS block, color and filters.11.Final classroom, overall demos.Laboratory parts are developed during 39 hours that are scheduled as follows: 1. DPED practices with PLD: 4 bits magnitude comparison, PWM generator, design of counters (encoders speed and position).2. DPED practices with microcomputers: Serial port, I/O ports, A/D converters, PWM signal.3. MCS practices with the robot PRIM and using MATLAB: excitation of the input system by using PRBS (pseudo random binary signals), the system model using the toolbox IDENT of MATLAB.Discrete and continuous models.4. MCS practices using SIMULINK environment: reducing the system model and PID speed control. 5. MCS practices using the SISO tools of MATLAB: reduced SISO systems and PID speed control design.Testing of the controllers within SIMULINK environment.6. MCS practices using the PRIM platform: on-robot testing of the obtained set of speed controllers.7. DPED practices using PC and the robotic platform: introduction of the high level languages.Communication with the robot by using sockets that include the on-robot available functions (actuators and sensors).8. TPC practices using the robotic platform: heuristic navigation using sonar sensors.9. TPC practices using the robotic platform: the odometer system, trajectory following using PID and discontinuous control laws.10.Time gap for finishing the previously proposed TPC practices.11.MCS and TPC practices: introduction of MPC software simulation tools, trajectory following with different prediction horizons and trajectories.12. CVS practices: introducing the software tools, binary images and segmentation.13.CVS practices: color, filters and tracking of an object.

The educational open mobile platform
The robot structure, shown in Fig. 2.a, is made from aluminium.It consists of 4 levels where the different parts are placed.On the first level there are two differential driven wheels, controlled by two DC motors, and a third omni-directional wheel that gives a third contact point with the floor.On the second level there is an embedded PC computer, and on the third level specific hardware and the sonar sensors are placed.On the fourth level the machine vision system is placed.The system can be powered by 12V dc batteries or by an external power source through a 220V ac, and a switch selects either mode of operation.The 12V provided by the batteries or the external source of 220V are transformed into the wide range of dc voltages needed by the system.Moreover, the use of a 220V power supply allows an unlimited use of the platform during the teaching activities.The robot has the following sensorial system: • Two encoders connected to the rotation axis of each dc motor.

•
An array of sonars composed by 8 ultrasounds sensors.

•
A machine vision system consisting of a monocular camera.
The meaningful hardware consists of the following electronic boards: • The dc motor power drivers based on a MOSFET bridge that controls the energy supplied to the actuators.

•
A set of PCB (printed circuits boards) based on PLD act as an interface between the embedded PC system, the encoders, and the dc motors.The interface between the PLD boards and the PC is carried out by the parallel port.

•
A µc processor board controls the sonar sensors.Communication between this board and the embedded PC is made through a serial port.This board is also in charge of a radio control module that enables the tele-operation of the robot.The embedded PC is the core of the basic system, and it is where the high level decisions are made.The PLD boards generate 23 khz PWM (pulse width modulation) signals for each motor and the consequent timing protection during the command changes.This protection system provides a delay during power connection, and at the moment of change of the rotation motor direction.A hardware ramp is also implemented in order to facilitate a better transition between command changes.The value of the speed is encoded in a byte, it can be generated from 0 to 127 advancing or reversing speed commands that are sent to the PLD boards through the parallel port.The PLD boards also measure the pulses provided by the encoders, during an adjustable period of time, giving the PC the speed of each wheel at every 25ms.The absolute position of each encoder is also measured by two absolute counters used in order to measure the position and orientation of the robot by the odometer system.The shaft encoders provide 500 counts/rev since encoders are placed at the motor axes; it means that the encoders provide 43,000 counts for each turn of the wheel due to the gear reduction.Moreover, the µc has control of the sonar sensors, so for each sensor a distance measure is obtained.The ultrasound sensor range is comprised of between 3cm and 5m.The data provided by these boards are gathered through the serial port in the central computer based on a VIA C3 EGBA 733/800 MHz CPU running under LINUX Debian OS.The rate of communication with these boards is 9600 b/s.Fig. 2.b shows the electronic and sensorial system blocks.The flexibility of the system allows different hardware configurations as a function of the desired application and consequently the ability to run different programs on the µc or PLD boards.The open platform philosophy is reinforced by the use of the similar µc and PLD boards that are used as teaching tools at our school.Furthermore, reinforcement of the teaching activities can be achieved through the integration of different subjects.The system's flexibility is increased with the possibility of connecting it to other computer systems through a local LAN.Hence, in this research a network server has been implemented, which allows the different lab groups to make their remote connection with the mobile robot during different practices.The use of a PC as a high level device is shown from two different points of view, consisting of PC high level programming and the TCP/IP protocol net knowledge that allow on-robot LINUX created functions to be run by the use of the laboratory LAN.Thus, lab personal computers become a flexible and easy tool that allows communication with the onrobot hardware real-time devices through the use of WIFI connections.

Gaining control knowledge
In this section it is presented the MCS and TPC learning activities that introduce the basic control theory.The control knowledge is mainly acquired through the following lab practices:

•
Experimental identification.The model of the system.

•
Designing and testing speed PID controllers.

•
Trajectory following, controlling the robot position.

•
Trajectory following by using MPC techniques as other suitable advanced control method.It is noted that the compulsory curriculum of Computer Engineering has a lack of control science theory, while obviously students show experience in their programming skills.In this context, the control science is introduced from a general point of view.Moreover, students have a self-guide lab practices manual that includes the important theoretical aspects.

Experimental model and system identification
The model is obtained through the approach of a set of lineal transfer functions that include the nonlinearities of the whole system.The parametric identification process is based on black box models (Norton, 1986;Ljung, 1989).The nonholonomic system dealt with in this work is considered initially to be a MIMO (multiple input multiple output) system, as shown in Fig. 3, due to the dynamic influence between two DC motors.This MIMO system is composed of a set of SISO (single input single output) subsystems with coupled connection.The second practice consists in finding a simplified robot model.The continuous-time model is introduced into the SIMULINK environment, as shown in Fig. 6.Several studies concerning about the importance of coupling terms are carried out by students through the analysis of stationary gains, while the order reduction is done by searching for dominant poles.The frequency response and BODE analysis can provide a dominant pole existence, which can reduce the model order of the system.Students learn from the obtained results that the MIMO model can be approximated by two SISO models.Finally, the reduced SISO systems should be validated by considering the static gain and simulating reduced and complete robot models.Table 2

Designing and testing the speed controllers
The third practice consists of obtaining a controller based on the simplified SISO models.The students will try to make the controller design by using pole placement techniques and the MATLAB design facilities.For instance, students can use the MATLAB "sisotool", as shown in Fig. 7, to design the controller by first importing the transfer functions corresponding to both robot wheels.Then, they depict the open loop frequency response without a compensator.Afterwards, students learn to add a PI controller to the system in order to achieve the desired response.The control performance is verified by using the complete MIMO model of the robot in the presence of several perturbations.On-robot speed control is an objective of the last MCS practice.Students transform firstly the controller from continuous to discrete time.Then, they use the robot remote network server to send the controller parameters to the robot in order to test the speed control performance.

Trajectory following using PID speed controllers
Once PID speed controllers are obtained, TPC block practices are used for performing trajectory tracking controllers.Student goal is following trajectories by using high level languages and the existing communication functions that allow sending speed commands to the robot and to receive the odometer data.The coordinates (x, y, θ) can be expressed: The incremental position of the robot can be obtained by the odometer system through the available encoder information from ( 1) and (2).When students are able to obtain the robots coordinates, the path planning approach consists of following a sequence of straight lines.Thus, the trajectory tracking can be performed through either straight lines or turning actions (Reeds and Shepp, 1990).Trajectory tracking using discontinuous control laws can be implemented by using heuristic concepts related to experimental dynamic knowledge of the system.Therefore, when the error of path distance of the robot is greater than a heuristic threshold, the control law can minimize the distance to the path by performing a turning action.Otherwise the desired point distance should be minimized (Pacheco and Luo, 2006).Orientation and desired point distances can be considered as important data for achieving proper path-tracking.Their deviation errors are used in the control law as necessary information for going forward or turning.Students have to compute Cartesian distances between the robot and the trajectory to be followed.Fig. 9 depicts these concepts for two cases.The proposed control law is based on sending the same speed to both wheels when the robot distance to the trajectory is less than a heuristic threshold and different speed to each wheel in order to perform a turning action when such distance is greater.As can be observed in Fig. 9, the turning action must be different as a consequence of the robot position, up or down the trajectory, or the trajectory sense.Fig. 10 shows a trajectory following experience with two straight lines that have a 90º angle.

Trajectory following using MPC techniques
In this subsection the LMPC (local model predictive control) techniques based on the dynamics models obtained in the previous subsection are presented.LMPC strategies are simulated in the laboratory by using the methods and software developed by those of our teaching staff participating in the course (Pacheco and Luo, 2011).

The LMPC formulation
The main objective of highly precise motion tracking consists in minimizing the error between the robot and the desired path.Global path-planning becomes unfeasible since the sensorial system of some robots is just local.In this way, LMPC is proposed in order to use the available local perception data in the navigation strategies.Concretely, LMPC is based on minimizing a cost function related to the objectives for generating the optimal WMR inputs.Define the cost function as follows: ( The first term of (3) refers to the attainment of the local desired coordinates, X ld =(x d ,y d ), where (x d , y d ) denote the desired Cartesian coordinates.X(k+n/k) represents the terminal value of the predicted output after the horizon of prediction n.The second one can be considered as an orientation term and is related to the distance between the predicted robot positions and the trajectory segment given by a straight line between the initial robot Cartesian coordinates X l0 =(x l0 , y l0 ) from where the last perception was done and the desired local position, X ld , to be achieved within the perceived field of view.This line orientation is denoted by θ ld and denotes the desired orientation towards the local objective.X(k+i/k) and θ(k+i/k) (i=1,…n-1) represents the predicted Cartesian and orientation values within the prediction horizon.The third term is the predicted orientation error.The last one is related to the power signals assigned to each DC motor and are denoted as U.The parameters P, Q, R and S are weighting parameters that express the importance of each term.The control horizon is designed by the parameter m.The system constraints are also considered: where X(k) and θ(k) denote the current WMR coordinates and orientation, X(k+n/k) and θ(k+n/k) denote the final predicted coordinates and orientation, respectively.The limitation of the input signal is taken into account in the first constraint, where G 0 and G 1 respectively denote the dead zone and saturation of the DC motors.The second and third terms are contractive constraints (Wang, 2007), which result in the convergence of coordinates or orientation to the objective, and should be accomplished at each control step.

The algorithms and simulated results
By using the basic ideas introduced in the previous subsection, the LMPC algorithms have the following steps: 1. Read the current position; 2. Minimize the cost function and to obtain a series of optimal input signals; 3. Choose the first obtained input signal as the command signal; 4. Go back to the step 1 in the next sampling period.In order to reduce the set of possibilities, when optimal solution is searched for, some constraints over the DC motor inputs are taken into account:

•
The signal increment is kept fixed within the prediction horizon.

•
The input signals remain constant during the remaining interval of time.The above considerations will result in the reduction of the computation time and the smooth behavior of the robot during the prediction horizon (Maciejowski, 2002).Thus, the set of available input is reduced to one value, as it is shown in Fig. 11.  3) can be analyzed and modified according to the different horizons of prediction.Fig. 12 depicts the results obtained, m=3 and n=5, when a trajectory composed of 3 straight lines is followed.The lines are defined by the coordinates (0, 0), (0, 100), (50, 200) and (250, 200) where (x, y) are given in cm.It is noted that the sample time is 0.1s, so n=5 means 0.5s.13 show the simulation results when the control horizon is set to 4 and the prediction horizon to 8. The results obtained in Fig. 13 show that the robot is stopped near (50, 200) coordinates due to contractive constraints, and consequently the final coordinates (250, 200) cannot be achieved.The reason is that each new straight line trajectory is commanded when the final coordinate of trajectory is reached considering a tolerance threshold but in the above case the coordinates (50, 200) will not be reached even considering the tolerance threshold.The problem can be solved by modifying the parameter weights of the control law as it is shown in Fig. 14.

Conclusions
The teaching experience gained from this course has shown the usefulness of the mobile robot as an important experimental platform for computer engineering education.The course framework allows a different level of knowledge learning according to the student skills.Various control techniques have been provided to students as a main issue in order to improve their knowledge.They can acquire a higher level of skills by integrating different subjects related to electronics, control system, computer science, communication, etc.Moreover, students have the opportunity to be familiar with basic control techniques as well as some advanced methods as MPC.It should be mentioned that the developed lab practices related to the theoretic counterparts have increased the motivation of the students and have achieved the multidisciplinary knowledge consolidation of the proposed objective of control education.In this context, according to the student's feedback on the course, the average opinion of 30 students of the course is 4 over 5 according to the different survey questions that the university provides at the end of the course.They underline the interesting and attractive educational and practical aspects as the relevant characteristics of the course.One of the suggestions is to increase the number of hours in order to perform better the theoretical analysis, lab practices and algorithm implementation.Furthermore, some students decide to do their compulsory final degree project by improving the robot performance in some practical aspects; e.g., nowadays the design of factorial experiments to perform the MPC cost function tuning.In the future, the teaching staff from different research areas will do their utmost to promote the development and consolidation of the course so that the quality of teaching can be further improved.In this process, the student's opinions are important enough to encourage this work.Therefore, the path for achieving renewed progress in robotics is through the integration of several fields of knowledge, such as computing, communications, and control sciences, so as to perform a higher level reasoning and use decision tools with strong theoretical base.

Acknowledgment
This work has been partially funded by the Commission of Science and Technology of Spain (CICYT) through the coordinated projects DPI2007-66796-C03-02 and DPI 2008-06699-C02-01.The authors are grateful to the support provided by Javi Cobos in implementing a useful on-robot network server as well as different functions that allow the dynamic interactions in the robot.

Fig. 4 .
Fig. 4. Speed system outputs corresponding to the PRBS input signals
Fig. 8.a shows two consecutive robot coordinates.Fig. 8.b describes the positioning of robot as a function of the radius of left and right wheels (R e , R d ), and the angular incremental positioning (θ e ,θ d ), with E being the distance between two wheels and dS the incremental displacement of the robot.The position and angular incremental displacements are expressed as:

Fig. 8 .
Fig. 8. (a) Robot coordinates at two consecutive instants of time.(b) Robot position as function of the angular displacement of each wheel.

Fig. 10 .
Fig. 10.Example of trajectory following experiences, using discontinuous control laws and PID speed controllers.

Fig. 11 .
Fig. 11.LMPC strategy with fixed increment of the input during the control horizon and constant value for the remaining time

Fig.
Fig.13show the simulation results when the control horizon is set to 4 and the prediction horizon to 8. The results obtained in Fig.13show that the robot is stopped near (50, 200) coordinates due to contractive constraints, and consequently the final coordinates (250, 200) cannot be achieved.The reason is that each new straight line trajectory is commanded when the final coordinate of trajectory is reached considering a tolerance threshold but in the above case the coordinates (50, 200) will not be reached even considering the tolerance threshold.The problem can be solved by modifying the parameter weights of the control law as it is shown in Fig.14.

Table 1 .
Table1shows a possible set of continuous transfer functions obtained for the three different speed lineal models used.The second order WMR models

Table 2 .
shows an example of the first order transfer functions obtained.Students can validate the results obtained by sending open loop speed commands to the robot.The reduced WMR model