humanoid body control using neural networks and fuzzy logic · (anfis) to model this problem. the...

25
Humanoid Body Control Using Neural Networks and Fuzzy Logic Dilip Kumar Pratihar, V. Pandu Ranga, and Rega Rajendra Contents 1 Introduction ............................................................... 2 2 Literature Review .......................................................... 2 3 Gait Generation for Staircase Ascending ........................................ 3 3.1 Mathematical Formulation for Single Support Phase (SSP) .................... 3 3.2 Mathematical Formulation for Double Support Phase (DSP) ................... 10 4 Fundamentals of Genetic Algorithms, Neural Networks, and Fuzzy Logic ............. 13 4.1 Genetic Algorithm ..................................................... 13 4.2 Neural Networks ....................................................... 14 4.3 Fuzzy Logic .......................................................... 15 5 Body Control Algorithms .................................................... 15 5.1 Algorithms for SSP ..................................................... 16 5.2 Algorithms for DSP .................................................... 22 6 Summary ................................................................. 23 7 Future Directions and Open Problems .......................................... 24 References ................................................................... 24 Abstract A humanoid robot is assumed to be consisting of a number of rigid links connected through some joints, for simplicity. Relative movement of the links causes motion to the robot during its walking. Realizing the fact that body motion has significant effect on power requirement and overall balance of the robot, a few studies had been reported in the literature. The present chapter deals with the studies related to how to decide and control body movement of a biped robot (that is, simpler version of humanoid robot) while ascending through some staircases D.K. Pratihar () • V. Pandu Ranga • R. Rajendra Department of Mechanical Engineering, Indian Institute of Technology, Kharagpur, West Bengal, India e-mail: [email protected] © Springer Science+Business Media B.V. 2017 A. Goswami, P. Vadakkepat (eds.), Humanoid Robotics: A Reference, https://doi.org/10.1007/978-94-007-7194-9_50-1 1

Upload: truongnguyet

Post on 15-Aug-2019

217 views

Category:

Documents


0 download

TRANSCRIPT

Humanoid Body Control Using NeuralNetworks and Fuzzy Logic

Dilip Kumar Pratihar, V. Pandu Ranga, and Rega Rajendra

Contents

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Literature Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Gait Generation for Staircase Ascending . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.1 Mathematical Formulation for Single Support Phase (SSP) . . . . . . . . . . . . . . . . . . . . 33.2 Mathematical Formulation for Double Support Phase (DSP) . . . . . . . . . . . . . . . . . . . 10

4 Fundamentals of Genetic Algorithms, Neural Networks, and Fuzzy Logic . . . . . . . . . . . . . 134.1 Genetic Algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.2 Neural Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.3 Fuzzy Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5 Body Control Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.1 Algorithms for SSP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.2 Algorithms for DSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Future Directions and Open Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Abstract

A humanoid robot is assumed to be consisting of a number of rigid linksconnected through some joints, for simplicity. Relative movement of the linkscauses motion to the robot during its walking. Realizing the fact that body motionhas significant effect on power requirement and overall balance of the robot, afew studies had been reported in the literature. The present chapter deals with thestudies related to how to decide and control body movement of a biped robot (thatis, simpler version of humanoid robot) while ascending through some staircases

D.K. Pratihar (�) • V. Pandu Ranga • R. RajendraDepartment of Mechanical Engineering, Indian Institute of Technology, Kharagpur, West Bengal,Indiae-mail: [email protected]

© Springer Science+Business Media B.V. 2017A. Goswami, P. Vadakkepat (eds.), Humanoid Robotics: A Reference,https://doi.org/10.1007/978-94-007-7194-9_50-1

1

2 D.K. Pratihar et al.

by using neural networks and fuzzy logic techniques. Similar studies may beconducted for modeling other types of movement of the robot like staircasedescending, ditch crossing, turning, and others.

KeywordsHumanoid Robot · Body Motion · Power Requirement · Balance · NeuralNetworks · Fuzzy Logic Techniques

1 Introduction

Body movement is essential for a humanoid robot during its walking on planesurface, and while negotiating staircases, crossing ditches, taking turn, and others.The motors connected at various joints are mainly responsible for providingnecessary torques. Moreover, the robot should be able to maintain its balanceduring the movement. A gait (that is, sequence of legs’ movement synchronizedwith its body movement during walking) cycle consists of two single-supportand double-support phases each. Moreover, there will be a small transition periodbetween the two different phases. A humanoid robot should be able to generate itsnecessary body movement by properly selecting its gait cycle, so that it can walkin optimal sense by consuming the minimum power after maintaining its balance.It is important to mention that trunk mass will have significant contributions towardpower consumption and balance of the robot along with other link masses [1].

2 Literature Review

Neural networks (NN) and/or fuzzy logic (FL)-based techniques had been used bya number of researchers to control body motionBody motion of the biped robot.Some of those studies are discussed below. Miller [2] used an NN to decide theappropriate time sequence of body postures of the biped, so that it can performthe task without falling. The network was trained using the combined supervisedlearning and temporal difference learning. No kinematic and dynamic models ofthe biped robot were used in his study. The biped robot could learn the kinematicsnecessary in order to walk without falling. Murakami et al. [3] implemented FL-based control of dynamic biped walking robot in computer simulations. There werethree inputs, namely target angle, controlled angular velocity, and controlled centerof gravity, and one output, that is, control torque of the FL-based controller. Park andRhee [4] proposed an FL-based approach to reduce the range of variations of trunkmotion by generating a varying ZMP trajectory. The performance of the developedscheme was tested on a seven dof biped robot through computer simulations andfound to be efficient. However, they considered single support phase (SSP) onlyof the biped robot moving in the sagittal plane. Lin et al. [5] developed an FL-based technique combined with modern control theory for controlling the movementof biped robot. The performance of the developed technique was tested for the

Humanoid Body Control Using Neural Networks and Fuzzy Logic 3

