The Inverse Solution Of Dexterous Robot By Using Neural Networks ١ The Inverse Solution Of Dexterous Robot By Using Neural Networks Dr. Bahaa Ibraheem Kazem Samer Yahya Hadi Mechatronics Dept Al-kwarizmi College of Engineering Control and Computers Engineering University of Baghdad,, Iraq, University of Technology, Iraq (Received 1٣ June 200٦; accepted 19 December 2006) Abstract: The inverse kinematics of redundant manipulators has infinite solutions by using conventional methods, so that, this work presents applicability of intelligent tool (artificial neural network ANN) for finding one desired solution from these solutions. The inverse analysis and trajectory planning of a three link redundant planar robot have been studied in this work using a proposed dual neural networks model (DNNM), which shows a predictable time decreasing in the training session. The effect of the number of the training sets on the DNNM output and the number of NN layers have been studied. Several trajectories have been implemented using point to point trajectory planning algorithm with DNNM and the result shows good accuracy of the end effector position for the desired trajectory. Keywords: inverse kinematics, robotics, neural network Introduction: The kinematics is the science of motion, which deals with motion without consideration of the forces that cause it. Within the science of kinematics one should study the position, velocity, acceleration, and all higher order derivatives of the position variables (with respect to time or any other variable(s)). Hence, the study of the kinematics of manipulators refers to all the geometrical and time-based properties of the motion. The relationships between these motions and the forces and torques, which cause them, are the problem of dynamics [1]. There are two types of kinematics: the forward and inverse kinematics. The forward kinematics problem can be stated as follows: Given the joint variables of the robot, one can determine the position and orientation of the end effecter. The joint variables are the angles between the links in the case of revolute or rotational joints, and the link extension in the case of prismatic or sliding joints. The forward kinematics problem is to be contrasted with the inverse kinematics problem, which can be stated as follows: Given a desired position and orientation for the end- effecter of the robot, one can determine a set of joint variables that achieve the desired position and orientation [2]. Execution of a task by a robot generally requires many movements of its end effecter. The set of situations corresponding to these moves define the geometrical trajectories of the operations space. A trajectory is, therefore defined by the application and the geometrical constraints of the robot and its environment. A distinction is generally made between point-to- point trajectories and continuous path trajectories, depending on the number of geometrical constraints applied to the trajectory. Motion results from a particular parametric description of the trajectory where the parameter is time [3]. If the number of joints of the robotic arm exceeds the dimension of the tool- configuration space, then robotic arm is said to Al- Khwarizmi Engineering Journal Al- Khwarizmi Engineering Journal , Vol. 3 , No.1 , pp 1-11 (2007) Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ٢ be kinematically redundant. Robots with more than six axes are always kinematically. redundant. However it is also possible for robots with fewer axes to be redundant if the dimension of the tool-configuration space is restricted [4]. Dexterity has been interpreted to mean different physical concepts such as a measure of kinematics feature over which a manipulator can kinematically reach all orientations, the operation of manipulators with multiple, actively powered fingers, and a global measure applied over a complete end-effecter trajectory. In one way or another, the aim of considering dexterity is to lead to robots which are similar to the human arm since many desirable features are ingeniously integrated in it and apparently constitutes the ultimate model of a dexterous robot. A dexterous device would have many sensors since a high level understanding of the situations is of the extreme importance to achieve complex tasks. It would have many degrees of freedom (DOF), may be more than a complete human arm [5]. There are many references that deal with robot kinematics and trajectory planning; some of them are mentioned below: Robot kinematics generally includes forward and inverse kinematics at the position, velocity, and acceleration level. These constructs are essential for the cartesian control of serial manipulators. C. Kapoor and D. Tesar [6] presented the development of a C++ class library that supports the forward and inverse kinematics of all possible geometries of serial manipulators. Object-oriented analysis and design are the primary software development methodology used. Application of this methodology led to the sub-division of the kinematics domain into forward and inverse kinematics. Analysis of these sub-domains resulted in their further sub-division, identification of abstract components, development of classes, interface specifications, and finally implementation and testing. An approach to solve the inverse kinematics problem for hyper-redundant planar manipulators following any desired path was presented by F. M. Asi [7], his approach is based on defining virtual layers and dividing them into virtual/real three-link or four-link sub-robots. This approach starts by solving for the inverse kinematics problem for the sub- robot located in the lowest virtual layer. The data obtained from the solution of this sub- robot are used to solve the inverse kinematics equations for the sub-robots located in the upper virtual layers. The data obtained by solving the equations of the sub-robots located in each virtual layer affect the solutions of the equations of the sub-robots located in both the upper and lower virtual layers. By J. Somlo, A. Sokolov, and V. Lukanyin [8] carried out an attempt in order to develop an automatic trajectory planning. It is shown that different approaches to trajectory planning are possible. These are 1. Time optimal 2. Process optimal 3. Force effective 4.Optimal trapezoidal trajectory planning. Realization of all these trajectory-planning principles can be automatized. S. Yue and D. Henrich [9] focused on the problem of point-to-point trajectory planning for flexible redundant robot manipulators (FRM) in joint space. Compared with irredundant flexible manipulators, a FRM possesses additional possibilities during point- to-point trajectory planning due to its kinematics redundancy. A trajectory planning method to minimize vibration and/or executing time of a point-to-point motion is presented for FRM based on Genetic Algorithms (GAs). Kinematics redundancy is integrated into the presented method as planning variables. Quadrinomial and quintic polynomial are used to describe the segments that connect the initial, intermediate, and final points in joint space. The trajectory planning of FRM is formulated as a problem of optimization with constraints. A method for solving the inverse kinematics of a humanoid robot based on artificial neural networks is presented by J. De lope, T. Zarraonandia and D. Maravall [10]. The inputs of the network are the desired positions and Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ٣ Fig.1. Intermediate point on the point-to-point path. orientations of one foot with respect to the other foot. The output is the joint coordinates that make it possible to reach the goal configuration of the robot leg. Trajectory planning Trajectory refers to a time history of position, velocity and acceleration. Suppose that the point-to-point trajectory is connected by several segments with continuous acceleration at the intermediate via point (as shown in figure 1). The intermediate points can be given as particular points that should be passed through. This is useful especially when there are obstacles in the working area. If one wishes to be able to specify the position, velocity, and acceleration at the beginning and the end of a path segment, a quadrinomial and a quintic polynomial are required. Let us assume that there are pm intermediate via points between the initial and the final points. Between the initial points to pm intermediate via points, a quadrinomial is used to describe these segments as [9]; ( ) aitiaitiaitiaiaitx ii 43322101, ++++=+ (1) (i=0,…. pm-1) (2) (ai0,…,ai4) are constants and ti is the time from the last intermediate point to the moment. The constrains are given as: ax ii 0= (3) T ia iT ia iT ia iT ia ia ixi 443322101 ++++=+ (4) a ixi 1=& (5) T ia iT ia iT ia ia ixi 3442332211 +++=+& (6) a Ix i 22=&& (7) where Ti is the executing time from point i to point i +1. The five unknowns can be solved as: xa ii =0 (8) xa ii &=1 (9) 2/2 xia i &&= (10) T iT ixiT ixi xiT ixixi a i 3/23 4114 3         −− −+−+ = &&& & (11) Ti TixiTixi xixiTixi ai 4/ 2/22 3131 4         ++ ++−+ = &&& & (12) The intermediate point i +1’s acceleration can be obtained as: T ia iT ia ia ixi 241236221 ++=+&& (13) The segment between the number pm of intermediate points and the final point can be described by quitic polynomial as: ( ) t ibit ibi bit ibit ibibitx ii 5544 322101, ++ +++=+ (14) where (i= pm) and the constraints are given as: bixi 0= (15) T ibiT ibi T ibiT ibiT ibibixi 5544 3322101 ++ +++=+ (16) bixi 0=& (17) T ibiT ibi T ibiT ibibixi 455344 2332211 + +++=+& (18) bixi 22=&& (19) Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ٤ T ibiT ibi T ibibixi 35202412 36221 + ++=+&& (20) and these constraints specify a linear set of six equations with six unknowns whose solution is: xibi =0 (21) xibi &=1 (22) 2/2 xibi &&= (23) T i T ixi xi T i ixi xi xixi b i 32/ 2 1 3 12 18 20120 3                 +− −         + + −−+ =      && && & & (24) ( ) T i T ixi xi T i ixi xi xixi b i 42/ 2 12 3 16 114 13030 4             + − +      + + ++− = && && & & (25) ( ) T i T ixi xi T i ixi xi xixi b i 52/ 2 16 16 12112 5             + − −         + + − −+ = && && & & (26) Using neural networks in robot kinematics From above, it is clear that in order to perform end effecter position control of a robotic manipulator, two problems need to be solved [11]: 1. Inverse kinematics problem: Given the Cartesian coordinates of the end effecter, specified either as a single point or as a set of points on a trajectory, joint angles need to be found. 2. Target position control: Given the final end effecter position, a joint angles sequence suitable for achieving the final position needs to be found. In this work a dual NN model has been designed in order to find the inverse solution for three degrees of freedom redundant planner robot. Each architecture of these NN exist of three layers backpropagation networks. The first network is used to find the joint angles to reach the desired point when it located in the circular work area with a maximum radius equal to (rmax/2) or (maximum reach/2). The second network is used to find the joint angles associated with remaining points in the robot work area, that means (maximum reach/2) ≤ r ≤ (maximum reach). Each of these two networks has three layers. There are nineteen input vectors with two elements, and there are ten neurons in the first hidden layer, twenty five neurons in the second hidden layer and three neurons in the third (output) layer. The transfer functions in the input and output layers are (purelin) and the hidden layer transfer functions are (logsig). Case studies A planar articulated robot with three links is used in the following case studies. The robot has one redundant freedom in terms of positioning. The first link has the length of (L1=4 unit), the second link has the length of (L3=3 unit), and the third link has the length of (L2=2 unit). All the cases are simulated in the horizontal plane. Inverse Kinematics If the global angle (q3) which is equal to the summation of the three local angles (θ1,θ2,θ3) takes any random value then the x and y coordinates of the end of second link can be easily found by using the conventional inverse solution[1], where r r 21 tan 12 −± −=θ (27) Where r can be found from: LL LLdydx r 2 2 2 12 2 2 2 1 22 2 −−+ = (28) cLL sL dx dy 221 22tan 1tan 11 + −−−=θ (29) q3= θ1+θ2+θ3 (30) Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ٥ -3 -2 -1 0 1 2 3 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 The X-coordinate of target point T he Y -c oo rd in at e of t ar ge t po in t -3 -2 -1 0 1 2 3 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 The X-coordinate of target point T he Y -c oo rd in at e of t ar ge t po in t then θ3= q3- θ1-θ2 Where dx & dy are the x and y coordinates of the end of the second link. It is clear from the previous equations that there are two solutions for any value of q3, but there are infinite possibilities for the value of q3, hence there are infinite solutions to the three links arm to reach any point inside the work space, therefore the neural network is used to find one desired solution. To find the joint angles of the articulated robot in order to reach the point of (x = -2.2 unit) and (y = 4.6 unit), figure (2) shows the solution of this case. Fig. 2 .The end effecter at point (x=-2.2 unit) and (y=4.6 unit) (a) two hidden layers N.N. and (19) training sets (b) two hidden layers N.N. and (37) training sets (c) single layer N.N. and (19) training sets (d) single layer N.N. and (37) training sets The tables (1) & (2) show the value of error by using the N.N. technique: Where the error was found by using the following equation: where xd : the desired x-coordinate of target point. xNN : the x-coordinate of the target point from the neural networks. yd : the desired y-coordinate of target point. yNN : the y-coordinate of the target point from the neural networks. Table (1) error by using two hidden layers N.N. no.of t.s. θ1(deg) θ2(deg) θ3(deg) 19 49.6488 118.0402 -12.1608 37 50.0103 117.2505 -12.4518 xd (unit) yd(unit) xNN (unit) yNN(unit) Error (unit) -2.2 4.6 -2.1608 4.5180 0.090 9 -2.2 4.6 -2.1653 4.5770 0.0414 Table (2) error by using single layer N.N. no.of t.s. θ1(deg) θ2(deg) θ3(deg) 19 51.2902 116.3237 -13.6137 37 50.4623 117.4577 -13.3115 xd (unit) yd(unit) xNN (unit) yNN(unit) Error (unit) -2.2 4.6 -2.2263 4.6415 0.049 1 -2.2 4.6 -2.1940 4.5703 0.030 3 Point To Point Trajectory Planning In first case study the training sets are (19) and the network used is a two hidden layers N.N., where the end effector is moved from the start point (x=-3, y=-5, vx=1, vy=2, ax=1, ay=0) to the target point (x=5, y=2, vx=0, vy=0, ax=0, ay=0) but the end effector is passing through the intermediate point (x=- 1, y=-2, vx=2, vy=1) and the desired time for moving the end effector from the first point to the intermediate point is (2 second), and the time for moving the end effector from the intermediate point to the target point is (3 second).By using the equations of the trajectory planning, the (x) and (y) coordinates, and their first and second derivatives with time can be found. The desired path of the end effecter from the first point to the target point passing (a) (b) (c) (d) ( ) ( )       −+−= ynnydxnnxde 22 Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ٦ -3 -2 -1 0 1 2 3 4 5 -5 -4 -3 -2 -1 0 1 2 x(m) through the intermediate point is shown in figure (3) Fig. 3. The desired point-to-point path The x & y coordinates of the desired path with time are shown in figure (4): Fig. 4 .The x & y coordinates of desired path with respect to time The first time derivative of the x & y coordinates, i.e. (vx)&(vy) with respect to time is shown in figure (5): Fig. 5 .vx & vy versus time The second time derivative of the x & y coordinates, i.e. (ax) & (ay) with respect to time is shown in figure (6): Fig. 6. ax & ay versus time The first, second & third joints angle with respect to time are shown in figure (7): Fig. 7. θ1, θ2 & θ3 versus time Figure (8) shows both of the real and desired paths of the arm. x(unit) x(unit) Vx(unit/s) vx(unit /s) ax(unit /s2) ay(unit /s2) θ3(deg) θ2(deg) θ1(deg) x(unit) y(unit) N.N. path desired path y(unit) Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ٧ Fig. 8 .The real and desired paths of the arm The configuration of the three links planar articulated robot is shown in figure (9). Fig. 9. The configuration of the arm To find the error between the desired trajectory and neural network trajectory, one can calculate the error between some points along them. It is the best method to find the accuracy of the neural network method; there are forty one points along the desired trajectory and neural network trajectory which are used to find the error, where the error in each point is found by using the equation (31).Figure (10) shows the error versus the distance of the end effector from the base. 1 1.5 2 2.5 3 3.5 4 4.5 5 5. 5 6 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 r(m) Fig.10 .The error versus the distance from the base The second case is similar to the previous case but the training sets are (37) and the network used has a two hidden layers N.N., where the end effector is moved from the start point (x=-3, y=-5, vx=1, vy=2, ax=1, ay=0) to the target point (x=5, y=2, vx=0, vy=0, ax=0, ay=0) but the end effector is passing through the intermediate point (x=-1, y=-2, vx=2, vy=1) and the desired time for moving the end effector from the first point to the intermediate point is (2 second), and the time for moving the end effector from the intermediate point to the target point is (3 second). The first, second & third joints angle with respect to time are shown in figure (11): 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 -250 -200 -150 -100 -50 0 50 100 150 time(sec) Fig. 11. θ1, θ2 & θ3 versus time Figure (12) shows both of the real and desired paths of the arm. -3 -2 -1 0 1 2 3 4 5 -5 -4 -3 -2 -1 0 1 2 3 x(m) Fig. 12. The real and desired paths of the arm x(unit) y(unit) r(unit) Error θ1(deg) θ2(deg) θ3(deg) y(unit) x(unit) N.N. path desired path Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ٨ The configuration of the robot is shown in figure (13); Figure (14) shows the error versus the distance of the end effector from the base. Fig. 13 .The configuration of the arm 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 Fig 14. The error versus the distance from the base The same case is studied by using the single layer NN instead of two hidden layers NN, when the training sets are (15) we got the results shown in the following figures. And when the training sets are (37) we got the results shown in the following figures. 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 -250 -200 -150 -100 -50 0 50 100 150 time(s) an gl es (d eg ) Fig.15. θ1, θ2 & θ3 versus time Fig. 16. The real and desired paths of the arm -3 -2 -1 0 1 2 3 4 5 -5 -4 -3 -2 -1 0 1 2 x(unit) y(unit) N.N. path desired path y(unit) x(unit) r(unit) θ 3(deg) θ1(deg) θ2(deg) Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ٩ -4 -3 -2 -1 0 1 2 3 4 5 -5 -4 -3 -2 -1 0 1 2 3 x(unit) y( un it) F ig. 17. The configuration of the arm 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 r(unit) er ro r( un it) Fig. 18 .The error versus the distance from the base 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 -250 -200 -150 -100 -50 0 50 100 150 time(s) an gl es (d eg ) Figure 19 θ1, θ2 & θ3 versus time Fig.20 .The real and desired paths of the arm Conclusions The major observations of this work can be summarized as follows: ß For a redundant robot the inverse kinematics has infinite number of solutions, but ß when using the neural network method there is only one desired solution from these infinite ß solutions, since the training session is done using the non-singular set of solution. -4 -3 -2 -1 0 1 2 3 4 5 -6 -5 -4 -3 -2 -1 0 1 2 3 x(unit) y( un it) Fig. 21. The configuration of the arm -4 -3 -2 -1 0 1 2 3 4 5-6 -5 -4 -3 -2 -1 0 1 2 x(unit) y(unit) θ2(deg) θ3(deg) θ1(deg) N.N. path desired path Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ١٠ 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 0 0.05 0.1 0.15 0.2 0.25 r(unit) er ro r( un it) Fig. 22. The error versus the distance from the base ß In conventional methods for the inverse kinematics, one must find the joint space singularity in order to avoid it, but when using the neural network method there is no need to find the joint space singularity because this method gives one desired solution only. ß Since the neural network method is an approximation method, the results show that the obtained solution from the proposed neural network model is depends on the initial weights in training session. i.e. the use of a neural network decreases the repeatability for kinematics solution of the manipulator arm. REFERENCES [1] John J. Craig "Introduction to Robotics Mechanics and Control",1986. [2] Mark W. Spong and M. Vidyasagar, "Robot Dynamic and Control", John Wiley and Sons, Inc., 1989. [3] Alain Liegeois "Robot Technology: Performance and computer-Aided Design", Volume 7, Prentice-Hall, 1985 . [4] Jacobsen, S.C., Iversen, E.K., Knutti, D.F., Johnson, R.T., and Biggers, K.B., "Design of the Utah/MIT Dexterous Hand," in Proc. IEEE Int. Conf. Robotics and Automation, San Francisco, pp. 1520-1532, April 7-10, 1986. [5] E. S. Conkur "Real Time Path Planning and Obstacle Avoidance Algorithms for Redundant Manipulators", Ph.D. Thesis, Department of Mechanical Engineering, University of Bristol, September 1997. [6] Chetan Kapoor and Delbert Tesar "Kinematics Abstraction for General Manipulator Control", Robotics Research Group, The University of Texas at Austin, JJPRC/MERB 1.206, mail Code R9925, Austin, Texas 78712-1100, 1990. [7] Farshid Magami Asi "Analysis of Hyper Redundant Manipulators", M.Sc. Thesis, Mechanical Engineering Department, Villanova University, August 1998. [8] J.Somlo, A.Sokolov, V.Lukanyin "Intelligent Robot Control. The Automation Trajectory Planning", Department of Manufacturing Engineering, Budabist, University of Technology and Economics, 2002. [9] Shigang Yue and Dominik Henrich "Point-to-Point Trajectory Planning of Flexible Redundant Robot Manipulators Using Genetic Algorithms", Embedded Systems and Robotics (RESY), Informatics Faculty, University of Kaiserslautern, D-67653 Kaiserslautern, Germany, 2001. [10] Javier de Lope, Telmo Zarraonandia, Rafaela Gonzalez-Careaga, and Dario Maravall "Solving the Inverse Kinematics in Humanoid Robots: A Neural Approach", Department of artificial Intelligence, Faculty of Computer Science, University of Dr. Bahaa Ibraheem Kazem /Al-khwarizmi Engineering Journal ,Vol.3, No.1, PP 1-11 (2007) ١١ Politecnica de Madrid, Campus de Montegancedo, 28660 Madrid, Spain, 2004. [11] Jack M. Zurada "Introduction to Artificial Neural systems", Jaico Publishing house, 1996. الحل العكسي لذراع انسان الي متعدد زوایا الوصول بأستخدام الشبكات العصبیة الدكتور بھاء ابراھیم كاظم الباحث سامر یحیى ھادي قسم ھندسة السیطرة والنظم قسم ھندسة المیكاترونكس الجامعة التكنولوجیة جامعة بغداد –كلیة ھندسة الخوارزمي :الخالصة ل ذراع الی ة ) inverse kinematics solutions( م ن الحل ول العكس یة (infinity)ھنال ك ع دد غی ر منت ھ لذلك استخدمت طریقة الشبكھ العص بیھ , (conventional methods) باستخدام الطرق التقلیدیھ ) (redundant armمطولة (neural network technique) إلیجاد حل واحد مرغوب بھ)one desired solution (من ھذه الحلول . inverse kinematics(إلیج اد الحل ول العكس یة (DNNM) مزدوج ة حی ث اس تخدم ف ي ھ ذه البح ث ش بكھ عص بیھ solutions ( ل ذراع تتك ون م ن ثالث ة قط ع تتح رك جمیعھ ا ف ي س طح واح د)three links redundant planar robot .( إن لمرحل ة الت دریب مزالمستخدمة ف ي ھ ذا العم ل أظھ رت كف اءة عالی ة ف ي تقلی ل الوق ت ال ال (DNNM)ألشبكھ العصبیة المزدوجة )training .( ق د (DNNM)ألش بكھ العص بیة المزدوج ة outputs)(عل ى مخ ارج training sets) (إن تأثیر عدد مجموعات التدریب ق د تزی د عن دما یض اعف end effector) (و أظھرت النتائج بأن الدقة في إیج اد موق ع نھای ة ال ذراع , تم دراستھا في ھذا العمل . training sets) (مجموعات التدریب عدد ق د ت م دراس تھا ف ي ھ ذا العم ل point-to-point trajectory planning method)(إن طریقة إیجاد المسار بین نقطت ین . على الدقةtraining sets) (كذلك تم دراسة تأثیر تغیر عدد مجموعات التدریب