Open access peer-reviewed chapter

Virtual Reality to Simulate Adaptive Walking in Unstructured Terrains for Multi-Legged Robots

By Umar Asif

Submitted: November 24th 2011Reviewed: March 19th 2012Published: September 5th 2012

DOI: 10.5772/46404

Downloaded: 2892

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.

<xref rid="F1" ref-type="fig">Figure 1</xref>.

Overall control loop of the simulation model.

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].

<xref rid="F2" ref-type="fig">Figure 2</xref>.

A six-legged hexapod robot and its leg kinematic representation.

<xref rid="F3" ref-type="fig">Figure 3</xref>.

SimMechanics model representing the plant subsystem of a hexapod robot.

<xref rid="F4" ref-type="fig">Figure 4</xref>.

SimMechanics model of an individual leg as a 3-DOF serial manipulator.

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ϖc, the joint connecting coxa with the femur (CoxaFemur-joint) is represented byϖf, and the joint connecting the femur with the tibia (FemurTibia-joint) is represented by ϖt.The position of the foothold [Xt Yt Zt]Twith respect to BodyCoxa-joint motion axis is obtained using Denavit Hartenberg convention and expressed as a general homogenous transformation expression as given by (1). Table1 enlists the D-H parameters of the robot leg shown in Fig.5.

<xref rid="F5" ref-type="fig">Figure 5</xref>.

Kinematic Configuration of an individual leg.


Table 1.

D-T parameters of leg shown in Fig. 5


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)




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).




Solving (8) yields (10)


Comparing r34elements of both sides of the (10) yields (11).


Thus, BodyCoxa joint angle ϖccan be determined from (11) as given by (12).


Solving (9) yields (13)


Comparing r14,r24elements of both sides of (13) we get (14) & (15)


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




Further solving (16) yields:




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




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. Ϣecontains active joint torques and F is a matrix representing ground contact forces estimated using force sensors embedded in each foot.

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).




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.

<xref rid="F6" ref-type="fig">Figure 6</xref>.

A comparative representation of wave gait generation in simulation model and 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 6th 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).

<xref rid="F7" ref-type="fig">Figure 7</xref>.

A view of a hexapod robot being steered between two fixed points (2-meter apart) over a flat surface.

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.

<xref rid="F8" ref-type="fig">Figure 8</xref>.

Comparative representation of sensors feedback and mathematical model results. (A) Motion profile of BodyCoxa joint. (B) Motion profile of CoxaFemur joint. (C) Motion profile of FemurTibia joint. (D) Joint torques.

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. Reaction torque at bodycoxa joint

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


<xref rid="F9" ref-type="fig">Figure 9</xref>.

The total torque about BodyCoxa joint axis is equal to the sum of moments due to weight of the coxa link and moments due to friction force and normal reaction forces acting at the foothold. Reaction torque at coxafemur joint

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


<xref rid="F10" ref-type="fig">Figure 10</xref>.

The total torque about CoxaFemur joint axis is equal to the sum of moments due to weight of the femur link and moments due to friction force and normal reaction forces acting at the foothold. Reaction torque at femurtibia joint

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


<xref rid="F11" ref-type="fig">Figure 11</xref>.

The total torque about FemurTibia joint axis is equal to the sum of moments due to weight of the tibia link and moments due to friction force and normal reaction forces acting at the foothold.

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.

<xref rid="F12" ref-type="fig">Figure 12</xref>.

Results obtained when the robot was steered using a ripple gait. (A) Comparative representation of actual torques sensed at the joint and the torques data determined by the mathematical model. (B) Plot of normal reaction forces and friction forces at the footholds.

<xref rid="F13" ref-type="fig">Figure 13</xref>.

A view of the robot straight-line walking between desired waypoints over an unknown irregular terrain.

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.

<xref rid="F14" ref-type="fig">Figure 14</xref>.

A) 12-step ripple gait leg-lift sequential pattern. (B) 19-step wave gait leg-lift sequential pattern.

<xref rid="F15" ref-type="fig">Figure 15</xref>.

A) Path outlined by the robot when using a wave gait. (B) Velocity profile of the robot during its locomotion.

<xref rid="F16" ref-type="fig">Figure 16</xref>.

Results obtained when the robot was steered using a wave gait. (A) Comparative representation of actual torques sensed at the joint and the torques data determined by the mathematical model. (B) Plot of normal reaction forces and friction forces at the footholds. (C) Robot attitude tracking. (D) Angular velocity profiles of the robot’s body.

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.



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

© 2012 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution 3.0 License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

How to cite and reference

Link to this chapter Copy to clipboard

Cite this chapter Copy to clipboard

Umar Asif (September 5th 2012). Virtual Reality to Simulate Adaptive Walking in Unstructured Terrains for Multi-Legged Robots, Virtual Reality - Human Computer Interaction, Xin‐Xing Tang, IntechOpen, DOI: 10.5772/46404. Available from:

chapter statistics

2892total chapter downloads

More statistics for editors and authors

Login to your personal dashboard for more detailed statistics on your publications.

Access personal reporting

Related Content

This Book

Next chapter

Facilitating User Involvement in Product Design Through Virtual Reality

By J.P. Thalen and M.C. van der Voort

Related Book

First chapter

Brain-Computer Interface Systems Used for Virtual Reality Control

By Gert Pfurtscheller, Robert Leeb, Josef Faller and Christa Neuper

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

More About Us