biped walking on horizontal plane surface and staircases. Experimental resultsconfirmed the effectiveness and applicability of the proposed FL-based technique.Body control problem of a seven dof biped robot was modeled using genetic-neuraland genetic-fuzzy systems for its SSP [1, 6] and double support phase (DSP) [7],while negotiating the staircases. The problems were formulated as optimizationones, so that the biped robot could generate optimal gaits by consuming minimumpower after maintaining the stability. These soft computing-based approaches couldcontrol the body motion of the biped robot efficiently to generate the appropriategaits, while ascending and descending the staircases. Bebek and Erbatur [8] usedan FL system represented utilizing the structure of a three layer feedforward NNin order to decide suitable gait parameter for a biped robot. A back-propagationalgorithm was used to train the NN. The performance was successfully tested on3D simulations for a 12 dof biped robot. In another study carried out by Kim etal. [9], ZMP data were measured using a real biped robot walking on both a flatsurface and the slopes. They developed an adaptive neuro-fuzzy inference system(ANFIS) to model this problem. The generated ZMP trajectory using the ANFIScould significantly improve the stability of the biped robot.

3 Gait Generation for Staircase Ascending

A biped robot’s walking cycle consists of two phases, namely, SSP (that is, whenone foot is in contact with the ground and the other is in air) and DSP (that is, whenboth the feet are in contact with the ground). This chapter deals with the studies onboth the SSP and DSP during gait generation of a biped robot ascending staircases.For simplicity, the movement of the robot has been considered in the sagittal planeonly.

3.1 Mathematical Formulation for Single Support Phase (SSP)

This section deals with SSPSingle support phase (SSP) of dynamically balancedascending gait generation of a biped robot through staircases. A seven degrees offreedom (that is, three at the hip, two at the knee, and two at the ankles) bipedrobot has been considered in this study, for simplicity. The masses of the limbs areassumed to be concentrated at some points on the corresponding limbs. Figure 1displays a view of the robot in its SSP, while ascending the staircase. The lengthsof the seven links and their masses are represented by L1, : : : , L7 and m1, : : : , m7,respectively. The joint angles are represented by �1, : : : , �7. The masses of thelinks are assumed to be concentrated at their respective links, and their locations areindicated by r1, : : : , r7 with respect to their coordinate systems. All the joints areassumed to be rotary in nature. The balance of the robot is considered only in thedirections of movement, i.e., in the forward direction.

The movement of the biped robot is decided using two important parameters,namely, step length l and hip height h determined using Eqs. 1 and 2, respectively.

4 D.K. Pratihar et al.

x 1

x2

x3

ZMP

F

FT

F : Ground reaction force

TF : Friction force

F : Normal reaction forceN

θ 2

θ3

θ4

θ5

θ 7 =0

L2

L3

L 4

L5

L6

L1

L 7

r2

r3

r4

r5

r6

r1

θ 6

m1

m2

m3

m4

m5

m6

sw

sh

(x,z)

Motion direction

X

Z θ 1= 0

F

FN

Swing foot trajectory

Fig. 1 A schematic view of a seven dof biped robot ascending the staircases during its SSP [1]

l D .2sw C x3/ � x1; (1)

h D L2 cos �2 C L3 cos �3; (2)

Humanoid Body Control Using Neural Networks and Fuzzy Logic 5

The width and height of the stairs are denoted by sw and sh, respectively. The feetplacements of the biped robot from the end of the respective staircases are indicatedby x1, x2, and x3 (refer to Fig. 1). Here, fs represents the length of the foot (wherefs D l1 D l7). A human being will have to decide the suitable values of step lengthand hip height, while ascending the staircases based on his/her experience. Here, L2

and L3 denote the lengths of lower and upper legs, respectively.

3.1.1 Swing Foot Trajectory GenerationTo avoid collision while ascending the staircases, a suitable trajectory for the swingfoot is to be chosen. The trajectory of the swing foot is assumed to be a cubicpolynomial, as given below.

z D c0 C c1x C c2x2 C c3x

3; (3)

where z denotes the height of swing foot at a distance x from the starting point,and c0, c1, c2, and c3 are the coefficients. The following boundary conditions areutilized to determine the appropriate values of the coefficients:

• at xD 0, zD 0,• at x D sw � sw � x1 �

fs2; z D sh C

fs2;

• at x D 2sw � x1 �fs2; z D 2sh C

fs2;

• at xD 2sw – x1 C x3, zD 2sh.

The total travel time has been divided into a few time-steps. In a time-step, theswing leg starts with a zero velocity. It then moves with an acceleration during25% of the time-step and reaches its maximum velocity. It maintains this maximumvelocity for the next 50% of the time-step, and then decelerates for the remainingperiod. Thus, the swing leg touches the staircase with zero velocity.

3.1.2 Hip Joint Trajectory GenerationThe hip joint is assumed to follow a straight path having the same slope with that ofthe staircase. Its trajectory has been selected in order to generate the cyclic gait inthe next motion cycle.

3.1.3 Lower Limbs’ Motion Generation upto Hip JointOnce the trajectories of the swing foot and hip joint are known, the motion of thelower limbs upto the hip joint can be determined mathematically. For the purposeof analysis, the trajectories of both the swing foot and the hip joint are divided intosome equal intervals in time. Let the hip height and distance of the ankle of theswing foot from the projection of hip are denoted by h1 and l1, respectively (refer toFigs. 1 and 2). Now, h1 and l1 can be expressed as follows:

h1 D L2 cos �2 C L3 cos �3 (4)

6 D.K. Pratihar et al.

x1

x2

Hip trajectory

sh

h1

l1l2

h2

l1

Fig. 2 A schematic view showing the hip trajectory [6]

l1 D L2 sin �2 C L3 sin �3 (5)

By squaring and adding Eqs. 4 and 5, we get

h21 C l21 D L

22 C L

23 C 2L2L3 cos .�2 � �3/ (6)

Let �2 � �3 D 1. From Eq. 6, the expression for 1 can be obtained as follows:

1 D arccos

�h21 C l

21 � L

22 � L

23

2 L2 L3

�(7)

Now, by substituting the value of �3 D �2 � 1 in Eqs. 4 and 5, we get:

h1 D L2 cos �2 C L3 cos .�2 � 1/ (8)

l1 D L2 sin �2 C L3 sin .�2 � 1/ (9)

