D-T parameters of leg shown in Fig. 5

## 1. Introduction

Walking robots posses capabilities to perform adaptive locomotion and motion planning over unstructured terrains and therefore are in the focus of high interest to the researchers all over the world. However, true adaptive locomotion in difficult terrains involves various problems such as foot-planning, path-planning, gait dynamic stability and autonomous navigation in the presence of external disturbances [1]. There is a large volume of research work that is dedicated to the development of walking robots that exhibit biologically inspired locomotion. In this context, an insect-sized flying robot [2], an ape-like robot [3], an amphibious snake-like robot ACM-R5 [4], for-legged robots like Big Dog and Little Dog, an ant-inspired robot ANTON [5] and LAURON [6], are some well-known examples of bio-mimetic robots. A related study [7] describes an implementation of a neurobiological leg control system on a hexapod robot for improving the navigation of the robot over uneven terrains.

However, the crucial problem that the general approaches suffer is the challenging task of achieving accurate transition between different gaits while maintaining stable locomotion in the presence of external disturbances [1]. In natural rough terrains, prior knowledge of the terrain information is not always available therefore, this chapter aims to make use of virtual reality technology to inspect adaptive locomotion over unknown irregular terrains for possible improvement in gait mobility and stability in the presence of unexpected disturbances.

In order to evaluate and inspect the dynamic characteristics of an adaptive locomotion over an unstructured terrain, it is difficult and time consuming to conduct real-world experiments often. Therefore, virtual prototyping technology serves a prime role that results in better design optimization and allows inspection and evaluation of the mathematical models specifically those which are complicated or impractical to estimate using real prototypes in real-world [16-18]. Virtual Reality Technology provides a rapid method of validating several characteristics of a mathematical model using dynamic simulations for the identification of potential errors in early design stages [8]. Possible defects can be identified and removed by modifying the simulation model itself which is less time consuming and practical if to be performed often. Thus, the complete control algorithm can be analyzed using the simulation model [8].

The chapter is structured as follows: second section describes the mathematical modelling of a hexapod robot using kinematics and dynamics equations. In the third section, gait generation is described for planning cyclic wave and ripple gaits. Fourth section is dedicated to the gait analysis over flat and uneven terrains. Finally, the chapter draws conclusion on the significance of using a simulation-based approach for rapid-prototyping of gait generation methods in multi-legged robots.

## 2. Mathematical modeling and design

The studies conducted in [8] & [9] use SimMechanics software to construct a simulation-based model of a six-legged robot which comprises of several subsystems interconnected to each other as described in Fig. 1. The physical robot is represented using a subsystem known as “plant”. Another subsystem which represents the kinematic engine contains the forward and reverse kinematics of the robot. Other subsystems include a gait generation block and an environment sensing block as shown in Fig. 1. The aforesaid subsystems are further described in the following subsections.

### 2.1. Plant subsystem

The “plant” is shown in Fig. 2 in the form of a block diagram that provides complete information about the mass, motion axes and moments of inertia of the bodies and their subassemblies. Each leg attached to the main body is considered as a 3-degree of freedom serial manipulator which acts as the actuating element in the overall simulation model. Furthermore, the block diagram shows joints to describe appropriate connections between the rigid bodies which provide an opportunity for actuation and sensing. Fig. 3 & Fig. 4 show the respective subsystems of a hexapod robot as investigated in [8, 9].

### 2.2. Kinematics engine

The kinematic model of the robot reported here uses forward and inverse kinematic equations of a 3-DOF serial manipulator to control the foothold in 3D-space. The research studies [8 - 14] describe the mathematical modelling of a 3-DOF leg in 3D space in terms of a forward kinematic model. The details are given in the following subsections.

#### 2.2.1. Forward kinematics

Each leg is modelled as a 3-DOF serial manipulator comprised of three members as: coxa, femur and tibia inter-related using pin joints. The joint connecting the body with the coxa (BodyCoxa-joint) is represented by

i | ||||

0 | 0 | 0 | 0 | |

1 | 90 | 0 | ||

2 | 0 | 0 | ||

3 | 0 | 0 |

Solving (1) yields (2) which can be further simplified to (3).

