Genetic Algorithm Based PID tuning for Controlling
Paraplegic Humanoid Walking Movement
Hashim Ali [1] , IkramUllah [2] , M.Irfan [3], Mohsin Shahzad 4], M. Aftab [5]
[1][2][3][4][5] Comsats Institute of IT,Abbottabad.
Abstract: Genetic Algorithm (GA) is a very useful tool to search and op timize many engineering and scientific problems. In this paper, a real tim e enhanced biomedical model of humanoid structure is developed in MSC visual Nastran to assist the paraplegic patient. The complexity of the model is driven by the needs that the model parameters must be estim ated for an eventual individual with disability. After the development of humanoid structure an inverse model is designed to estim ate the joint torques. The re ference trajectories of the humanoid m odel are obtained from MSC visual Nastran.The controllers are des igned in M atlab/ Simulink for f our joints which are manually tuned simultaneously to obtain the results. Afterwards, GA is used to tune the P ID controllers to find the optimal solutions which are com pared with manually tuned PIDs. The re sults are shown and hence it is proved that GA has given a better optim ized control system. Keywords: Genetic Algorithm, PID, Inverted Pendulum, Optimization, Walking Movement.
1. Introduction
Paraplegia is a disease caused by the spinal cord injury (S CI) paralyzing lower body of the patient. Patients suffering from this disease are known as paraplegics. Paraplegics experience
immobility or lack of activity in lo wer body part. Recently, a lot of work has been done in this area. Due to the large varieties of humanoid structure it is not possible to apply a general control method to all humanoid m odels. Intelligent control techniques like Neural Networks, Fuzzy control, Genetic Algorithm (GA) etc., have been used to control humanoid models due to their evolutionary learning, faster convergence and good tolerance of uncertainty and imprecision [1]. As these intelligent techniques are independent of model in optimization, and only depends upon the feedback from the system to improve performance. As the precise dynamic model of hum anoid is not available due to the complex mechanical structure and high degr ee of freedom, so the evolutionary techniques are useful in humanoid control. Humanoid walking is a hot issue in many research publications but this issue is still unsolved or addressed, because of its dependency on certain other issues like 3-D walking, impact of effects between humanoid robot and ground plane [2]. Pratt et al. have developed RoboKnee [3] to support the knee motion during walking or clim bing up stairs. Johnson et al have developed a support system using pneumatic muscles by compressed gas not for a healthy person but for the paralyzed, am putee and spastic patient [4]. One of the aim s of this work was to solve problems about weight, power, endurance and cost of the IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 275 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
actuators. Many authors have investigated control of muscle force by either computer sim ulation or experiment. Optimal control of an antagonistic muscle pair has been discussed in [5-6] and implem entations of closed-loop control of a single muscle have been also reported [7-10]. However, since their works were restricted to single -input single-output systems, it is very difficult to understand how to control multiple muscles in order to regulate a multi joint body movement. In humanoid research field, m any researchers have used GA as an optimization tool [11-13]. A GA based trajectory generation m ethod for a prismatic joint humanoid robot has been presented by Capi et al [11]. Hasegawa et al [12] has presen ted a hierarchical evolutionary algorithm to generate a natural walking m otion on the slope surface to minimize total energy. Cheng and Lin [13] have used GA to investigate a control design to search a suitable control and param eters of trajectory based on the robustness measure developed from the liberalized Poincare map. However, all of them have not considered 3-D humanoid walking and restricted to the motion to a single plane independently. In this paper, a sim pler technique and not like passive dynam ic walk but an electrically controlled system on a humanoid model is used. The development of the real tim e humanoid model is being done in MSC visual Nastran 4-D to obtain the reference trajectories. Matlab/ Simulink is used to implement the controllers f or the disabled lower pa rts of the body to initiate walking m ovement and the controllers are tuned both manually and GA based to f ollow the ref erence trajectories for four joints obtained from MSC visual Nastran 4-D. This paper is organized as follows. Section 2 presents the developm ent of the humanoid model, humanoid walking gait and its phases. Section 3 covers the design of controller structure. A brief review of GA and the proposed GA based tuned PID controller is described in section 4. The results are discussed in section 5.Finally the conclusion is given in section 7.
2. Humanoid Model
2.1 Humanoid Structure
The development of an accu rate humanoid model is extremely important. Designing an accu rate controller to perform walking m ovement is not possible until and unless the re is an accurate model. Because of the high degree of freedom and complex mechanical structure it is hard to precisely model the dyna mics of humanoid. To build an accura te model a computer aided design tool is required that can simulate the designed model in real time. This m odel is created in AutoCAD and is im ported to MSC visual Nastran software. It can be easily connected with Matlab/ Simulink so that a suitable controller can be designed for making the m odel to m ove. The complete development of the hum anoid model includes all the body segm ents and measurements of t heir length and weights. The main focus of this paper is on the left hip, left knee, right hip, and right knee while the rest of the body movement is ignored. Revolute motors are being us ed on these specified joints to obtain the reference trajecto ries in terms of instantaneous angles for a IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 276 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
normal human walking as shown in figure 1.
Fig.1 Humanoid Model Developed.
2.2 Walking Gait
A unique feature of locom otion analysis is that unpredictable hum an behavior must be taken into account when the control system is designed [14]. The main difficulty lies in balancing the body, reducing the contact force between the feet and step s and avo iding slipping of the f eet in the support phase. To balance the body and to avoid foot slipping, the weight acceptance (moving centre of m ass forward) is essential. The above developed model is moved in MSC visual Nastran to obtain the instantaneous positions of left hip, left knee, right hip and right knee in terms of angles f or a tim e interval of three seconds as shown in figure 2.
Fig.2 Walking gait with reference trajectories. 2.3 Phases of Walking
The first phase is the initiation phase. During this phase the forward momentum is generated. The forward momentum generation is n ecessary in order to tra nsfer weight from the still position to a m oving position. The beginning of this phase corresponds to fast changes in the anterior-posterior component of the ground reaction f orce. The initial phase f or a normal walking movement can be considered as a ballistic movement. Table 1 shows the left and right foot com plete 2-steps cycle. S.No Phase Activity Cycle 1 Initial Phase Trunk movement with still legs 10% 2 First Step/Left foot Forward Acceleration 10%- 40% 3 Back to initial position Deceleration/Balancing Body 40%- 50% 4 Second Step/Right foot Forward Acceleration 50%- 80% 5 Final phase Back to still position 80%- 100%
Table 1: Phases of the walking movement 3. Controller Structure Design
To design a controller that will con trol the movement of the hum anoid model according to the obtained reference trajectories. The PID controllers are used to track the reference trajectories of the revolute motors used for each left hip, left knee, right hip, and right knee. In this design, the voluntary upper body effort has been taken as a disturbance.
3.1 Multivariable PID Control System
To achieve satisfactory perform ance, multivariable control methods m ust be used. This is a s trong motivation to derive effective yet sim ple methods for tuning PID controllers used with in a multivariable controller. Consider the case of 44-square system.
3.1.1 Matrix Vector Expression The system can be modeled as: ( ) y f u u = (1) IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 277 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
where output and control vectors satisfying 4 , y ue9 and 4 4-square matrix of system transfer fun ction 4 4 ( ) f u
e9
The error can be written as: l h l h l h l k l k l k r h r h r h r k r k r k e r y
( ( ( ( ( ( ( ( ( ( ( (
= (2) where error, reference and output vectors satisfying 4 , , e r y e9
and the controller of the system will be : ( ) l h l h l k l k r h r h r k r k c u G s e
( ( ( ( ( ( ( (
= (3) where control and error v ectors satisfying 4 , e u e9 and 4-sqaure matrix of controller transfer function satisf ying 4 4 ( ) c G s
e9
3.1.2 Element wise Matrix Vector Definition The system equation ( ) l h l h l k l k r h r h r k r k y f u u
( ( ( ( ( ( ( (
= is given the element wise description. ( ) y u l h l h y u l k l k y u r h r h y u r k r k f u
( ( ( ( ( ( ( =
( ( ( (
(4) where output and con trol components are: , , , , , , , ( ) l h l k r h r k l h l k r h r k y y y y u u u u s
e9 , The error equatio n l h l h l h l k l k l k r h r h r h r k r k r k e r y
( ( ( ( ( ( ( ( ( ( ( (
= is given by the element wise description. e r y l h l h l h e r y l k l k l k e r y r h r h r h e r y r k r k r k
( ( ( ( ( ( ( ( ( = ( ( ( ( ( (
(5) where error, reference and output vector elements satisfying: 4 , , , , , , , , , , , l h l k r h r k l h l k r h r k l h l k r h r k e e e e r r r r y y y y
e9
Finally the contr oller equation ( ) l h l h l k l k r h r h r k r k c u G s e
( ( ( ( ( ( ( (
= is given the element wise description. - - - - 0 0 0 0 0 0 0 0 0 0 0 0 u e l h l h l h u e l k l k l k u e r h r h r h u e r k r k r k g g g g
( ( ( ( ( ( ( ( ( = ( ( ( ( ( (
(6) where the error and control vector elements satisfy: 4 , , , , , , , l h l k r h r k l h l k r h r k e e e e u u u u
e9
Figure 3 shows the control system for multivariable model.
Fig. 3 Multivariable PID Control System
The integration of Matlab/ Simulink with MSC visual N astran makes it IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 278 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
possible for Simulink to send signals to MSC visual Nastran and to receive signals from it in real tim e. In this way the two software environm ents work together. Therefore, a control system in Matlab/ Simulink is e ssential to e nable the joints angular displacement, angular velocity, angular acceleration and torques to track the d esired trajectories and the hum anoid model to perform walking in MSC visual Nastran. As there are various com ponents of the system which are dynamically strongly coupled, slight change in any joint causes disturbance and va riation in the trajectories of all other segments. Hence, it is no t easy to con struct a precise mathematical model that describes the dynamic behavior of the humanoid model. A closed loop control system has been designed to ach ieve the desired trajectory.
4. Problem Formulation
In order to move the humanoid model to walk under the control of PID controllers the reference trajectories are needed, which should be followed for the balance motion of the model. First of all the reference trajecto ries are generated in MSC v isual Nastran for norm al human walking and then PID controllers are used to move the model accord ing to the reference trajectories. To tun e the PID controllers so that the model follows the reference trajectories is a very time consuming process and also it cannot guarantee good walking performance. In the proposed method, a multi-criteria GA is used to search o ptimal value for the parameters of the PID contr oller which will guarante e to f ollow the reference trajectories. So the objectiv e function can be defined in terms of errors and PIDs ar e tuned using GA to minimize the error.
4.1 Objective Function
To design the four GA based PID controllers so tha t it will f ollow the reference trajectories given by the visual Nastran 4-D. The objective function can be defined as: 3 3 3 3 0 0 0 0 (7) l h l k r h r k LeftHip LeftKnee RightHip RightKnee J w edt w edt w edt w edt
l h l h l h l k l k l k r h r h r h r k r k r k e r y ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (
= (8) where e is the error, r is the reference trajectory and y is the current output of the plant and 1 l h l k r h r k w w w w
= = = = .
4.2 Optimization Problem
In this study, m inimization of the objective function J is used. The constraints are the co efficients of the PID controller. Minimize J Subjected to: min max , , , min max , , , min max , , ,
P i P i P i I i I i I i D i D i D i K K K K K K K K K s s s s s s
where [1, 2,3, 4] i e . The proposed design is optim ized through GA to search the optimal controller parameters. Table 2 gives the details of the parameters with their bounds to be optimized by GA.
IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 279 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
S.No Parameters Min Max 1 K P1 0 50 2 K I1 0 50 3 K D1 0 50 4 K P2 0 50 5 K I2 0 50 6 K D2 0 50 7 K P3 0 50 8 K I3 0 50 9 K D3 0 50 10 K P4 0 50 11 K I4 0 50 12 K D4 0 50 Table 2: The parameter bounds for optimization In Table 3 the param eter values of GA based tuned PIDs are given. S.No Parameter Value 1 Maximum Generations 100 2 Population Size 20 3 Crossover Probability
0.6 4 Mutation Probability 0.1 Table 3: GA parameters
5. Humanoid Walking using GA based Control System
The genetic algorithm is an optimization algorithm which sim ulates the natural evolution process to search the optimal solution of the optimization problem. It depends entirely on responses from its environment and evolution operators (i.e., reproduction, crossover and mutation) to arrive at the best solution. By starting at several independent points and searching in parallel, the algorithm avoids local minima and converging to sub optimal solutions. In this pape r, GA is used to search the parameters of the PID contro llers in terms of objective function minimization as shown in figure 4.
Fig.4 Flowchart of Design process
A closed loop control system is designed for humanoid model movement as shown in figure 5.
Fig.5 Interface of MSC visual Nastran with Matlab/ Simulink
In this f igure it is shown that the humanoid model is moved in MSC visual Nastran and its m ovement is controlled by closed loop control system in Matlab/ Simulink. The parameters of the PID controllers of closed loop control system are tuned using GA implemented in Matlab.
6. Results and Simulations
The normal humanoid walk has been carried out in MSC visual Nastran for a IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 280 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
time interval of 3 seconds to obtain the reference trajectories. Figure 6 shows the initial and final positions of the humanoid model in MSC visual Nastran.
Fig.6 Initial position and final position of humanoid model in MSC visual Nastran
A closed loop control system is applied to move the m odel and the PID controller parameters are tuned manually and using GA. The angular displacement, angular velocity, and angular acceleration corresponding to the reference trajectories are g iven in figures 7, 8 and 9 respectively.
Fig.7 Angular Displacement
Fig.8 Angular Velocity
Fig.9 Angular Acceleration
In figure 10 the torques plots are given corresponding to the reference trajectories for left hip, left knee, right hip and right knee respectively.
Fig.10 Torques IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 281 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
In this figure, the torque plots of the knees are continuous because of the fast variations at each point of hum anoid walk while the to rque plots of the hips are discrete because of the slow variations at each point.
6.1 Optimization Results
Both manually and GA based tuned PID controllers parameter values are given in Table 4. S.No Parameters Value
Manually tuned GA tuned 1 K P1 42 21 2 K I1 0 39 3 K D1 0.7 31 4 K P2 15 11.5 5 K I2 1 4.6 6 K D2 0.6 5 7 K P3 23 5.5 8 K I3 0 21 9 K D3 2 30.5 10 K P4 33 6 11 K I4 1 1.6 12 K D4 0.99 30
Table 4: Parameters values of manually tuned and GA based tuned PID controllers Figures 11-14 show the tracked reference trajectories by manually tuned PID based control system for left hip, left knee, right hip and right knee respectively.
Fig.11 Reference and achieved left knee trajectory
Fig.12 Reference and achieved left hip trajectory
Fig.13 Reference and achieved right knee orientation trajectory
Fig.14 Reference and achieved trunk right hip trajectory While the plots of reference trajectories following by GA ba sed tuned PID controllers of the closed loop control system are given in figures 15-18 for left hip, left knee, right hip and right knee respectively. IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 282 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
Fig.15 Reference and achieved left hip trajectory
Fig.16 Reference and achieved left knee trajectory
Fig.17 Reference and achieved right knee trajectory
Fig.18 Reference and achieved right hip trajectory The static and dyna mic performance of both manually and GA based tuned PID controllers can easily be d epicted through the IAE and IT AE as described from equations below: 3 2 0 IAE : e dt }
3 2 0 ITAE : ( ) t e dt }
Figure 19 shows the IAE value of both GA based and m anually tuned PID controllers.
Fig.19 Comparison between the PIDs tuned manually and PIDs tuned by GA for IAE It is observed that the IAE value of GA based tuned are less than that of manually tuned PIDs for all f our joints. Figure 20 shows the ITAE value of both GA based and m anually tuned PID controllers. IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 283 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
Fig.20 Comparison between the PIDs tuned manually and PIDs tuned by GA for ITAE It is observed that the ITAE value of GA based tuned are less than that of manually tuned PIDs for all f our joints. The combined IAE and ITAE values for both GA based and m anually tuned of four PID controllers are given in figure 21.
Figure 21: Comparison between the combined PIDs tuned manually and PIDs tuned by GA for IAE and ITAE
7. Conclusion
In this paper, hum anoid model is developed in MSC visual Nastran.The reference trajectories have been obtained from normal humanoid walk in MSC visual Nastran. A closed loop control system with PID controllers is designed in Matlab/ Simulink to contro l the humanoid movement in MSC visual Nastran to fol low the reference trajectories by tuni ng the PIDs. The PIDs are tuned both manually and using GA and their respective performances are shown through the results. It is observed that GA has tuned the P IDs better than that of manually tuned by minimizing the error.
References [1] Katic D, Vukobratovic M, Survey of Intelligent Control Techniques f or Humanoid Robots, Journal of Intelligent and Robotic Systems, 37:117-141, 2003. [2] Hemami H, Zhen g Y.F, I mpact Effects of Biped Contact with the Environment, IEEE Tans. System s. Man. and Cybernetics, SMC-14(3): 437-443, May/June 1984. [3] Benjamin T. Krupp, Collins Steven H, Christopher J. Morse and Pratt .Jerry E, The RoboKnee: An Exoskeleton for Enhancing Strength and Endurance during W alking, Proceedings of the 2004 IEEE International Conference on Robotics and Autom ation (ICRA 04), pp.2430-2435, 2004. [4] David C. Johns on, Daniel W. Repperger and Thompson Greg, Development of a mobility assist for the paralyzed, amputee, and spastic patient, Proceedings of the IEEE Southern Biomedical Engineering Conference, pp. 67-70, 1996. [5] Buys.J.D and H. Hatze, Energy- optimal controls in the mammalian neuromuscular system, Biological Cybernetics., vol. 27, pp. 9-20, 1977. [6] Oguztoreli M.N. and Stein R. B, Optimal control of antagonistic muscles, Biol. Cyhern, vol. 48, pp. 91-99, 1983. [7] Bemotas.L.A ,Crago P. E, and Chizeck H.J, Adaptive control of electrically stimulated muscle, IEEE Trans. Biomedical Engineering, vol. BME-34, pp. 140-147, 1987. [8] Crago P. E, Mortim er J. T, and Peckham P. H, Closed-loop control IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 284 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.
of force during electrical stim ulation of muscle, lEEE Transactions on Biomedical Engineering, vol. BME- 27, pp. 306-312, 690-761, 1980. [9] Chizeck H. J and Peterson D.K, Linear quadratic control of a loaded agonist antagonist muscle pair, IEEE Trans. Biomedical Engineering, vol. BME-34, pp. 790-796, 1987 [10] Chizeck H.J, Crago P.E and Wilhere G.F, Design and evaluation of a digital closed-loop controller for the reg ulation of muscle force by recruitm ent modulation, IEEE Trans Biomedical Engineering, vol. BME-32, pp. 668-676, 1985. [11] Barolli L, Capi G, Kaneko S, Mitobe K and Nasu Y, Opt imal trajectory generation for a prismatic joint biped robot using genetic algorithms, Robotics and Automation Systems, 38: 119-128, 2002. [12] Arakawa T, Fukuda T and Hasegawa Y, Trajectory generation for biped locom otion robot, Mechatronics, 10: 67-89, 2000. [13] Cheng M.Y, and Lin S, Dynam ic biped robot locom otion on less structured surfaces, Robotica, 18:163-170, 2000. [14] Kaphle Manindra, Sim ulations of human movements through temporal discretization and optimization, KTH Mechanics, 2007.
Hashim Ali has been in research since 2006.He has received masters in computer engineering(2009) with distinction. He has also done bachelors in computer science (2006). Currently he is peer reviewer of IEEE and member international journal applied engineers.
IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 4, No 3, July 2012 ISSN (Online): 1694-0814 www.IJCSI.org 285 Copyright (c) 2012 International Journal of Computer Science Issues. All Rights Reserved.