Humanoid Body Control Using Neural Networks and Fuzzy Logic 7

By expanding the trigonometric functions and rearranging, we get:

h1 D .L2 C L3 cos 1/ cos �2 C .L3 sin 1/ sin �2 (10)

l1 D .L2 C L3 cos 1/ sin �2 � .L3 sin 1/ cos �2 (11)

Now, by multiplying Eqs. 10 and 11 by L3sin 1 and (L2 C L3cos 1), respec-tively, and then adding and simplifying, we get:

�2 D sin�1�h1L3 sin 1 C l1 .L2 C L3 cos 1/

.L2 C L3 cos 1/2 C .L3 sin 1/

2

�; (12)

Now,

�3 D �2 � 1 (13)

Similarly, the angles: �5 and �6 are calculated by using the hip height h2 anddistance of the supporting ankle from the projection of hip joint (i.e., l2) (refer toFig. 2), as given below.

�6 D sin�1�h2L5 sin 2 C l2 .L6 C L5 cos 2/

.L6 C L5 cos 2/2 C .L5 sin 2/

2

�; (14)

where h2 D L5 cos �5 C L6 cos �6, l2 D L5 sin �5 C L6 sin �6, 2 D �6 � �5 D

arccos��h22 C l

22 � L

26 � L

25

�=2L6L5

�. The angle �5 can be calculated by using

the expression: �5 D �6 – 2. It is to be noted that the following repeatabilityconditions are to be maintained to ensure repeating steps of the biped robot:

�2;initial D �6;finalI P�2;initial D P�6;finalI

�3;initial D �5;finalI P�3;initial D P�5;final

3.1.4 Trunk Motion GenerationTrunk motion may have significant influence on dynamic balance of the biped robotduring its locomotion. Here, the concept of static balance has been utilized to decidethe trunk motion. The mathematical expression for trunk motion, i.e., �4 is found tobe as follows:

�4D s�1

�1

m4r4..p�msum/ � .m1d1Cm2d2 Cm3d3 Cm5d5 Cm6d6 Cm7d7//

(15)

where s�1 indicates sin�1; p denotes the allowed distance for the projection of masscenter; and d1, d2, d3, d5, d6, and d7 are the distances of masses m1, m2, m3, m5, m6,and d7, respectively, from the projection of mass center, r4 is the distance of m4 from

8 D.K. Pratihar et al.

Fig. 3 A schematic viewshowing the position of ZMPand DBM

F X ZMP DBM

ZMP

L7

the hip joint and msum D m1 C m2 C m3 C m4 C m5 C m6 C m7. Once the trunkmotion is generated, it will be verified whether the dynamic balance of the robot isalso satisfied, using the concept of zero-moment point (ZMP), as discussed below.

3.1.5 Dynamic Balance AnalysisThe generated gait must be dynamically balanced, for which the ZMP should liewithin the sole of the supporting foot. The friction between the foot and the groundis assumed to be sufficient enough to prevent the slipping. The position of the ZMPwith respect to the ankle joint of the ground leg can be determined as follows:

xXMP D

P7iD1

�Ii P!i Cmixi .Rzi � g/ �mi Rxi ziP7

iD1 mi .Rzi � g/; (16)

where Ii denotes the moment of inertia of i — th link (kg-m2), P!i is the angularacceleration of link i (rad/s2), mi denotes the mass of ith link (kg), (xi, zi) are thecoordinates of i � th lumped mass, g is the acceleration due to gravity (m/s2), Rzi isthe acceleration of link i in z-direction (m/s2), and Rxi is the acceleration of link iin x-direction (m/s2). The position of the ZMP and the ground reaction force actingthrough this point on the foot are also shown in Fig. 3.

To maintain dynamic balance of the robot, the ZMP should lie within the footsupport area. The dynamic balance margin (DBM) is defined as the distance of theZMP from the boundary of the support polygon. The expression for determining thedynamic stability margin in x direction is shown below.

xDBM D

�L7

2� jxZMP j

�; (17)

where L7 is the length of the foot.

Humanoid Body Control Using Neural Networks and Fuzzy Logic 9

Fig. 4 A schematic viewshowing D-H parametersetting and included anglesbetween the links [6]

x0 , x1

z0 , z1

z2

z3

z4

x4

z 5x5

z 6

z 7

x7

x6

q2

q3

q4

q5

q 6

q 7

x2

x3

3.1.6 Torques CalculationInverse dynamics problem of the biped robot is solved using Lagrange-Eulerformulation. The coordinates are assigned at various joints of the robot accordingto the rules of D-H parameters setting, as shown in Fig. 4. A systematic approachis followed to determine the torques at different joints of the robot after consid-ering their different components like inertial, coriolis/centrifugal, and gravity. Therelationships between the joint angles and D-H parameter angles are as follows:q1D �1D 0, q2D 90� �2, q3D �2 � �3, q4D �3 � �4, q5D �4 � �5, q6D �5 � �6,q7 D (90 � �6) � �7, where �7 D 0. For smooth variation of the joint angles, theirtrajectories are assumed to follow the fifth-order polynomial, as shown below.

q.t/ D a0 C a1t C a2t2 C a3t

3 C a4t4 C a5t

5; (18)

where a0, a1, a2, a3, a4, and a5 are the coefficients, whose values are determinedusing some conditions. Using the above equation, the variations of angular velocityand acceleration can be determined for a cycle. The basic dynamics equation of therobotic system can be written as follows [10]:

�i D

nXkD1

Dik Rqk C

nXkD1

nXmD1

hikm Pqk Pqm C Ci ; i D 1; 2; � � � ; n (19)

10 D.K. Pratihar et al.

where Dik DnP

jDmax.i;k/

T r�UjkJjU

Tji i; k D 1; 2; � � � ; n;

hikm DnP

jDmax.i;k;m/

T r�UjkmJjU

Tji i; k;m D 1; 2; � � � ; n;

Ci DnP

jD1

��mjgU ji r

jj

i D 1; 2; � � � ; n;

Here, Dik represents inertia terms, hikm indicates coriolis and centrifugal terms,and Ci carries information of the gravity terms.