#### 2.2.2. X-Y-Z (roll-pitch-yaw) body rotations

In order to obtain the position of foothold with reference to robot motion centroid, the body rotations in 3D-space must be brought into consideration. Body rotations (Roll-Pitch-Yaw) representation for orientation is given by (4).

Using general homogenous transformation matrices, the foot location with respect to body coordinate system can be obtained using (4) as given by (5)

Where,

Thus, the forward kinematic model of the leg can be expressed by (6), also investigated in [13].

#### 2.2.3. Inverse kinematics

In order to obtain the inverse kinematics solution, we solve the general homogenous transformation expression for a 3-DOF serial manipulator in 3D-space given by (7) as (8) & (9).

Where,

Solving (8) yields (10)

Comparing

Thus, BodyCoxa joint angle

Solving (9) yields (13)

Comparing

Taking positive squares of both sides of (14) & (15) and summing them-up yields (16).

Where,

Further solving (16) yields:

Where,

Using the trigonometry identities given by (18) & (19), (17) can be further solved to determine CoxaFemur angle as given by (20)

Where,

Dividing (14) by (15) yields (21) which can be further simplified to obtain FemurTibia angle as given by (22)

### 2.3. Robot dynamics

Lagrange-Euler formulation is selected here to derive the dynamics of the robot leg. The Lagrange-Euler equations yield a dynamic expression that can be expressed as given by (23).

In (23), M(q) represents the mass matrix, H incorporates the centrifugal and Coriolis terms, and G(q) is the gravity matrix.

#### 2.3.1. Foothold dynamics

The position of the foothold with respect to BodyCoxa joint motion axis is given by (3). Time derivate of (3) yields velocity of the foothold as given by (24) which can be expressed in form of Jacobean as given by (25)

Time derivate of (25) yields acceleration of the foothold as given by (26)

#### 2.3.2. Femurtibia joint dynamics

The position of the FemurTibia joint with respect to BodyCoxa joint motion axis is given by (27).

Time derivate of (27) yields velocity matrix as given by (28) which can be expressed in terms of Jacobean as (29)

Time derivate of (29) yields acceleration matrix as given by (30) which can be further expressed in form of Jacobean as given by (31).

#### 2.3.3. Coxafemur joint dynamics

The position of the CoxaFemur joint with respect to BodyCoxa joint motion axis is given by (32).

Time derivate of (32) yields velocity matrix as given by (33) which can be expressed in terms of Jacobean as (34).

Time derivate of (34) yields acceleration matrix (35) which can be expressed in terms of Jacobean as (36).

### 2.4. Control algorithm

Dynamics of a robot as given by (23) can be further described using Lagrange-Euler formulations as given by (37).

Where,

The kinetic energy and potential energy of a link can be expressed as given by (38) & (39).

The mass matrix M of the robot leg can be written by assuming the leg as a serial manipulator consisting of three links as given by (40).

The moments of inertia for each link (coxa, femur & tibia) of the leg can be determined from (41), (42) & (43).

The Jacobean terms of (40) can be determined from expressions (44), (45) & (46).

The velocity coupling vector H and the gravitational matrices are given by (47) & (48)

Using desired time-based trajectories of each joint, the robot can be commanded to follow a desired path with the help of a computed torque control law as given by (49)

The error vector “e” is given by (50)

Thus, the computed control law can be described by (51).

## 3. Gait generation

Gait generation is the main topic of investigation in the field of legged locomotion. Mobility and stability are two important factors which require specific attention while planning a gait for locomotion in natural environments. Generally, the gaits found in nature feature sequential motion of legs and the body. A large volume of work [5-14] deals with biologically-inspired gaits to replicate this sequential motion pattern found in insects into real robots. The gaits investigated here are cyclic periodic continuous gaits (wave gait & ripple gait) as investigated in [10 & 12]. Gait generation occurs in the gait planner shown in Fig. 1, where commanded foothold locations and orientations are combined with gait sequences to generate a sequential pattern of footholds in 3D-space. The computed leg-sequential pattern is submitted to the inverse kinematic model to determine appropriate joint angles to achieve the desired location. The motion of each leg is determined by the mathematical model. The sequential patterns of leg-lifts for a 12-step ripple gait and a 19-step wave gait are shown in Fig. 16 while, Fig. 6 shows a pictorial demonstration of the gait generation in simulation model and the actual prototype robot over a smooth flat surface.

