44-59 Al-Khwarizmi Engineering Journal,Vol. 11, No. 4, P.P. Hexapod Robot Static Stability Enhancement using Genetic Firas A. Raheem *,**Department of (Received Abstract Hexapod robot is a flexible mechanical robot with six legs. It has the ability to walk over terrain. The hexapod robot look likes the insect so it has the same gaits. These gaits are statically stable at all the times during each gait in order not to fall with three or more legs continuously contacts with the ground. The safety static stability walking kinematics are derived for each hexapod R2010a for all gaits and the geometry in order to derive the equations of the sub hexapod’s leg. They are defined as the sub with each other and they are useful to keep the legs stable from falling during each gait. A smooth gait was analyzed and enhanced for each hexapod’s leg in two phases, stance phase and swing phase. two approaches first, the modified classical stability margins. In this approach, the range of stability margins is evaluated for all gaits. The second method is called static stability by getting the best stability margins for hexapod robot planning of hexapod robot with smaller error than the first approach and with better new stable coordinates of legs tips than the first method. In addition, the second approach is useful for getting the better new stable center body coordinates than center body coordinates in the first approach of hexapod robot. Keywords: Kinematics, Stability Margin, 1. Introduction The hexapod robots are mechanical vehicles that walk with six legs; they have attracted considerable attention in recent decades. There are several benefits for hexapods rover efficient one to maintain for statically stable static on three or more legs, it has a great deal of flexibility in how it can move [1]. difficult problem of generation and control of the sequences of placing and lifting legs such that any instant body should be stable and moving from one position to other. The gait is defined as generation and sequences of legs during the hexapod motion [2]. Hexapod robot looks like insect so it has the same gaits [1]. The of hexapod are: Wave, Ripple, and Tripod gait [3]. The GA is determined the optimal movement Khwarizmi Engineering Journal,Vol. 11, No. 4, P.P. 44- 59 (2015) Hexapod Robot Static Stability Enhancement using Genetic Algorithm Firas A. Raheem* Hind Z. Khaleel** of Control and Systems Engineering / University of Technology *Email: dr.firas7010@yahoo.com **Email: hhindzuhair@yahoo.com (Received 22 March 2015 ; accepted 30 June 2015) is a flexible mechanical robot with six legs. It has the ability to walk over terrain. The hexapod robot look likes the insect so it has the same gaits. These gaits are tripod, wave and ripple gaits. Hexapod robot needs to stay times during each gait in order not to fall with three or more legs continuously contacts with static stability walking is called (the stability margin). In this paper, for each hexapod’s leg in order to simulate the hexapod robot model walking for all gaits and the geometry in order to derive the equations of the sub-constraint workspaces for each hexapod’s leg. They are defined as the sub-constraint workspaces volumes when the legs are moving without collision with each other and they are useful to keep the legs stable from falling during each gait. A smooth gait was analyzed and enhanced for each hexapod’s leg in two phases, stance phase and swing phase. The propose the modified classical stability margins. In this approach, the range of stability margins is evaluated for all gaits. The second method is called stability margins using Genetic Algorithm (GA) the best stability margins for hexapod robot and these results are useful to get best stable path planning of hexapod robot with smaller error than the first approach and with better new stable coordinates of legs tips first method. In addition, the second approach is useful for getting the better new stable center body coordinates than center body coordinates in the first approach of hexapod robot. argin, Workspace, Genetic Algorithm and Hexapod Robot. robots are mechanical vehicles that walk with six legs; they have attracted considerable attention in recent decades. There are s rover such as: efficient one to maintain for statically stable static on three or more legs, it has a great deal of flexibility in how it can move [1]. There is a generation and control of the sequences of placing and lifting legs such that at any instant body should be stable and moving from one position to other. The gait is defined as generation and sequences of legs during the robot looks like The three gaits e, Ripple, and Tripod gait is determined the optimal movement by the hexapod leg for walking robot with three degrees of freedom, with higher positioning precision By using an Analytical Hierarchy Process [4]. The stability of problem to maintain it from fall during its walking with using the (GA) in order to get the optimal movement. Hexapod simulation with a used to determine the robot's movements for generating chromosomes which are created from repeated sequence of static leg positions, the fitness function equation using the main factor stability and efficiency [5]. The objective function is used as the stability margin to find optimal walking gaits for an 8-legged robot as in [6]. In this paper the main problem is when hexapod robot walking and may be fall down if the legs are not constraints so the are analyzed, one that called the Al-Khwarizmi Engineering Journal (2015) Hexapod Robot Static Stability Enhancement using Genetic Hind Z. Khaleel** Technology is a flexible mechanical robot with six legs. It has the ability to walk over terrain. The hexapod robot . Hexapod robot needs to stay times during each gait in order not to fall with three or more legs continuously contacts with . In this paper, the forward and inverse simulate the hexapod robot model walking using MATLAB constraint workspaces for each es when the legs are moving without collision with each other and they are useful to keep the legs stable from falling during each gait. A smooth gait was analyzed The proposed work focused on the the modified classical stability margins. In this approach, the range of stability margins is stability margins using Genetic Algorithm (GA) that enhanced the and these results are useful to get best stable path planning of hexapod robot with smaller error than the first approach and with better new stable coordinates of legs tips first method. In addition, the second approach is useful for getting the better new stable center body obot. leg for walking robot with three degrees of freedom, with higher positioning precision By using an Analytical Hierarchy The stability of hexapod is a main problem to maintain it from fall during its walking the (GA) in order to get the optimal simulation with a (GA) are used to determine the robot's movements for generating chromosomes which are created from a repeated sequence of static leg positions, the fitness function equation using the main factor stability and efficiency [5]. The objective function is used as the stability margin to find optimal legged robot as in [6]. er the main problem is when robot walking and may be fall down if the legs are not constraints so the two approaches one that called the modified Firas A. Raheem classical stability margins is depended on according to constraints of each leg in order fall and the other approach is called margins enhancement using Genetic Algorithm is based on the stable ranges values that getting from first approach. The Genetic Algorithm is used to get the best stability margins and these results useful to get best stable path planning robot. 2. Modeling of Hexapod Robot The legged locomotion verities by verity of usual terrain and it presents a set of difficult problems (foot placement, obstacle avoidance, load distribution, common stability) which must be taken into account both in mechanical construction of vehicles and in development of control strategies [7]. Besides that, these issues are using models that mathematically explain the verities of situations and for that; th modeling becomes a practical tool in understanding systems complexity and for testing and simulating diverse control approaches The robot structure considered has (6) identical legs and each leg has (3) degree of freedom, in addition to that, all the related points for each joint have been put on the model, the legs numbering as shown in Figure 1, robot’s coordinate o (xo, yo, zo). Fig. 1. Hexapod robot structure The z-axis pointing up, the x forward and the y-axis pointing left to right hand rule. Hexapod robot consisting of two types, one is forward kinematic and its inverse, below will discuss in deta each type of kinematic. Al-Khwarizmi Engineering Journal, Vol. 11, No. 45 is depended on f each leg in order not to fall and the other approach is called stability using Genetic Algorithm is that getting from The Genetic Algorithm is used to these results are path planning of hexapod Modeling of Hexapod Robot The legged locomotion verities by verity of usual terrain and it presents a set of difficult problems (foot placement, obstacle avoidance, common stability) which must be taken into account both in mechanical construction of vehicles and in development of . Besides that, these issues are using models that mathematically explain the verities of situations and for that; the robot modeling becomes a practical tool in understanding systems complexity and for testing ting diverse control approaches [8]. The robot structure considered has (6) identical legs and each leg has (3) degree of freedom, in all the related points for each joint have been put on the model, the legs 1, robot’s center robot structure. axis pointing up, the x-axis pointing and according robot modeling consisting of two types, one is forward kinematic and its inverse, below will discuss in details for 2.1. Forward kinematics for One Leg hexapod Robot The successful design of a legged robot depends to a large amount on the leg design chosen. Since all aspects of walking are ultimately governed by the physical limitations of the leg, it is important to select a leg that will allow a maximum range of motion a unnecessary constraints on the walking. three-revolute kinematical chain been chosen for each leg mechanism in order to imitate the leg structure as shown in Fig direct geometrical model for each leg mechanism is formulated between the moving frame oi(xi,yi,zi) of the leg base, where i=1… fixed frame o (xo,yo,zo) [9]. Fig. 2 .Model and coordinates frame for leg kinematics. In this paper, the BH3- is taken as a case study lengths of the hexapod’s leg = (5.7 cm), L3 = (10.8 cm frame starts with link (0) which is the robot body where the leg is jointed to; link (1) is the coxa, link (2) is the femur and link (3) is the tibia. Legs are distributed symmetrically around the axis in the direction of motion ( The general form for the transformation matrix from link (i) to link (i-1) using Denavit Hartenberg parameters is given in the d1 R1 θ1 z1 L1 x0 yo zo xc leg base θ3 Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) rd kinematics for One Leg of successful design of a legged robot depends to a large amount on the leg design chosen. Since all aspects of walking are ultimately governed by the physical limitations of the leg, it is important to select a leg that will allow a maximum range of motion and not inflict onstraints on the walking. The revolute kinematical chain (R1, R2, R3) has been chosen for each leg mechanism in order to imitate the leg structure as shown in Figure 2. A direct geometrical model for each leg mechanism formulated between the moving frame ) of the leg base, where i=1…6, and the [9]. l and coordinates frame for leg -R hexapod robot model case study of hexapod robot. The ’s leg are: L1 = (2.9 cm), L2 10.8 cm) [10]. The robot leg frame starts with link (0) which is the point on the robot body where the leg is jointed to; link (1) is the coxa, link (2) is the femur and link (3) is the tibia. Legs are distributed symmetrically around direction of motion (x in this case). The general form for the transformation matrix ) using Denavit Hartenberg Eq. 1 [9,11]: R2 x1 L2 R3 L3 x3 z3 x2 z2 y0 θ2 Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 46 T���� = �cos θ� − sin θ� cos α�sin θ� cos θ� cos α� sin θ� sin α� a� cos θ�−cos θ� sin α� a� sin θ�0 sin α�0 0 cos α� d�0 1 � …(1) The transformation matrix is a series of transformations: 1. Translate di along zi-1 axis. 2. Rotate θ�about zi-1 axis. 3. Translate a� about xi-1 axis (a�= Li for i=1...3). 4. Rotate α� about xi-1 axis. The overall transformation is obtained as a product between three transformation matrixes: T�������� = T��������� T����� ���� … "2$ Considering Figure 2 and using Eq. 2 the coordinates of the leg tip are: x = cosθ� ∗ "L� + L) ∗ cosθ) + L*∗ cos"θ) − θ*$$, y = sinθ� ∗ "L� + L) ∗ cosθ)+ L* ∗ cos"θ) − θ*$$, z = d� + L) ∗ sinθ)+ L* ∗ sin"θ) − θ*$ … "3$ Where: d1 is the distance from the ground to the coxa joint. Li are the lengths of the leg links. 2.2. Inverse Kinematics using Geometric Approach The inverse kinematics problem consists of formative the joint angles from a given position and orientation of the end frame. The solution of this problem is significant in order to transform the motion assigned to the end frame into the joint angle motions matching to the desired end frame motion. The goal is to find the three joint variables θ1, θ2, and θ3 corresponding to the desired end frame position. The end frames orientation is not a matter, where only paying attention in its position [9]. Fig. 3 . Illustrations for solving inverse kinematics. Using Eq. 3 and considering the following constraints: all joints allow rotation only about one axis, femur and tibia always rotate on parallel axes, and the physical limitation of each joint can determine the joint angle. The coxa joint angle can be found using the following function as can be seen from Figure 3 A. θ� = tan�� 0y�x�1 … "4$ In order to determine the other two angles a geometrical approach is considered. The leg tip coordinates were transformed to coxa frame using the transformation matrix below: T��������� = 0"R��������� $ −"R��������� $4 ∗ d���������0 1 1 … "5$ The angle θ) of the femur servo position can be derived directly from the triangle Figure 3 B. θ) = φ − φ� … "6$ The angle φ� is the angle between the x-axis and line a and can be calculated with the following function: φ� = tan�� 0y*x*1 … "7$ Where x3 and y3 are the leg tip coordinates in coxa frame. The law of cosine results is applied: φ = cos�� 9L)) + a) − L*)2 ∗ L) ∗ a : … "8$ Where: a = <=*) + >*) … "9$ From the Eq. 6, the femur angle can be found from[9]: L Leg tip x1, y1 y Femur joint Coxa joint Tibia joint L2 θ* θ) φ* φ� x3,y3 a A B y x x φ Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 47 θ) = cos�� 9L)) + a) − L*)2 ∗ L) ∗ a :− tan��"y*, x*$ … "10$ By applying the law of cosines, the φ* angle is found: φ* = cos�� 9L)) + L*) − a)2 L) ∗ L* : … "11$ Considering Figure 3 B, the @* can be found as follows [9]: θ* = π − φ3 … "12$ 3. Workspace of Hexapod’s Leg In this paper the hexapod's leg workspace has been computed and analyzed. Hexapod's leg workspace can defined as the set of reachable points by the end-effector for each foot. These points (positions) depended on the leg orientation (the mechanical limits of the joints). The mechanical limits of the joints restrict leg motion and are a major factor to consider when developing walking algorithm for a hexapod module. The working volumes for each leg are identical because each leg of hexapod has the same geometrical configuration and joint limits; the analyzed of the two approaches to evaluate the constraint workspace for BH3-R hexapod robot [10]. The limits of the joint variables for a representative one leg are shown in Table 1 [10]. Table 1. The range of angles for one hexapod’s leg [10]. Link Name The range of one robot’s leg angle in degree Coxa −90 < @� < 90 Femur −45 < @) < 90 Tibia 0 < @* < 135 These joint variable limits, then, separate the reachable area from the unreachable area. Reachable areas move with the body. The region included within the reachable area is known as the unconstrained working volume (UWV). The constrained working volume (CWV) is defined as a subset of the original working volume, for each leg, that ensures static stability. Therefore, the (CWV) sets soft limits for each leg so as to exclude points from the working volume that may lead to instability. In our case, the working volume is also constrained to prevent leg collisions. An excluded area for hexapod's legs, then, is that part of the reachable area where, if a foot were placed there, instability or leg collision might result. Fig. 4. Flowchart Workspace of hexapod’s leg. Figure 4 shows that the flowchart of workspace. The workspace of robot leg is computed from kinematics and geometry as follow: 3.1. Unconstrained Workspace The unconstrained horizontal workspace of hexapod leg is the reachable areas include the sections in the xy plane around the individual coxas and within the mechanical joint limits, the y plane equal (30 cm). The unconstrained vertical workspace, or z-plane reachable area, depends on the height of the hexapod’s center-of-body above the terrain is (5.5 cm). To define the maximum unconstrained vertical workspace, if a leg were extended to its fullest, the added lengths of radius body (13.75 cm), coxa (2.9 cm), femur (5.7 cm), and tibia (10.8 cm) y- plane would equal (30 cm). The minimum unconstrained vertical workspace, If a leg were lack extent to its fullest, (i.e θ* = 1350), the y- plane would equal (14.7 cm) while the z-plane equals to (9 cm). 3.2. Constrained Workspace The calculations of CWV results are used for six basic constraints: • the height (z = plane) from the ground to the CB (center body of robot) = (10.8 cm) is fixed for minimum, maximum reach, the vertical maximum Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 48 reach equal (24.25 cm) if θ* = 800 and minimum reach equal (21 cm) if θ* = 97o, • the suitable posture of robot = (22.35 cm) if θ* = 90o, • The terrain is flat, • The legs are not allowed to collide or overlap, and • The horizontal workspace of hexapod leg is the reachable areas include the sections in the xy plane around the individual coxas, y-plane = 24.25 cm and within the mechanical joint limits but in this case limit joint (half range of coxa angle is taken in order not to the legs collide) so the range is "−45 < θ� < 45$ degree. Another approach for constrained workspace is derived, the more details in [12], [13]. For the hexagonal model the mathematically Eq. 13 for the radius of the annulus is : r���) = "r��D + Q$) + F�) ∗ PH) … (13) Where: r��� , r��D, Q, P defined by Figure 5. Fig. 5. The relationship between the reachable area and annuls. And the rectangular area is the reachable area of each leg of robot, for our hexapod robot rmax = (10.5 cm) from coxa joint. Added the length of center robot (13.75 cm), rmax = (24.25 cm). The center of leg tip point is (22.35 cm) that it is equal to the posture robot in method1 above comparing between two constraints workspaces methods are found that the maximum reaches of the leg are equal for our hexapod robot. 4. Modified Classical Stability Margins Analysis Approach of Hexapod Robot The first gait of the hexapod robot is the tripod gait. In this gait the three legs stay on the ground (support pattern) while the other legs are on the air. The analysis of static stability depended on the Eq. 14 (the triple equation in the Figure 6) [14] that only computes the S1 where S2 and S3 are evaluated from the same pervious equation but with changing the coordinates of legs for each S1, S2 as in the Figure 6 of three triangles and there are two conditions to set the robot stable first if S1, S2 and S3 are >= zero, the tripod is considered stable other, the tripod is considered unstable more details in [14]. From the definition of “stability margin,” (sm), is the shortest distance from the vertical projection of the center of robot to the boundaries of the support pattern in the horizontal plane [15] the proposed method is explained below: In Figure 6 L1 is derived in the Eq. 16 (the distance line between two points) and the same thing of L2 is computed, L3 for other legs, each L is considered as a base of the one triangle while the areas of the S1, S2 and S3 are previously computed so that the stability margin is the shortest perpendicular distances from L1, L2 and L3 to the center of robot (H1, H2, H3 respectively). H1 is computed as Eq. 17 as well as the H2, H3 are computed in the same manner. the stability margins are computed and analyzed for all cases of the hexapod legs motion for three gaits (tripod, ripple and wave) for example the support pattern of tripod when robot lifts legs (1, 3 and 5) : Fig. 6. The stability analysis for the tripod gait when legs (2, 6 and 4) on the ground and legs (1, 3 and 5) on the air. The triple equation of the Figure 6 is: S� = �) J 1 1 1xKL xM x)yKL yM y)J . . . "14$ The support pattern CB L1 L2 L3 S1 S2 S3 Leg 2 Leg 6 Leg 4 H1 H3 H2 Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 49 Where (xKL, yKL) the coordinate of center body, (x), y)) the coordinate of Leg 2, (xM, yM) the coordinate of Leg 4. The simplification of the Eq. 14 : S� = �) O"xM − xKL$"y) − yKL$ − "x) −xKL$P"yM − yKL$QR … "15$ L� = sqrt ""x) − xM$) + "y) − yM$)$ … "16$ Where L1 is the distance between two points H� = 2 ∗ 0S�L�1 … "17$ From Figure 6 the stability margin are computed as: sm� = min"H� , H), H*$ … "18$ sm� is the stability margin of the support pattern of legs (2, 4 and 6) similarly, the sm) is derived for other three legs when (1, 3 and 5). Besides that, Eq. 18 is derived for the other gaits of robot (wave and ripple). 5. Walking, Mechanism of Leg Motion and Path Planning of Hexapod Robot The mechanism of leg motion is very complex problem that each leg is forward and back motion. It derived from insect motion that has two phases: swing (the leg in the air) and stance (the leg in the ground) phases [3]. The equations of motion in [16] are derived for two phases. The walking of hexapod robot is developed by combing the stance phase [16] explained by Eq. 19 and the swing phase [17] as in Eq. 20 to get our modified smooth gait for one hexapod’s leg as below: x�W� = x� − v ∗ T ∗ cos"ϕ$, y�W� = y� − v ∗ T ∗ sin"ϕ$ …(19) Where x�, y� the coordinates of leg tip derived from the forward kinematic, ϕ is the direction of motion, T is the period required to complete one cycle and changes during type gait and v describes how many centimeters per gait cycle the hexapod robot should move. The equations in swing phase are: x�W� = 2 ∗ xZ[ ∗ dt� �\"1 − cos 0 ] ^ _`ab1$, y�W� = 2 ∗ yZ[ ∗ dt� �\"1 − cos 0 ] ^ _`ab1$, z�W� = h ∗ "1 − cos 0 ] ^ _`ab1$ …(20) xZ[ , yZ[ are the speed of the hexapod robot’s truck in x and y directions, dt� �\ is the time duration for each step and h is the height of each step. The movement of the center of body that moves from start point to the goal point so the new center point [14] is calculated as: x��W� = x�� + d ∗ cos"ϕ$, y��W� = y�� + d ∗ sin"ϕ$ …(21) Where d is the step size. The path planning start from point (0,0) cm and end with goal point (500,0)cm for the straight line. 6. Stability Margins Enhancement using Genetic Algorithm The results of sequences of three main gaits for hexapod robot are found the range values for the stability margins as mentioned above. Each gait of hexapod robot, has the sequence of gait such as the tripod gait has two sequences, the first sequence lifts legs (1, 3 and 5) where the legs (2, 4 and 6) on the ground. The second sequence lifts legs (2, 4 and 6) where the legs (1, 3 and 5) are on the ground. In the proposed method, an intelligent method which is (GA) has been applied to find the best stability margin during each sequence in each gait. While modified classical stability margins analysis method which used to find the range values for stability margins is considered as constraints for Genetic Algorithm to find the best stability margins based on these constraints. Also, the genetic algorithm has been applied to find the best positions of legs tips as described below: A. Parameters Initialization of Genetic Algorithm The initial populations for genetic algorithm are the coordinates of each leg’s tip (xi, yi) and the coordinates of center body (xCBi, yCBi) while the (zi) is constant (the motion of hexapod robot on the flat plane). Chromosomes (individuals) represent the solutions for optimization problem. In the proposed work, the better results of new stable population are evaluated. These results are considered as initial coordinate (xi, yi) for walking of the hexapod robot. These stable positions are repeated till hexapod robot reaches to the goal point. The size of genes in each chromosome is various according to the type of gait (support pattern for each sequence) for example the size of Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 50 chromosomes equals to eight variables in tripod gait. The first sequence in tripod gait when lifting legs (1, 3 and 5) where legs (2, 4 and 6) on the ground have been calculated with center body coordinates as the following formula: chromosome = gx� y� x) y) xh yh xM yMi. The other sequences of hexapod gaits types are formulated as in the above example and according to each gait. B. Fitness Function: The fitness function of GA is used as minimization of the cost function (stability margins) as derived previously, Where each sm =min"H�, H), … , Hh$ and the Hi defined in section (4). For example ,the fitness function of tripod gait equals to stability margin (sm) is selected according to the each sequence of each gait such as the Eq. 18 The idea of proposed approach is different from the approach in [17]. The difference is that the researchers in [17] that the minimum fitness stability margin is squared value (fitness function =sm2) in order to get the high values of stability margin (sm), while in proposed work, the minimum fitness stability margin is (fitness function =sm) and all values are high and within the constraints of legs tips without need to square the stability margin (sm). All cases of our approach results of the stability margin are within the ranges of stability margins from modified classical analysis method. In the GA, the best stability margins are evaluated while in the modified classical approach the ranges of the stability margins are obtained. The all cases of the fitness equations for three gaits are derived from the modified classical stability method where in each sequence there is fitness function as an example for Eq. 18 is the fitness function of tripod gait for the first sequence (where the robot lifting legs (1, 3 and 5) and legs (2, 4 and 6) are on the ground). C. Crossover Operation The main processing of crossover is to get two parents of coordinates of leg’s tips and the center body coordinates and producing from them the children. Crossover operator is applied to produce a better offspring (children). D. Mutation Operation After the crossover operation, the output string from crossover is subjected to mutation process. Fig. 7. Proposed flowchart of GA. 7. Flowchart of Proposed Genetic Algorithm After complete the modified classical method, below will describe the developed method using Genetic Algorithm. In the Figure 7 shows that flowchart of proposed Genetic Algorithm. It has consists of steps where described as below: • Defined the variables which determined the leg’s tip of hexapod robot (chromosomes). • Generate the coordinates of leg’s tip and center point of body (chromosomes). • Find the cost function (stability margins equations as in section (4) to get the best stability margin for each sequence for each gait. • Select mates, mating, and mutation. • Convergences condition, if the generation <= nG (100 generations). • Done. 8. Simulation Results The simulation results consist of two approaches where illustrated as below: Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 51 8.1. The Modified Classical Stability Margins Analysis of the stability margins above for three gaits (ripple, wave and tripod) are simulated for each gait within the steps as below: a- The wave gait cases 1 2 3 4 5 6 Fig. 8. The configuration of hexapod robot’s leg of sequences of wave gait. Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 52 b- The ripple gait cases 1 2 3 4 Fig. 9. The configuration of hexapod robot’s leg of sequences of ripple gait. c- The tripod gait cases 1 2 Fig. 10. The configuration of hexapod robot’s leg of sequences of tripod gait. The figures (8-10) show that the configurations of hexapod robot’s legs for three gaits. The yellow lines indicated to the support patterns. From support patterns the (sm) is evaluated for each sequence in every gait and the simulation results of all stability margins are described in simulations below: Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 53 (a) (b) Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 54 (c) Fig. 11. Minimum and maximum stability margins for, (a) ripple gait, (b) tripod gait, and (c) wave gait. In Figure 11 shows that the stable range of stability margins for three gaits and these values are considered the constraints to the genetic algorithm of our proposed work. 8.2. Best Stability Margins using Genetic Algorithm From the study in the section (4), the results of best stability margins are shown in below: Fig. 12. The best fitness value for tripod gait when the legs (2, 6, and 4) are on the ground and lifting legs (1, 3 and 5). Fig. 13. The best fitness value for tripod gait when the legs (1, 3 and 5) are on the ground and lifting legs (2, 6 and 4). 0 10 20 30 40 50 60 70 80 90 100 3.935 3.936 3.937 3.938 3.939 Generation F it n e s s v a lu e Best fitness: 3.9356 Average Distance Between Individuals Best f itness 0 10 20 30 40 50 60 70 80 90 100 5.1 5.2 5.3 5.4 Generation F it n e s s v a lu e Best fitness: 5.1304 Average Distance Between Individuals Best fitness Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 55 Fig. 14. The best fitness value for ripple gait when the legs (2, 3, 5, and 4) are on the ground and lifting legs (1, and 6). Fig. 15. The best fitness value for ripple gait when the legs (4, 1, 2, 3 and 6) on the ground and lifting leg (5). Fig. 16. Best fitness value for ripple gait when the legs (1,2,3,6 and 5) on the ground and lifting leg (3 and 4). Fig. 17. The best fitness value for ripple gait when the legs (1, 3, 6, 5 and 4) on the ground and lifting leg (2). Fig. 18. The best fitness value for wave gait when the legs (2, 3, 6, 5 and 4) on the ground and lifting leg (1). Fig. 19. The best fitness value for wave gait when the legs (1, 3, 6, 5 and 4) on the ground and lifting (2). 0 10 20 30 40 50 60 70 80 90 100 6.26 6.265 6.27 6.275 6.28 Generation F it n e s s v a lu e Best fitness: 6.2614 Best f itness 0 10 20 30 40 50 60 70 80 90 100 12 13 14 15 Generation F it n e s s v a lu e Best fitness: 13.1925 Average Distance Between Individuals Best fitness 0 10 20 30 40 50 60 70 80 90 100 8.48 8.5 8.52 8.54 Generation F it n e s s v a lu e Best fitness: 8.4736 Best f itness 0 10 20 30 40 50 60 70 80 90 100 12.55 12.6 12.65 12.7 12.75 Generation F it n e s s v a lu e Best fitness: 12.5673 Best fitness 0 10 20 30 40 50 60 70 80 90 100 6.6 6.62 6.64 6.66 Generation F it n e s s v a lu e Best fitness: 6.6121 Best fitness 0 10 20 30 40 50 60 70 80 90 100 13.98 13.99 14 14.01 14.02 Generation F it n e s s v a lu e Best fitness: 13.9895 Average Distance Between Individuals Best f itness Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 56 Fig. 20. The best fitness value for wave gait when the legs (1, 2, 6, 5 and 4) on the ground and lifting leg (3). Fig. 21. The best fitness value for wave gait when the legs (1, 2, 3, 6 and 5) on the ground and lifting leg (4). Fig. 22. The best fitness value for wave gait when the legs (1, 2, 3, 6 and 4) on the ground and lifting leg (5). Fig. 23. The best fitness value for wave gait when the legs (1, 2, 3, 5 and 4) on the ground and lifting leg (6). The above Figures (12 - 23) show that the best stability margins for each sequence in each gait and all the stability margins are within the range of constraints that described in classical stability margins analyses method. The analysis equations of Eq. 21 used of find the next points of the hexapod center body and the errors center body of the path planning for two approaches is shown in Table 2, below: Table 2, Shows that the errors of two approaches modified classical stability margins and stability margins Enhanement using GA. Errors path planning of modified classical stability margins Errors path planning of stability margins Enhancement using GA 1- Tripod gait has less error value equals (8.3630e-004) cm. 2- Wave gait has less error value equals (0.0023) cm. 3- Ripple gait has great error value equals (0.0520) cm. 1- Tripod gait has less error value equals (2.3590e-004) cm. 2- Wave gait has error value equals (0.0012) cm. 3- Ripple gait has great error value equals (0.0196) cm. The genetic algorithm here works as off-line and getting the new stable coordinates of legs tips of hexapod robot (new populations) before robot start walking .From these coordinates are selected, the best points of the center body in (x , y) plane are calculated according to the best stability margins values. 0 10 20 30 40 50 60 70 80 90 100 5.46 5.48 5.5 5.52 Generation F it n e s s v a lu e Best fitness: 5.4661 Average Distance Between Individuals Best f itness 0 10 20 30 40 50 60 70 80 90 100 12.69 12.695 12.7 12.705 12.71 Generation F it n e s s v a lu e Best fitness: 12.6927 Best fitness 0 10 20 30 40 50 60 70 80 90 100 6.8 6.9 7 7.1 7.2 7.3 Generation F it n e s s v a lu e Best fitness: 6.883 Best fitness 0 10 20 30 40 50 60 70 80 90 100 7.5 7.6 7.7 7.8 Generation F it n e s s v a lu e Best fitness: 7.5258 Best f itness Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 57 9. Conclusion In this paper the stability margins are analyzed for all gaits of hexapod robot in two approaches first is the modified classical approach and second, is the stability margins enhancement using genetic algorithm. In first approach, the range of stability margins values are evaluated for each sequence in every gait where the hexapod walking from start point (0,0) cm to the goal point (500,0) cm. For the second approach, the best stability margins for each sequence in every gait are calculated and the results is useful to get best stable path planning with smaller error than the first approach for three gaits of hexapod robot as in Table 2, above .Also in the second approach and according to the best stability margins values. The better new stable coordinates (positions of legs) are gotten than stable coordinates of first approach. In addition, the better new stable center body coordinates are evaluated than center body coordinates in the first approach Notation di translation along zi-1 axis a� = Li link length about xi-1 axis T���� forward kinematic matrix x, y, z coordinates of hexapod's leg r��� maximum length of leg's workspace r��D minimum length of leg's workspace Q, P lengths of rectangular reachable area S� triple equation H� vertical line from the center point of the robot’s body to the middle of the base (L1) sm stability margin x�W�, y�W� backward smooth motion x�W�, y�W�,z�W� forward smooth motion ϕ direction of motion T period required to complete one cycle d step size xZ[ ,yZ[ are the speed of the hexapod robot’s truck in x and y directions dt� �\ time duration for each step h height of each step x� �W�, y� �W� new center coordinates of hexapod's body xCBi, yCBi center coordinates of hexapod's body v represents speed of how centimeter per gait cycle the robot should move GA Genetic Algorithm Greek Letters θ� rotation angle about zi-1 axis α� rotation angle about xi-1 axis φ� angle between the x-axis and line a 10. References [1] X. Ding, Z. Wang, A. Rovetta and J.M. Zhu, “Locomotion Analysis of Hexapod Robot, Climbing and Walking Robots,” Behnam Miripour (Ed.), 2010. [2] M. I. Ahmad, D. K. Biswas and S. S Roy, “Gait Analysis of eight legged robot,” International Journal of Mechanical and Industrial Engineering (IJMIE), ISSN No. 2231 – 6477, Vol. 2, Issue-2, 2012. [3] B. J., “Biologically Inspired Approaches for Locomotion, Anomaly Detection and Reconfiguration for Walking Robots,” Springer-Verlag Berlin Heidelberg, 2011. [4] D. A. Bucur, S. A. Dumitru, “Genetic Algorithm for Walking Robots Motion Optimization,” Institute of Solid Mechanics of the Romanian Academy 15 C-tin Mille, Sector 1, Bucharest, Romania, 2011. [5] J. Currie, M. Beckerleg, J. Collins, “Software Evolution Of A Hexapod Robot Walking,” 15th International conference on Mechatronics and Machine Vision in Practice (M2VIP08), 2008. [6] B.L. Luk, S. Galt and S. Chen, “Using Genetic Algorithms to Establish Efficient Walking Gaits for An Eight-Legged Robot,”, 2001. [7] K. W., D.B. and A. K., “Control and Environment sensing system for a six-legged robot,”, Journal of Automation, Mobile Robotics & Intelligent Systems, Vol. 2, No. 3, 2008. [8] J. Barreto, A. Trigo, P. Menezes, Dias J., “Kinematic and dynamic modeling of a six legged robot,” citeseer, 2004. [9] M. O. Sorin, N. Mircea, “Matlab Simulator for Gravitational Stability Analysis of a Hexapod Robot,” The Romanian Review Precision Mechanics, Optics & Mechatronics, 158, No. 39 Mechanics, Optics & Mechatronics, 2011. Firas A. Raheem Al-Khwarizmi Engineering Journal, Vol. 11, No. 4, P.P. 44- 59 (2015) 58 [10] http://www.lynxmotion.com/c-100-bh3- r.aspx, Accessed on 17/11/2013. [11] S. R. J., “Fundamentals of robotics: analysis and control”, ISBN: 0-13-344433-3, Prentice Hall, New Jersey, USA, 1990. [12] R. B. McGhee and G. I. Iswandhi, “Adaptive locomotion of a multilegged robot over rough terrain,” IEEE Trans. Syst., Man, Cybern., vol. SMC-9, no. 4, pp. 176–182, 1979. [13] Stanley Kwok-Kei Chu and Grantham Kwok-Hung Pang, “Comparison between Different Model of Hexapod Robot in Fault- Tolerant Gait,” IEEE Trans. Syst. Man Cybern,—Part A: System and Humans, VOL. 32, NO. 6, November, 2002. [14] Charles Andrew Schue, “Simulation of Tripod gaits for a Hexapod underwater walking machine,” Master’s Thesis, Naval Postgraduate School Monterey, California, June, 1993. [15] S. M. Song and B. S. Choi, “The Optimally Stable Ranges of 2n-Legged Wave Gaits,” IEEE Trans. on system, man, and cybernetics, Vol. 20, No. 4, Jul./Aug., 1990. [16] S. Villumsen, “Modeling and Control of a six legged mobile robot,” Master Thesis, 2010. [17] M. A. Shahriari, K. G. Osguie, A. A. Akbar Khayyat, “Modular Framework Kinematic and Fuzzy Reward Reinforcement Learning Analysis of a Radially Symmetric Six- Legged Robot,” Life Science Journal, 2013. Radially Symmetric Six-Legged Robot,” Life Science Journal, 2013. )2015( 44- 59، 456' 4، ا"2*د11*%$' ا"0/ارز#- ا",+*()' ا"&%$# ا"!زاق �راس ��د 59 �ار�� ا������ ��������د رو��ت ������ام ا���ارز��� ا���������� ! ��� ا �اس &%� ا��زاق ر#�" ( ** )��* �ھ�� زھ� * ا"AB+/"/@)'ا"%?#2' / <>7 ھ+*(' ا">);!ة وا"+78 **،* dr.firas7010@yahoo.com -Cو!BA"Dا *E!F"ا: * hhindzuhair@yahoo.com -Cو!BA"Dا *E!F"ا: ** ا��-,� . 5C>,? ا",H?PB!ا R .H&/ج#B&/@' و ، ا"P/ام 'XYX)ھVه ا"S!4?ت ھ- اN -#?#D$7 ا"S!4'[- ھVه ا"/ر<' 7R اPBc?ق ). MN*R )stability marginاPB)D!ارE' ا"BH?a' اB<# . -O&$" '+#D&!ةأر@K او اM$N !aS اDرض H`/رة QR?S!T و7R اPBc?ق #2?دDت ر(7 وMATLAB R2010a U"VSا",H?/B"ط/ر ا hEا";/ر YA". T 7R>?ب #%&/h# 'N ، - ھVه ا";!stability margins ( .]'PE( ا"&K" '"*2 اDو"M ا";!PE' ا"A()YA)'، ا"M$N p(S!B ط!R 7h(BPE[- ا"K&2 ا"&BP!ح H?(0B*ام ا"0/ارز#)' ا"%)+)' ا"T -B>+^ اD(PB!ارE' ا"stability margins 'BH?aا";!PE' ا"C?a)' (&)^ ب . "KA ا"S!4?ت ) stability margins(<)7 ال K" 7(> Ki]ا M$N ?,"/`4Hstability margins 5)*ة [- ا"4`/ل# es?B+"ه اVت وھ/Hد رو/H?ا m;0H 'S!4$" -;t ر?<# Ki]ا M$N K@رDت ا?E?,+" ة*E*@ ة!PB<# ت?(Xا*Tا M$N 7 ا"4`/لR *> و M"وDا 'PE!;"ا M"وDا 'PE!;"ا h# Ki]ا .U"ذ M"ا ']?uYH ، ^C?S '(C?a"ا 'PE!;"ا -] M"وDا 'PE!;"ا h# Ki]ت ا/H7 ا"!و<@ pS!# ت?(Xا*Tا.