3.1.7 Average Power ConsumptionThe amount of power consumed by i-th joint can be calculated as the product ofmotor torque and angular velocity. The amount of heat loss of the motor is alsoconsidered in the expression of average power consumption, as given below.

Pi D1

T

nXiD1

Z T

0

�j�i Pqi j C k�

2i

�dt; (20)

where k is a constant.

3.2 Mathematical Formulation for Double Support Phase (DSP)

Figure 5 displays the schematic view of the seven dof biped robotDouble supportphase (DSP) (during its DSP) ascending the staircase. Three joints are assumed tobe coinciding at the hip, which is considered to be a massless link, as shown in theabove figure. The lengths of its links, their masses and mass centers, and joint anglesare denoted.

by using the same symbols (refer to Sect. 3.1). During the DSP, the total loadof the robot is shared by two ground feet. Here, DSP of the biped robot has beenmodelled as two SSPs for the purpose of analysis. Let X1 and X2 denote the projectedpoint of the trunk mass on the double support region (refer to Fig. 5). As two feet areplaced on two separate stairs, the trunk mass m4 can be distributed into two parts,namely m41 and m42, where

m41 Dm4X2

X1 CX2(21)

m42 Dm4X1

X1 CX2(22)

Hip trajectory is assumed to follow a straight line with the slope equal to that ofthe staircase to ensure repeatability conditions of the cycles, as it has been done for

Humanoid Body Control Using Neural Networks and Fuzzy Logic 11

Fig. 5 A schematic view of aseven dof biped robotascending the staircasesduring its DSP [11]

X1

X2

Sw

Sh

h2h1

1

x2

l1l2

Fx

Fz

xL r m1 1 1

7 7L r m

7

L2

L3

L4

L5

L6

m2

m3

m4

m5

m6

r2

r3

r4

r5

r6

X

Z

θ

θ

θ

θ

1

θ2

θ3

4

θ5

6

Hip trajectory

Direction of motion

the SSP. Once the locus of the hip joint is known, the motion of the lower limbs canbe determined, as it has been done for the SSP.

The problem of DSP has been assumed to be consisting of two SSPs as statedabove, and for each SSP, the XZMP is determined using Eq. 16. Therefore, twoZMPs will be obtained as shown in Fig. 6, through which ground reaction forcesare assumed to be acting. The ground reaction forces are calculated based on theassumption that hard point contacts with friction exist between the feet and theground. The ground reaction forces: f1 and f2 are assumed to have three componentseach, that is, f1 D [fx1, fy1, fz1]T and f2 DD [fx2, fy2, fz2]T . The external force vector F(acting at the center of trunk mass) is assumed to have three components: Fx, Fy, andFz. The following force and moment equilibrium equations are to be considered:

7XiD1

mixi C Fx C fx D 0 (23)

7XiD1

mi Ryi C Fy C fy D 0 (24)

12 D.K. Pratihar et al.

Fig. 6 A schematic view toshow calculation of systemZMP in DSP [11]

m m41 42

Z

X

f 2

f2

X X

X ZMP1

X ZMP2

f1

f2

Double support region

θ

θ

l

l l

r

X ZMP, system

7XiD1

mi .Rzi � g/C Fz C fz D 0 (25)

7XiD1

mi Ryi ziC7XiD1

mi .Rzi�g/ yiC7XiD1

Ii˛iCFzy4�Fyz4CfzYZMP�fyZZMPD0

(26)

7XiD1

mi .Rzi�g/ xiC7XiD1

mi Rxi ziC7XiD1

Ii˛iCFxz4 � Fzx4CfxZZMP � fzXZMPD0

(27)

7XiD1

mi Rxiyi C

7XiD1

mi Ryixi C

7XiD1

Ii˛i C Fyx4 � Fxy4 C fyXZMP � fxYZMPD0

(28)

Humanoid Body Control Using Neural Networks and Fuzzy Logic 13

Here, the motion of the biped robot has been considered in the sagittal plane only,so Eq. 24 will have no contribution in the analysis. Moreover, Fy and Fz are assumedto be equal to zero.

To determine the ZMP of the whole robotic system (that is, XZMP,system), theintersection of the directions of two forces: f1 and f2 is considered, that.

is, Z-heights of the directions of two force vectors are kept equal at the point ofintersection. XZMP,system is obtained as follows:

XZMP;system Dbf 2 �

bf 1 C tan �lXZMP1 � tan �rXZMP2tan �l � tan �r

(29)

Here, bf 1 and bf 2 denote the directions (that is, straight lines on X � Z plane) ofthe forces: f1 and f2, respectively. It is important to mention that the dimensionsof bf 1 and bf 2 (refer to Eq. 29) are nothing but that of position. The ground

reaction forces: f1 and f2 make the angles �l D tan�1�bf z1=

bf x1

and �r D

tan�1�bf z2=

bf x2

, respectively, with the X-direction.

In a special situation of DSP, when f1 and f2 become parallel to one another, therewill be no finite intersection point, and the ZMP of the system is assumed to be thevertically projected point of the center of mass of the whole body. Now, dynamicbalance margin (DBM) of the robotic system in DSP can be obtained as follows:

DBM system DSw � x1 C x2 C L7

2�ˇ̌XZMP;system

ˇ̌(30)

4 Fundamentals of Genetic Algorithms, Neural Networks,and Fuzzy Logic

This section provides a brief introduction to genetic algorithms (GAs), neuralnetworks (NNs), and fuzzy logic (FL). Interested readers may refer to [12] for adetailed description for these tools and techniques.

4.1 Genetic Algorithm

Genetic algorithm (GA) is a population-based probabilistic search and optimizationtechnique, which works based on the mechanism of natural genetics and Darwin’sprinciple of natural selection (i.e., survival of the fittest) [13]. The concept of GAwas introduced by Prof. John Holland of the University of Michigan, Ann Arbor,USA, in the year 1965, but his seminal book was published in the year 1975 [14].The working principle of the GA is explained below in the following steps:

14 D.K. Pratihar et al.

• A GA starts with a population of initial solutions, chosen at random.• The fitness/goodness value (i.e., objective function value in case of a maximiza-

tion problem) of each solution in the population is calculated.• The population of solutions is then modified using different operators, namely