SimMechanics provides a diverse library of software sensors to obtain information from the environment. These sensors mainly include rigid-body sensors and joint sensors. As shown in the figure, the sensors subsystem outlines a network of sensors employed at each leg and their respective joints. Sensors attached to the legs are used to obtain the absolute location and orientation of each foothold in 3D-space while the joint sensors provide information about each joint’s linear and angular rates and accelerations. This sensory network acquires the information from each sensor, filters the data to reject noise. Motion planner, uses the feedback to compute corrections between the commanded data and the recorded data. A Butterworth high-pass 6^{th} order digital filter is used to filter the sensor noise.

## 4. Dynamic simulations

The objective of carrying out dynamic simulations is to test the validity of the mathematical model and perform gait analysis over uneven terrains. In order to realize the first objective, the mathematical model is simulated first in forward dynamics mode and then in inverse dynamics mode. The robot is commanded to walk between two fixed points 2 meters apart. Straight line walking is achieved with an attitude control using GPS and Compass sensors feedback. Fig. 7 show respective views of robot straight-line walking achieved over flat surfaces using Microsoft Robotics Studio [15].

### 4.1. Test 1 – Forward dynamics mode

In forward dynamics mode, the objective is to analyze the torques produced at the joints provided each joint is actuated with a motion profile consisting of joint rotation, velocity and acceleration. The robot is steered with a periodic cyclic gait. The footholds planned by the gait generator are passed to the kinematics engine and appropriate joint angles are computed in return. The obtained joint angle profile of each joint is differentiated to compute joint rates and accelerations. Finally, the computed joint motion profiles are fed to the joint actuators to simulate the motion. Joint sensors are used to record the actual torque produced during the entire sequential motion. Actual torques data obtained from the simulation and those determined by the dynamic model are plotted as shown by Fig. 8 (D).

### 4.2. Test 2 – Inverse dynamics mode

In inverse dynamics mode, the objective is to analyze the joint motion profiles provided the joints are actuated using torques. Joint sensors are used to record joint rotations, velocities and accelerations which are then matched with those determined by the dynamic model to study the errors. The comparative representation of actual motion data and desired data is shown by Fig. 8(A), Fig. 8(B) & Fig. 8(C). The close matching of the actual and desired data confirms the validity of inverse model for walking over flat surfaces.

### 4.3. Test 3 – Gait analysis over an uneven terrain

The objective of this test is to conduct a gait analysis in terms of robot speed, joint reaction torques and reaction forces at the foothold during robot-environment interactions.

#### 4.3.1. Reaction forces at the foothold and reaction torques at the joints

In order to study an adaptive gait over an uneven terrain, we must first describe the joint reaction torques due to the reaction forces which arise at the footholds during the leg-terrain interactions.

Considering Fig. 9, the reaction torque about the BodyCoxa joint motion axis can be expressed by (52), further explained by (53) & (54).

Considering Fig. 10, the reaction torque about the CoxaFemur joint motion axis can be expressed by (55), further explained in (56) & (57).

Considering Fig. 11, the reaction torque about the FemurTibia joint motion axis can be expressed by (58), further explained in (59) & (60).

#### 4.3.2. Gait analysis over an uneven terrain

The uneven terrain as shown in Fig. 13 is modelled in Microsoft Robotics Developer Studio. A terrain is modelled with random regions of depression and elevation so that the gait can be analyzed under the influence of unexpected disturbances. The robot is steered between defined waypoints and the joints torques are investigated with different gait patterns. Fig. 12(A) shows a comparative representation of torques computed by our mathematical model and those obtained through joint sensors provided by the simulation engine. The results shown in Fig. 12 are those obtained when the robot was steered with a fast-speed ripple gait. As evident from the forces plot shown in Fig. 12(B), friction force is close to the normal reaction point at some points and exceeds the normal reaction force at some other points which signifies that the robot experienced significant degrees of slip/drift which walking through those regions of the terrain. As a consequence, the mathematical model failed to determine adequate torques at the joints to counter the drift each foothold is experiencing while the locomotion. Therefore, the fast-speed ripple gait was found inefficient over an unexpected terrain due to the non-uniform distribution of payload about the two sides of the robot body in its support pattern.