reproduction, crossover, mutation, and others.• All the solutions in a population may not be equally good in terms of their fitness

values. An operator named reproduction is used to select the good solutions byusing their fitness information. Thus, reproduction forms a mating pool, whichconsists of good solutions hopefully. It is to be mentioned that there couldbe multiple copies of a particular good solution in the mating pool. The sizeof the mating pool is kept equal to that of the population of solutions beforereproduction. Thus, the average fitness of the mating pool is expected to behigher (for a maximization problem) than that of the prereproduction populationof solutions. There exists a number of reproduction schemes in the GA-literature,namely, proportionate selection (such as roulette-wheel selection), tournamentselection, ranking selection, and others.

• The mating pairs (also known as parents) are selected at random from the matingpool, which will take part in crossover. In crossover, there is an exchange ofproperties of the parents and as a result of which, new children solutions arecreated. It is important to note that if the parents are good, the children areexpected to be good. There are various types of crossover operators in theGA-literature, such as single-point crossover, two-point crossover, multi-pointcrossover, uniform crossover, and others.

• The word mutation means a sudden change of parameter. It is used for achievinga local change around the current solution. Thus, if a solution gets stuck at thelocal minimum, this operator may help it to come out of that local basin.

• After reproduction, crossover and mutation are applied to the whole populationof solutions, one generation of a GA is completed. Different criteria are used toterminate the program, such as the maximum number of generations, a desiredaccuracy in the solution, and others.

Various types of the GA are available in the literature, namely binary-coded GA,real-coded GA, micro-GA, messy-GA, and others. In the present work, a binary-coded GA has been used.

4.2 Neural Networks

To capture and represent input-output relationships of a process, biological nervoussystem is modelled artificially in the form of neural networks (NNs). An NN consistsof a large number of neurons placed on input, hidden, and output layers. Thenumbers of neurons to be placed on the input and output layers are decided by thatof the input(s) and output(s) of the process, respectively. Therefore, the topologyof the NN depends on the number of hidden layer(s) and that of neurons presentin each of the hidden layer(s). It is to be noted that two layers are connected

Humanoid Body Control Using Neural Networks and Fuzzy Logic 15

using a set of connecting weights lying in the range of either (0,1) or (� 1,1).A neuron consists of two parts, namely, summing junction and activation function.The summing junction collects information from the neurons of the previous layer,and the activation function calculates the output corresponding to the input. Theprocess continues starting from the input to output layers through the hiddenlayer(s). Thus, the network will be able to determine the output for a set of inputsfed to the network in their normalized forms. The calculated output(s) is/are thencompared with the target output(s), and the deviation in predictions is calculated.This deviation in prediction is minimized during the training of the network by usingan optimization tool like back-propagation algorithm (gradient-based method), GA,particle swarm optimization, and others. There exist a variety of NNs, namely,multilayer feedforward network, radial basis function network, recurrent neuralnetwork, self-organizing map, counter-propagation neural network, and others.

4.3 Fuzzy Logic

Fuzzy reasoning tool aims to establish input-output relationships of a process usingthe concept of fuzzy sets [15]. The inputs (also known as antecedents) of the processare fuzzified first using the concept of membership function distributions utilizedto represent various linguistic terms of a variable. The performance of a fuzzyreasoning tool depends on its knowledge base (KB), which consists of data base(DB) carrying information of the membership function distributions of the variablesand rule base (RB), which represents the input-output relationships of the processusing the information of their linguistic terms. It is to be noted that only a few outof a large number of rules present in the RB will be activated for a set of inputvariables. Now, for each of the fired rules, a fuzzified output will be obtained. Allthese fuzzified outputs are then combined by considering the contributions of allfired rules. The combined fuzzified output is then defuzzified to calculate the crispoutput, which is then used for controlling the process. There exist a number ofdefuzzification methods, such as center of sums method, centroid method, meanof maxima, and others. Two popular approaches are in use to develop the fuzzyreasoning tool, namely, Mamdani approach and Takagi and Sugeno’s approach. Inthe study presented here, Mamdani approach has been used.

5 Body Control Algorithms

The seven dof biped robot has been assigned the task of ascending the staircases. Itsbody control algorithms have been developed during the single-support and double-support phases, as discussed below.

16 D.K. Pratihar et al.

in single support phase (δθ2, δθ3)Change in angles for swing leg

Second module of NN/FLC

Torques to be realized by themotors mounted at different joints

Inputs: Positions of ankle joints of therobot from the edges of the stairs(x1, x2)

First module of NN/FLC

Outputs: h1 and l1

Weight opt. using GA for NN(or)

Opt. of Knowledge Base ofthe FLC using GA

Weight opt. using GA for NN(or)

Opt. of Knowledge Base ofthe FLC using GA

Objective: to maximize DBM

Outputs: change in trunk andswing foot angles (δθ1, δθ4)

Calculation of joint anglesin double support phase

Fig. 7 Flowchart for the proposed GA-NN/GA-FLC approach [6]

5.1 Algorithms for SSP

Figure 7 displays a flowchart of the proposed genetic-neural (GA-NN) and genetic-fuzzy (GA-FLC) systems to be used for tackling the problem related to SSP of thewalking cycle.

5.1.1 Genetic-Neural System (GA-NN).In the developed genetic-neural system (GA-NN), a GA is used to evolve theoptimized connecting weights of the fully connected feed-forward NNs.

The problem is solved using a set of two GA-trained neural networks. Thefoot trajectory given in Eq. 3 is determined using the boundary conditions. Twoparameters: x1 and x2 (that is, positions of the ankle joints from the edges of thestairs, as shown in Fig. 1) are fed as inputs to the first NN, and it predicts twooutputs, such as hip height (h1) and the distance of projection of the hip joint from

Humanoid Body Control Using Neural Networks and Fuzzy Logic 17

x1

x2

b1

b1

b1

b1

b1

b1

b1

b 2

b2

b2

b2

b2

b2

b2

V1

11

V1

12

V1

1M

V1

21

V1

22

V1

2M

W1

11

W1

12

W1

M1

W1

21

W1

22

W1

M2

h1

l1

δθ2

δθ3

V2

11

V2

12

V2

1N

V2

2N

V2

22

V2

21

W11

2

W2

12W

2

N1

W2

N2

W2

21

W2

22

δθ1

δθ4

θ2 θ3and

h1 l1and

Calculationof

using

Linear A.FA.F A.F

Tan−sigmoid Log−sigmoid Linear A.FA.F A.F

Tan−sigmoid Log−sigmoid

1

2

1

2

M

1

2

1

2

1

2

N

1

2

Input layer Hidden layer Output layer Input layer Hidden layer Output layer

First module of Neural Network Second module of Neural Network

Activation Function

.

. .

A.F.

.

. .

Fig. 8 Architecture of the proposed neural networks [6]

the swing foot (l1). Knowing the values of h1 and l1, the hip trajectory is determinedkeeping the slope equal to that.

of the staircase, so that the repeatability conditions of the lower limbs given inSect. 3.1 are achieved. For the known foot and hip trajectories, the joint angles ofthe lower limbs (that is, �2, �3, �5, and �6) have been calculated using the Eqs. 12through 14 for all the intermediate steps after maintaining the kinematic constraints.The changes in joint angles of the swing leg, that is, ı�2 and ı�3 are used as theinputs to the second neural network. The outputs are the changes in the swingfoot and the trunk angles, that is, ı�1 and ı�4, respectively. Then, the entire gaitgenerated is tested for the dynamic balance using the concept of ZMP. Finally, therequired joint torques are calculated using the Eq. 19. The proposed architecture ofthe set of two NNs is shown in Fig. 8. The input and output layers of the first andsecond neural networks consist of two neurons each. The performance of the NN islargely dependent on the topology of the network. Therefore, the number of neuronsin the hidden layer influences the performance of the network.

A GA-string carries information of the NN, such as weight values: [V], [W], andbias values used in input, hidden, and output layers. The length of the GA-stringdepends upon the number of hidden layers and the neurons in those hidden layers.In this algorithm, there are two NNs and each NN consists of one hidden layer. Letus assume that the hidden layers of the first and second NNs consist of M and Nneurons, respectively. The GA-string will look as follows:

1 : : : 1„ƒ‚…V 11;1

: : : 0 : : : 1„ƒ‚…V 11;M

1 : : : 0„ƒ‚…W 11;1

: : : 0 : : : 0„ƒ‚…W 1M;2

1 : : : 0„ƒ‚…V 21;1

: : : 0 : : : 1„ƒ‚…V 22;N

1 : : : 1„ƒ‚…W 21;1

: : : 1 : : : 0„ƒ‚…W 2N;2

1 : : : 1„ƒ‚…b1

0 : : : 1„ƒ‚…b2

18 D.K. Pratihar et al.

Thus, a population of GA-strings represent a number of candidate NNs (whosenumber becomes equal to the population size). As a batch mode of training isadopted in the present work, the whole training set is passed through the neuralnetworks represented by a GA-string. The fitness f of a GA-string is determinedusing the expression given below.

f DXS

iD1

DBMi

S; (31)

where S indicates the number of training cases considered and DBM representsthe dynamic balance margin. If the NNs represented by a GA-string are unable togenerate the dynamically balanced gait, a penalty equals to �100 is added to thefitness to penalize the string.

5.1.2 Genetic-Fuzzy System (GA-FLC)Fuzzy logic can be used to represent input-output relationships of a system, and ithas proven to be an important tool for modeling real-world complex systems, wherecomplexity and imprecision exit. A method for automatic design of the Mamdaniapproach of FLC has been developed to model the gait generation problems ofa staircase ascending biped robot [6]. The GA has been used to optimize theknowledge base of the FLC.

Ascending gait generation problem of the biped robot is solved using two FLCs.The operating principle of GA-FLC is similar to that of the GA-NN. Two modulesof FLC have been used instead of two modules of NN and a GA will be used tooptimize the knowledge base of the FLC. The membership function distributions ofthe input and output variables of the first and second modules of FLC are shownin Figs. 9 and 10, respectively. The a values indicate the base-widths of right-angled triangles and half base-widths of the isosceles triangles. To design an FLCautomatically, the responsibility for searching its good knowledge base is givento the GA. For the first FLC, there are two inputs (x1 and x2) and each input isrepresented using four linguistic terms (Low - L, Medium - M, High - H, Very High- VH). Therefore, the number of rules of the first module of FLC is coming out tobe equal to 16. One such rule of this FLC may look like the following:

IF x1 is L AND x2 is M THEN h1 is M and l1 is L.

Similarly, the number of rules for the second module of FLC is also kept equalto 16, as it has two inputs (ı�2 and ı�3) and each input is represented using fourlinguistic terms (Negative Large - NL, Negative Small - NS, Positive Small - PS,Positive Large - PL). A particular rule of this FLC will look as follows:

IF ı�2 is NL AND ı�3 is NS THEN ı�1 is NS and ı�4 is NL.

For the first module of FLC, there are two outputs: h1 and l1 and each outputis indicated using four linguistic terms. Only two bits are used to indicate each

Humanoid Body Control Using Neural Networks and Fuzzy Logic 19

a1

a2

a3

a4

L M H VH

L M H VH

0.0

0.0

1.0

Mem

bers

hip

valu

eM

embe

rshi

p va

lue

H VH

0.03 0.055 0.08 0.105

0.03 0.055 0.08 0.105

x 1 (meter)

x 2 (meter)

h 1 (meter)

0.0

VHHML

ML

0.0

1.01.0

Mem

bers

hip

valu

e0.0

1.0

0.110.090.070.05

0.5

(meter)1l

Mem

bers

hip

valu

e

L: Low M: Medium H: High VH: Very High

0.53 0.56 0.59

Fig. 9 Membership function distributions for input and output variables of the first module ofFLC – ascending gait generation [6]