In the second run, the robot was steered with a slow-speed wave gait in which each leg is lifted whereas the remaining supports the body. This confirms an even sharing of payload on either side of the robot. The results of this simulation run are shown in Fig. 14 and Fig. 15. As evident from the Fig. 15(B) that the friction force data never exceeds the normal reaction force which confirms that the robot never experienced a slip/drift over the same track when using the wave gait. As a consequence, close matching of computed torques and the sensed torques during this simulation run as shown by Fig. 15(A) signifies the validity of our proposed mathematical model to realize adaptive walking over uneven terrains at slow speeds. Additional simulation results are exhibited in Fig. 14 which portrays the track of the centre of gravity of the robot and its speed profile. Fig. 15(C) & Fig. 15(D) show the profiles of body rotation angles and rates about x, y & z-axes. As evident from the Fig. 15(C), the roll and pith rotations of the body are minimal which confirms the validity of our attitude control for maintaining the body flat over an unknown irregular terrain.

## 5. Conclusions

This chapter outlines a study on signifying the importance of employing virtual reality technology in realizing legged locomotion over unknown irregular terrains. The objective is to emphasize that how virtual reality technology can serve a prime role in the improvement of legged locomotion by performing gait analysis over unstructured terrains which is often time intense and complex to conduct in real-worlds. The objective has been achieved by analyzing an adaptive gait of a six-legged hexapod robot with two unique support patterns namely: ripple and wave. A complete mathematical model of the robot is presented at the start of the chapter to equip the reader with the basic knowledge of forward and reverse kinematic equations used in robot kinematics. Robot dynamics is further described with a computed-torque control technique to incorporate the forces and moments at the feet. To validate the proposed mathematical model, simulation tests are first carried out in a constraint simulation environment using SimMechanics and results of mathematical model are compared with those obtained from on-board sensors. For gait analysis, the robot is steered over an unknown irregular terrain first using a fast-speed ripple gait and then using a slow-speed wave gait. Reaction forces at the footholds and the reaction torques about the joint motion axes in a leg are investigated which reveal that the wave gait is slow but more secure for adaptive locomotion over an unknown irregular terrain. This even sharing of active payload on either side of the robot body in wave gait results in greater stability especially in the regions of possible slip/drift. However, when using a fast speed ripple gait in which the force-distribution on either side of the robot body is not uniform, the support pattern fails to provide enough friction force against the normal reaction force that may prevent the slip/drift. As a consequence, ripple gaits provide high mobility and are effective over flat terrains however, wave gaits are more suited to walking over unknown irregular terrains.

## Acknowledgement

The author would like to thank the editor for his detailed and pertinent comments.

## References