linguistic term. For example, 00, 01, 10, and 11 are utilized to represent L, M, H,and VH, respectively. Thus, there are four bits representing the two outputs for eachrule of the first module of FLC. Similarly, for the second module of FLC, thereare two outputs (ı�1 and ı�4) and each of them is indicated using four linguisticterms. Each linguistic term is represented by two bits – 00 for NL, 01 for NS, 10for PS, and 11 for PL. Thus, four bits are utilized to represent two outputs for eachrule of the second module of FLC. In addition to that, there are eight real variables(two inputs and two outputs for each of the first and second modules of the FLC)and ten bits are assigned to represent each variable. Thus, the GA-string will be80 C 16 C 16 � 4 C 16 C 16 � 4 D 240 bits long, which will be looking asfollows:

10111011 : : : 10101„ ƒ‚ …DB of first FLC .40bits/

00111001 : : : 11101„ ƒ‚ …DB of second FLC .40bits/

1101100 : : : 010„ ƒ‚ …RB of first FLC .16bits/

011011100 : : : 110111„ ƒ‚ …Consequent part; first FLC .64bits/

1000110 : : : 011„ ƒ‚ …RB of second FLC .16bits/

010011001 : : : 100101„ ƒ‚ …Consequent part; second FLC .64bits/

20 D.K. Pratihar et al.

a5

a6

a 7

a8

0.0

0.0

1.0

Mem

bers

hip

valu

eM

embe

rshi

p va

lue

0.0 0.0

1.01.0

Mem

bers

hip

valu

e0.0

1.0

Mem

bers

hip

valu

e

LPSPSNLNLPSPSNLN

LPSPSNLNLPSPSNLN

−10 4 11

− 30 −15 15

−2.5 1.5 5.5 9.5

−5 4

δθ θδ2

δθδθ3

1

4

(degrees)

(degrees)

(degrees)

(degrees)

llamSevitageN:SNegraLevitageN:LN

egraLevitisoP:LPllamSevitisoP:SP

−2 10

−3

Fig. 10 Membership function distributions for input and output variables of the second moduleof FLC – ascending gait generation [6]

Table 1 Parameters fordifferent limbs of the bipedrobot

Limb m (kg) L (m) r (m) I(kg m2)

1 0.5 0.06 0.02000 0.0006002 2.0 0.34 0.20000 0.0210673 5.0 0.30 0.24000 0.0780004 30.0 0.60 0.48000 1.8720005 5.0 0.30 0.24000 0.0780006 2.0 0.34 0.20000 0.0210677 0.5 0.06 0.02000 0.000600

A batch mode of training has been adopted and the fitness of a GA-string iscalculated following the above procedure.

5.1.3 Comparisons of the Results of GA-NN and GA-FLC ApproachesThe performances of the GA-NN and GA-FLC have been tested on ascending gaitgenerations of a biped robot with the following parameters (Table 1):

In computer simulations, the information related to feet placement of the robot(i.e., x1, x2) on the staircases and initial posture of the robot (i.e., the angles made bythe lower limb (�2) and upper limb (�3) of the swing leg) are fed as the inputs. The

Humanoid Body Control Using Neural Networks and Fuzzy Logic 21

outputs of interest are the dynamic stability margin of the generated gait calculatedusing the concept of ZMP, joint torques, and average power consumption. Resultsof both GA-NN and GA-FLC approaches have been compared for ten random testcases to generate dynamically balanced ascending gaits of a two-legged robot (referto Table 2.) Out of ten test cases, the GA-FLC approach is able to outperform theGA-NN approach for five cases and the former has been defeated by the latter forfour test cases, in terms of average DBM. It is interesting to note that both theapproaches have yielded the same value of DBM for the seventh test case. It is alsoimportant to mention that GA-FLC approach has given the lower values of trunkjoint torque (�4) compared to those obtained by the other approach in most of thetest cases. Thus, the GA-FLC approach has performed slightly better than the otherapproach and it may be due to the reason that the problem information has beeninjected into the data base of the FLC before its training starts. The designer useshis/her knowledge base to initially design the membership function distributionsof the variables. On the other hand, no problem information is fed to the networkprior to its training. The knee torque of the supporting leg (�6) is found to be morecompared to other joint torques. It may be due to the fact that it is supporting the

Table 2 Average torque values and DBM comparison for the two approaches ascending case [6]

Scene. Average torque values in N-m AverageNo. �1 �2 �3 �4 �5 �6 �7 DBM in

m

GA-NN approach1 6.587 11.309 26.424 24.136 12.577 60.005 0.131 0.0256972 5.859 12.024 28.213 25.683 13.786 56.458 0.132 0.0259953 5.733 11.052 26.108 23.373 13.800 57.844 0.129 0.0259874 5.178 10.688 25.204 22.233 14.469 56.472 0.127 0.0259095 5.565 9.813 22.659 19.874 13.605 58.628 0.126 0.0251456 23.212 18.719 36.452 32.750 18.506 48.447 0.132 0.0271127 10.138 15.299 33.256 30.508 15.379 53.121 0.135 0.0264368 20.322 16.213 33.069 29.229 18.662 48.554 0.128 0.0272029 5.682 12.058 26.853 24.215 14.458 55.777 0.130 0.02560610 20.526 14.426 26.535 23.272 17.732 51.597 0.125 0.025838GA-FLC approach1 5.926 13.739 25.599 22.982 15.731 62.904 0.132 0.0259242 8.439 14.877 28.480 24.427 17.294 59.741 0.134 0.0260283 6.687 13.602 25.233 21.905 16.549 60.597 0.130 0.0262174 6.721 13.056 25.222 21.015 17.618 59.578 0.129 0.0259375 5.511 12.292 22.248 19.126 16.339 62.448 0.127 0.0253316 30.192 23.791 35.462 28.553 19.954 52.923 0.133 0.0264577 16.156 19.054 34.429 29.247 18.479 57.058 0.138 0.0264368 27.279 20.708 31.545 24.627 20.019 52.819 0.129 0.0265009 16.069 17.819 30.404 25.995 18.353 67.011 0.137 0.02525710 30.832 20.859 30.389 22.426 22.287 62.685 0.132 0.024675

22 D.K. Pratihar et al.

Fig. 11 Single support phase during ascending the staircases: (a) GA-NN and (b) GA-FLCapproaches [6]

rest of the body. It exactly matches with the general experience of the human beingascending the staircase. Both the approaches are able to generate the dynamicallybalanced gaits for the robot.

Figure 11 shows the ascending gait generation of a biped robot during threeconsecutive cycles using both the above approaches, which are found to besuccessfully generating the staircase ascending gaits.

5.2 Algorithms for DSP

The problem of double support phase has been solved using the same parametersfor different limbs of the biped robot, as given in Table 1. As displayed in Figs. 8,9, and 10, this problem could be tackled using the genetic-neural and genetic-fuzzysystems. In one of the recent studies [11], it has been modelled and solved utilizingan adaptive neuro-fuzzy inference system (ANFIS), which is basically a fuzzyreasoning tool working based on Takagi and Sugeno’s approach but representedusing the structure of an NN [16]. Interested readers may refer to [12] for a detaileddescription of the ANFIS algorithm. Figure 12 displays a schematic view of twoANFIS modules considered for gait planning of the biped robot during its doublesupport phase of staircase ascending [7]. Figure 13 displays the movement of thebiped robot during its double support phase, while ascending the staircases.

Humanoid Body Control Using Neural Networks and Fuzzy Logic 23

First

ANFIS

module

Second

ANFIS

module

Calculation

of joint

angles:

x

x l

Inputs Outputs Inputs Outputs

θ

θ

θ

θ

δ

δ

δ

δ

1

2

h1

1

θ θ2 3,

2

3

1

4

Fig. 12 A schematic view of two ANFIS modules considered for gait planning of the biped robotascending the staircase [7]

Fig. 13 Double supportphase during ascending thestaircases [11]

Fig Biped ascending staircase in double support phase posture

hip trajectory

direction of motion

supporting feet

6 Summary

We, human-beings, control various parts of our body in an adaptive way, whilewalking on some terrains in order to perform this task by consuming minimumpower and after maintaining balance. It is to be noted that we learn this factthrough the experience. The similar things have been copied here in an artificialway. Depending on the geometry of the staircases, the biped robot will have toplace its feet, control the movement of hip joint, trunk mass, and other components,so that it can negotiate the staircases (say while ascending the staircases) in the

24 D.K. Pratihar et al.

optimal sense. This chapter discusses on how to perform the above tasks using theprinciples of neural networks/fuzzy logic techniques. It is important to mention thatlearning here takes place using the principle of optimization (say, by adopting a toollike genetic algorithm), and the gathered knowledge during the training is stored inthe form of either neural networks or fuzzy logic techniques. Once trained, the bipedrobot will be able to tackle the varying situations efficiently.

7 Future Directions and Open Problems

• The present chapter deals with a simplified version of biped robot having sevendof. However, the actual biped robot (say humanoid robot) is a more complicatedstructure with many dof. It is difficult to carry out analysis, and controlling of itsbody parts is not so easy. Moreover, there could be interactions of various bodycomponents.

• For simplicity, the movement of the biped robot has been considered in thesaggittal plane only. However, sidewise movement of the biped robot is also tobe considered during its walking.

• The experience gained through this study could be useful for the design anddevelopment of orthotic devices to be utilized by the patients having weakerjoints.

• Environmental modeling is to be made faster and more accurate.• More efficient algorithm for gait and path generations is to be designed and

developed.

References

1. V. Pandu Ranga, S.K. Sahu, D.K. Pratihar, Dynamically balanced ascending and descendinggaits of a two-legged robot. Int. J. Humanoid Rob. 4(4), 717–751 (2007)

2. W.T. Miller, Real-time neural network control of a biped walking robot. IEEE Control Syst.Mag., 14(1) 41–48 (1994)

3. S. Murakami, E. Yamamoto, K. Fujimoto, Fuzzy control of dynamic biped walking robot, inProceedings of IEEE International Conference on Fuzzy System, Yokohama, Japan, 1995, pp.77–82

4. J.H. Park, Y.K. Rhee, ZMP trajectory generation for reduced trunk motions of biped robots,in Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems,Victoria, 1998, pp. 2014–2021

5. J. Lin, J. Chang, S.M. Lyu, S.W. Wang, Y.W. Lin, Locomotion control of a biped robot for stait-climbing by fuzzy stabilization tuning approach, in Proceeding of IEEE Multi-Conference onSystems and Control, Yokohama, 2010, pp. 1590–1595

6. V. Pandu Ranga, Gait generation of dynamically balanced biped robots using soft computing,PhD thesis, IIT Kharagpur (2009)

7. R. Rajendra, Modeling and simulations of robotic systems using soft computing, PhD thesis,IIT Kharagpur (2012)

8. O. Bebek, K. Erbatur, A fuzzy system for gait adaptation of biped walking robots, inProceeding of IEEE International Conference on Control Applications, 2003, Istanbul, Turkey,pp 669–674

Humanoid Body Control Using Neural Networks and Fuzzy Logic 25

9. D. Kim, S.J. Seo, G.T. Park, Zero-moment point trajectory modelling of a biped walking robotusing an adaptive neuro-fuzzy system. IEE Proc. Control Theory Appl. 152(4), 411–426 (2005)

10. K.S. Fu, R.C. Gonzalez, C.S.G. Lee, Robotics (McGraw-Hill Book, Singapore, 1987)11. R. Rajendra, D.K. Pratihar, Analysis of double support phase of biped robot and multi-objective

optimization using genetic algorithm and particle swarm optimization algorithm. Sadhana(2015). doi:10.1007/s12046-014-032-7-5

12. D.K. Pratihar, Soft Computing: Fundamentals and Applications (Narosa Publishing House,New-Delhi, 2014)

13. D.E. Goldberg, Genetic Algorithms in Search, Optimization, and Machine Learning (Addison-Wesley, Reading, 1989)

14. J. Holland, Adaptation in Natural and Artificial Systems (The University of Michigan Press,Ann Arbor, 1975)

15. L.A. Zadeh, Fuzzy sets. Inf. Control 8(3), 338–353 (1965)16. J.S. Jhang, ANFIS: Adaptive-network-based fuzzy inference system. IEEE Trans. Syst. Man

Cybern 23(3), 665–685 (1993)