- 1.
Asif . U. Iqbal J. Motion “. Planning using. an Impact-based. Hybrid Control. for Trajectory. Generation in. Adaptive Walking”. International Journal. of Advanced. Robotic Systems. Vol 8 4 212 226 , 2011. - 2.
Wood, R.J., “The First Take-off of a Biologically Inspired At-Scale Robotic Insect”, in IEEE Transactions on Robotics, 24 24 2 341 347 , April 2008. - 3.
Kuhn . D. Rommermann M. Sauthoff N. Grimminger F. Kirchner F. Concept “. evaluation of. a. new biologically. inspired robot. Little Ape”. in I. E. E. E. R. S. J. International Conference. on Intelligent. Robots Systems 2009 (IROS 09),589 594 , 10-15 October 2009. - 4.
Shumei Yu and Shugen Ma and Bin Li and Yuechao Wang, “An amphibious snake-like robot: Design and motion experiments on ground and in water”, in International Conference on Information and Automation 2009 (ICIA 09),500 505 , 22-24 June 2009. - 5.
M. Konyev and F.Palis and Y. Zavgorodniy and A. Melnikov and A. Rudiskiy and A. Telesh and U. Sschmucker and V. Rusin, “Walking Robot Anton: Design, Simulation, Experiments”, in International Conference on Climbing and Walking Robots and the Support Technologies for Mobile Machines2008 (CLAWAR 2008),922 929 , 8-10 September 2008. - 6.
of a Biologically-Inspired Leg for a Six-Legged Walking Machine”, inRoennau . A. Kerscher T. Dillmann R. Design “. Kinematics of. a. Biologically-Inspired Leg. for a. Six-Legged Walking. Machine” in. the Proc. 2010 Proc. of the 2010 3^{rd}IEEE RAS & EMBS Int. Conf. on Biomedical Robotics and Biomechatronics, The University of Tokyo, Tokyo, Japan, September26 29 . - 7.
Lewinger and Roger D. Quinn, “A Hexapod Walks Over Irregular Terrain Using a Controller Adapted from an Insect’s Nervous System”,Willian . A. 2010 2010 IEEE/RSJ International Conference on Intelligent Robots and Systems, October 18-22, 2010, Taipei, Taiwan. - 8.
Asif . U. Iqbal J. Rapid Prototyping. of a. Gait Generation. Method using. Real Time. Hardware in. Loop Simulation. “. International Journal. of Modeling. Simulation Scientific Computing. . I. J. M. S. S. C)” vol. 2 4 393 411 , 2011. - 9.
Asif . U. Iqbal J. Design Simulation of. a. Biologically Inspired. Hexapod Robot. using Sim. Mechanics “. Proceedings of. the I. A. S. T. E. D. International Conference. Robotics . Robo 2010 128 135 , Phuket, Thailand, November 24- 26, 2010. - 10.
Asif . U. Iqbal J. Comparative A. Study of. Biologically Inspired. Walking Gaits. through Waypoint. Navigation “. Advances in. Mechanical Engineering”. vol 2011 (2011), Article ID 737403, 9 pages,DOI: 10.1155/2011/737403. - 11.
Asif . U. Iqbal J. An “. Approach to. Stable Walking. over Uneven. Terrain using. a. Reflex Based. Adaptive Gait”. Journal of. Control Science. Engineering Volume. 2011 (2011), Article ID 783741, 12 pages,DOI:10.1155/2011/783741. - 12.
Asif . U. Iqbal J. Ajmal M. Khan “. Kinematic Analysis. of Periodic. Continuous Gaits. for a. Bio-Mimetic Walking. Robot” Proceedings. of 2011 2011 IEEE International Symposium on Safety, Security and Rescue Robotics,80 85 , November 1-5, 2011, Kyoto, Japan. - 13.
Asif . U. Iqbal J. Motion “. Planning of. a. Walking Robot. using Attitude. Guidance” International. Journal of. Robotics Automation pp. 4148 27 1 2012.DOI: 10.2316/Journal.206.2012.1.206-3589. - 14.
Asif . U. Iqbal J. On “. the Improvement. of Legged. Locomotion in. Difficult Terrains. using a. Balance Stabilization. Method” International. Journal of. Advanced Robotic. Systems Vol. 9 1 1 13 , 2012. - 15.
Kyle Johns, Trevor Taylor, Professional Microsoft Robotics Developer Studio (Wiley publishing, Indianapolis, Indiana, 2008). - 16.
Asif . U. Iqbal J. Modeling Control. Simulation of. a. Six-D O. F. motion platform. for a. Flight Simulator. “. International Journal. of Modeling. Simulation” vol. 31 4 307 321 , 2011.DOI:10.2316/Journal.20.2011.4.205-5587. - 17.
Asif . U. Iqbal J. Modeling Simulation. Motion Cues. Visualization of. a. Six-D O. F. Motion Platform. for-Manipulations Micro. International “. Journal of. Intelligent Mechatronics. Robotics . I. J. I. M. R)” vol. 1 3 1 17 , 2011. - 18.
Asif . U. Iqbal J. Robotic “. A. System with. a. Hybrid Motion. Cueing Controller. for Inertia. Tensor Approximation. in-Manipulations” Micro. International Journal. of Advanced. Robotic Systems. Vol 8 4 235 247 , 2011.