**3. Assignment of motion**

The biped walking is a repeated physical action, thus, joint angle of the robot will follow up some circular principle. In this chapter, we adopt the trigonometric functions, which are the sine and the cosine, is widely applied for studying periodic problem. The general trigonometric function is proposed by Eq. (1). In motion, each leg of the robot performs walking behavior similarly to the other one, thus, we will use same gait function for each corresponding joint. In addition, the trajectory in sagittal plane of left leg is slower than right leg by 0*:*6*s* since a cycle is set to 1*:*2*s* while the hip and ankle joint gait data in frontal plane is identical for both of leg. We assign trajectories to all joints of the robot as described in Eq. (2)–(8). As can be seen that posture of the robot is defined at 0*:*3*s* in the beginning and stops motion at 3*:*3*s*. 0ð Þ � 0*:*3*s* period is used for preparation and 3ð Þ *:*3 � 4*:*8*s* period is used for checking stability.

$$\theta\_i(t) = a\_i + b\_i \cos\left(\alpha t\right) + c\_i \sin\left(\alpha t\right) + d\_i \cos\left(2\alpha t\right) \tag{1}$$

*Applying Improve Differential Evolution Algorithm for Solving Gait Generation Problem… DOI: http://dx.doi.org/10.5772/intechopen.98085*

Where *θ<sup>i</sup>* is the angle assigned to joint *i*, *ai*, *bi*,*ci*, *di* are coefficients; *t*, *i* are time and index of joint, respectively; *ω* is an angular velocity, *ω* = 5.236 (*rad=s*)

$$\theta\_1 = \begin{cases} 0; & t = 0 \text{ or } t \ge 3.6 \\ \pm 1.5; & t = 0.38 \text{at} = 3.3 \\ \theta\_1(t); & 0.3 < t < 3.3 \end{cases} \tag{2}$$

$$\theta\_2 = \begin{cases} 0; & t \le 0.3 \text{ or } t \ge 3.6 \\ \theta\_2 (t + 0.6); & 0.3 < t < 3.3 \\ 15; & t = 3.3 \end{cases} \tag{3}$$

$$\theta\_3 = \begin{cases} 0; & t \le 0.3 \, or \, t \ge 3.6 \\ \theta\_3(t + 0.6); & 0.3 < t < 3.3 \\ 30; & t = 3.3 \end{cases} \tag{4}$$

$$\theta\_4 = \begin{cases} 0; & t \le 0.3 \, or \, t \ge 3.6 \\ \theta\_4(t + 0.6); & 0.3 < t < 3.3 \\ 15; & t = 3.3 \end{cases} \tag{5}$$

$$\theta\_{\\$} = \begin{cases} 0; & t = 0 \text{ or } t \ge 3.3 \\ 15; & t = 0.3 \\ \theta\_2(t); & 0.3 < t < 3.3 \end{cases} \tag{6}$$

$$\theta\_6 = \begin{cases} 0; & t = 0 \text{ or } t \ge 3.3 \\ 30; & t = 0.3 \\ \theta\_3(t); & 0.3 < t < 3.3 \end{cases} \tag{7}$$

$$\theta\_{\heartsuit} = \begin{cases} 0; & t = 0 \,\text{or}\, t \ge 3.3 \\ 15; & t = 0.3 \\ \theta\_{4}(t); & 0.3 < t < 3.3 \end{cases} \tag{8}$$

## **4. Optimization problem with predictive function**

#### **4.1 Response surface methodology**

Response surface model (RSM) is a mathematical model which is used for an approximation of stochastic process and is firstly introduced by Box and Wilson [27]. Our research adopts 3*rd*-order RSM to predict output value of simulation such as lateral and walking distance, rotation angle. The expression of 3*rd*-order RSM is displayed by Eq. (9).

$$\tilde{P}(\mathbf{x}) = a\_{po} + \sum\_{i=1}^{n} b\_{pi} \mathbf{x}\_{i} + \sum\_{i=1}^{n} c\_{pii} \mathbf{x}\_{ii}^{2} + \sum\_{i \neq (i$$

Where *n* is a design variable number, *n* = 16, *xi* is a design variable, and *ap*, *bp*, *cp*, *dp* are the coefficients of terms. Number of sampling for initialization is calculated by Eq. 10.

**3. Assignment of motion**

**Figure 3.**

**Figure 2.** *Novel foot design.*

*Robotics Software Design and Engineering*

checking stability.

**44**

The biped walking is a repeated physical action, thus, joint angle of the robot will

*θi*ðÞ¼ *t ai* þ *bi cos*ð Þþ *ωt ci sin* ð Þþ *ωt di cos*ð Þ 2*ωt* (1)

follow up some circular principle. In this chapter, we adopt the trigonometric functions, which are the sine and the cosine, is widely applied for studying periodic problem. The general trigonometric function is proposed by Eq. (1). In motion, each leg of the robot performs walking behavior similarly to the other one, thus, we will use same gait function for each corresponding joint. In addition, the trajectory in sagittal plane of left leg is slower than right leg by 0*:*6*s* since a cycle is set to 1*:*2*s* while the hip and ankle joint gait data in frontal plane is identical for both of leg. We assign trajectories to all joints of the robot as described in Eq. (2)–(8). As can be seen that posture of the robot is defined at 0*:*3*s* in the beginning and stops motion at 3*:*3*s*. 0ð Þ � 0*:*3*s* period is used for preparation and 3ð Þ *:*3 � 4*:*8*s* period is used for

*Principle of arm swing: a) mechanism with linear spring; b) integration in simulation model.*

$$N\_s = \frac{(n+1)(n+2)}{2} + n.\tag{10}$$

from [1; *NP*]; and *NP*, *D*, number of individuals and problem dimensions, respectively. Scaling factor *F* is set to be high in the beginning iterations and after certain iteration, it automatically becomes smaller for proper exploitation. The value *F* is

*Applying Improve Differential Evolution Algorithm for Solving Gait Generation Problem…*

<sup>1</sup> <sup>þ</sup> *exp <sup>α</sup>* <sup>∗</sup> *<sup>i</sup>*�*NP*

Where *α* is the parameter that controls the value of scaling factor Fi as shown in

*iter* <sup>¼</sup> *Fmin* <sup>þ</sup> ð Þ *Fmax* � *Fmin itermax* � *iter*

Where *Fmax* and *Fmin* are the lower and upper limitation of *F*, respectively. Recommended values for *Fmax*, and *Fmin* are 0.8 and 0.15, respectively. *itermax*, and niter denote the maximum iteration, and the nonlinear modulation index. Niter is

Where *nmax* and *nmin* are selected in the [0, 15] range. *nmax* and *nmin* are 0.2 and 6.0, respectively. Finally, scaling factor *Fiter<sup>i</sup>* is calculated for each particle in each iteration as Eq. (20). The particle in population will receive different scaling factor. This mechanism maintains the balance of exploration and exploitation process in

*iter* <sup>¼</sup> *Fi* <sup>þ</sup> *<sup>F</sup>mean*

After mutation operation, ISADE adopts a crossover operation as Eq. (21).

*iter*

*niter* ¼ *nmin* þ ð Þ *nmax* � *nmin*

*Fi*

*<sup>i</sup>* as in Eq. (18).

2

*itermax niter*

*iter*

*itermax* (19)

<sup>2</sup> (20)

*NP* (17)

(18)

*Fi* <sup>¼</sup> <sup>1</sup>

generated by a Sigmoid function as in Eq. (17).

*DOI: http://dx.doi.org/10.5772/intechopen.98085*

ISADE gives an addition scaling *Fmean*

*Fmean*

**Figure 4**.

defined in Eq. (19).

mutation operation.

*5.1.2 Crossover operation*

**Figure 4.**

**47**

*Value of scale factor F depends on rank number i and α.*

With *n* = 16, we determine *Ns* = 169 samples.

#### **4.2 Optimization of gait trajectory**

The goal of biped robot is to gain maximum walking distance with stable gait. This first problem is solved by a set of objective function, to apply optimization algorithm, we convert a maximum problem to minimum one as Eq. (11). The second issue is controlled by constraint functions as Eqs. (12) and (13).

$$\text{Minimize } f(\mathbf{x}) = -\mathbf{Z}\_f \tag{11}$$

Subject to:

$$\mathbf{g}\_1(\mathbf{x}) = \mathbf{20} - |\mathbf{X}\_f| \ge \mathbf{0} \tag{12}$$

$$\log\_2(\mathbf{x}) = \mathbf{5} - |\mathcal{R}\_f| \ge \mathbf{0} \tag{13}$$

Where *Z <sup>f</sup>* ,*X <sup>f</sup>* , *Rf* is walking, lateral distance and rotation angle, respectively. Their values are approximated by mentioned 3*rd*-order RSM.

### **5. Self-adaptive differential evolution with gauss distribution**

This section introduce an modified self-adaptive differential evolution named G-SADE which is an improve version of Tam bui's algorithm (ISADE) proposed in [28].

#### **5.1 Improve self-adaptive differential evolution**

Reviewing on ISADE, it adopts an adaptive scaling factor of mutation process and adaptive mechanism for crossover control parameter. Scaling factor is generated by a sigmoid function with ranking individual in population. ISADE mainly consists of three operations.

#### *5.1.1 Mutation operation*

In [28], Tam Bui et al. randomly selected three mutation operation, which are DE/best/1, DE/best/2, and DE/rand to best/1. Among DE's operations, DE/best/1 and DE/best/2 are perceived for good convergence possession and DE/rand to best/1 is realized for good diversity property. Eqs. (14)–(16) shows the formula of chosen schemes.

$$\text{DE}/\text{best}/\mathbf{1}: \mathbf{V}\_{i,j}^{iter} = \mathbf{X}\_{best,j}^{iter} + F\*\left(\mathbf{X}\_{r1,j}^{iter} - \mathbf{X}\_{r2,j}^{iter}\right) \tag{14}$$

$$\text{DE}/\text{best}/2: V\_{i,j}^{\text{iter}} = X\_{\text{best},j}^{\text{iter}} + F\* \left(X\_{r1,j}^{\text{iter}} - X\_{r2,j}^{\text{iter}}\right) + F\* \left(X\_{r3,j}^{\text{iter}} - X\_{r4,j}^{\text{iter}}\right) \tag{15}$$

$$\text{DE}/\text{best}/2: \mathbf{V}\_{i,j}^{iter} = \mathbf{X}\_{r1,j}^{iter} + \mathbf{F} \* \left(\mathbf{X}\_{best,j}^{iter} - \mathbf{X}\_{r1,j}^{iter}\right) + \mathbf{F} \* \left(\mathbf{X}\_{r2,j}^{iter} - \mathbf{X}\_{r3,j}^{iter}\right) \tag{16}$$

Where *V*, mutation vector; *X*, current vector; *Xbest*, best vector in current population; *iter*, number of iterations; *i*, index of individual in population, *NP*; *j*, index of dimensions, *D*;*r*1,*r*2,*r*3, and *r*4 are different particles selected randomly *Applying Improve Differential Evolution Algorithm for Solving Gait Generation Problem… DOI: http://dx.doi.org/10.5772/intechopen.98085*

from [1; *NP*]; and *NP*, *D*, number of individuals and problem dimensions, respectively. Scaling factor *F* is set to be high in the beginning iterations and after certain iteration, it automatically becomes smaller for proper exploitation. The value *F* is generated by a Sigmoid function as in Eq. (17).

$$F\_i = \frac{1}{1 + \exp\left(a\*\frac{i-\frac{NP}{2}}{NP}\right)}\tag{17}$$

Where *α* is the parameter that controls the value of scaling factor Fi as shown in **Figure 4**.

ISADE gives an addition scaling *Fmean <sup>i</sup>* as in Eq. (18).

$$F\_{iter}^{mean} = F\_{min} + (F\_{max} - Fmin) \left(\frac{iter\_{max} - iter}{iter\_{max}}\right)^{n\_{irr}} \tag{18}$$

Where *Fmax* and *Fmin* are the lower and upper limitation of *F*, respectively. Recommended values for *Fmax*, and *Fmin* are 0.8 and 0.15, respectively. *itermax*, and niter denote the maximum iteration, and the nonlinear modulation index. Niter is defined in Eq. (19).

$$n\_{iter} = n\_{min} + (n\_{max} - n\_{min}) \left(\frac{iter}{iter\_{max}}\right) \tag{19}$$

Where *nmax* and *nmin* are selected in the [0, 15] range. *nmax* and *nmin* are 0.2 and 6.0, respectively. Finally, scaling factor *Fiter<sup>i</sup>* is calculated for each particle in each iteration as Eq. (20). The particle in population will receive different scaling factor. This mechanism maintains the balance of exploration and exploitation process in mutation operation.

$$F\_{iter}^{i} = \frac{F\_i + F\_{iter}^{mean}}{2} \tag{20}$$

#### *5.1.2 Crossover operation*

*Ns* <sup>¼</sup> ð Þ *<sup>n</sup>* <sup>þ</sup> <sup>1</sup> ð Þ *<sup>n</sup>* <sup>þ</sup> <sup>2</sup>

The goal of biped robot is to gain maximum walking distance with stable gait. This first problem is solved by a set of objective function, to apply optimization algorithm, we convert a maximum problem to minimum one as Eq. (11). The second issue is controlled by constraint functions as Eqs. (12) and (13).

Where *Z <sup>f</sup>* ,*X <sup>f</sup>* , *Rf* is walking, lateral distance and rotation angle, respectively.

This section introduce an modified self-adaptive differential evolution named G-SADE which is an improve version of Tam bui's algorithm (ISADE) proposed in [28].

Reviewing on ISADE, it adopts an adaptive scaling factor of mutation process and adaptive mechanism for crossover control parameter. Scaling factor is generated by a sigmoid function with ranking individual in population. ISADE mainly

In [28], Tam Bui et al. randomly selected three mutation operation, which are DE/best/1, DE/best/2, and DE/rand to best/1. Among DE's operations, DE/best/1 and DE/best/2 are perceived for good convergence possession and DE/rand to best/1 is realized for good diversity property. Eqs. (14)–(16) shows the formula of chosen

*<sup>i</sup>*,*<sup>j</sup>* <sup>¼</sup> *<sup>X</sup>iter*

*best*,*<sup>j</sup>* <sup>þ</sup> *<sup>F</sup>* <sup>∗</sup> *<sup>X</sup>iter*

*<sup>r</sup>*1,*<sup>j</sup>* <sup>þ</sup> *<sup>F</sup>* <sup>∗</sup> *<sup>X</sup>iter*

*best*,*<sup>j</sup>* <sup>þ</sup> *<sup>F</sup>* <sup>∗</sup> *<sup>X</sup>iter*

*<sup>r</sup>*1,*<sup>j</sup>* � *<sup>X</sup>iter r*2,*j*

*best*,*<sup>j</sup>* � *<sup>X</sup>iter r*1,*j*

Where *V*, mutation vector; *X*, current vector; *Xbest*, best vector in current population; *iter*, number of iterations; *i*, index of individual in population, *NP*; *j*, index of dimensions, *D*;*r*1,*r*2,*r*3, and *r*4 are different particles selected randomly

*<sup>r</sup>*1,*<sup>j</sup>* � *<sup>X</sup>iter r*2,*j*

(14)

(15)

(16)

<sup>þ</sup> *<sup>F</sup>* <sup>∗</sup> *<sup>X</sup>iter*

<sup>þ</sup> *<sup>F</sup>* <sup>∗</sup> *<sup>X</sup>iter*

*<sup>r</sup>*3,*<sup>j</sup>* � *<sup>X</sup>iter r*4,*j*

*<sup>r</sup>*2,*<sup>j</sup>* � *<sup>X</sup>iter r*3,*j*

Their values are approximated by mentioned 3*rd*-order RSM.

**5.1 Improve self-adaptive differential evolution**

*DE=best=*1 : *Viter*

*<sup>i</sup>*,*<sup>j</sup>* <sup>¼</sup> *<sup>X</sup>iter*

*<sup>i</sup>*,*<sup>j</sup>* <sup>¼</sup> *<sup>X</sup>iter*

consists of three operations.

*DE=best=*2 : *Viter*

*DE=best=*2 : *Viter*

*5.1.1 Mutation operation*

schemes.

**46**

**5. Self-adaptive differential evolution with gauss distribution**

With *n* = 16, we determine *Ns* = 169 samples.

**4.2 Optimization of gait trajectory**

*Robotics Software Design and Engineering*

Subject to:

<sup>2</sup> <sup>þ</sup> *<sup>n</sup>:* (10)

*Minimize f x*ð Þ¼�*Z <sup>f</sup>* (11)

*g*1ð Þ¼ *x* 20 � ∣*X <sup>f</sup>* ∣ ≥0 (12) *g*2ð Þ¼ *x* 5 � ∣*Rf* ∣ ≥0 (13)

After mutation operation, ISADE adopts a crossover operation as Eq. (21).

**Figure 4.** *Value of scale factor F depends on rank number i and α.*

$$U\_{i\dot{j}}^{iter} = \begin{cases} V\_{i\dot{j}}^{iter} & \text{if } rand[0, \mathbf{1}] \le CR \text{ or } j = j\_{rand} \\\\ X\_{i\dot{j}}^{iter} & \text{otherwise.} \end{cases} \tag{21}$$

**Pseudocode 2: Implement of optimization**

*DOI: http://dx.doi.org/10.5772/intechopen.98085*

3.While termination condition is not reached; Making 3rd order response surface model;

4. The optimal value of design variable is achieved

2. Design of experiment.

**6. Results and discussions**

**Figure 5.**

**Table 2.**

**49**

*Design variable value.*

*Considered surface for simulation.*

robot. This is a absolutely flat terrain.

1. Achieving the first simulation in Adams by Trial and Error method.

Analyzing the result through dynamic simulation in Adams.

Applying ISADE with objective function 11 and constraint function 12, 13

*Applying Improve Differential Evolution Algorithm for Solving Gait Generation Problem…*

Surfaces shown in **Figure 5** is employed to present the walking process of biped

To observe the effect of arm swing mechanism on walking behavior, we build the 3D robot model in dynamic simulated environment of Adams software. Two configurations of the robot with different arm mechanism are considered as the following: firstly, we lock shoulder joint of the arm or in other respects the upper body is a static block with no movement. Second configuration is designed with a 1-32DoF shoulder joint which is set in sagittal plane. The biped motion is studied and evaluated on an above-mentioned environment. After applying G-SADE algorithm to solve optimiza-

tion problem, we gain the optimal design variable is presented in **Table 2**. By

**Figure 6**. After all, results of simulation are presented in **Figure 7**.

**i Optimal design variables.**

*ai bi ci di*

 0.0034 0.0446 0.0011 �0.0070 0.0410 0.2104 0.0007 0.0134 0.4138 0.0388 �0.1894 �0.1108 �0.2453 0.1460 0.1031 0.0493

replacing the term coefficients of *i*, *ai*, *bi*,*ci*, *di* in Eq. (1) with these optimal value, we will define four gait functions for all joints of the legs and trajectory is ruled by the principle shown by Eqs. (2)–(8). To be clear, we can see these gait patterns in

Where *U*,*V*, and *X* are a trial vector, mutation vector, and current vector, respectively. *CR* is a crossover parameter within the interval (0,1). *j rand* is an integer random number selected from set {1, 2, … , D}.

#### *5.1.3 Selection operation*

This stage will choose the better fitness between trial vector U and target vector X for the next generation as Eq. (22).

$$X\_i^{iter+1} = \begin{cases} U\_i^{iter} & \text{if } f\left(U\_i^{iter}\right) \not\le f\left(X\_i^{iter}\right) \\\\ X\_i^{iter} & \text{otherwise.} \end{cases} \tag{22}$$

#### **5.2 Self-adaptive differential evolution with gauss distribution**

Gauss distributions play an important role in statistics and are often used to generate real-valued random variables. Gaussian distribution gives a fantastic possibility to control the exploiting zone in optimization based on complexity of each considered problem. Our proposed strategy generates a new trial vectors in mutation operation by multiply Gauss random variable to a vector difference (*Xiter <sup>r</sup>*1,*<sup>j</sup>* � *<sup>X</sup>iter r*2,*j* ) in Eq. (14) and (*Xiter <sup>r</sup>*3,*<sup>j</sup>* � *<sup>X</sup>iter r*4,*j* ) in Eq. (15).

The formula of schemes in mutation operation is modified as the following Eq. (23) and (24).

$$\text{DE}/\text{best}/\mathbf{1}: \mathbf{V}\_{i,j}^{iter} = X\_{best,j}^{iter} + N(\mathbf{0}, \sigma^2) \ast F \ast \left(X\_{r1,j}^{iter} - X\_{r2,j}^{iter}\right) \tag{23}$$

$$\text{DE}/\text{best}/2: \text{V}\_{i,j}^{\text{iter}} = \text{X}\_{\text{best},j}^{\text{iter}} + N(\mathbf{0}, \sigma^2) \ast \left[\mathbf{F} \ast \left(\mathbf{X}\_{r1,j}^{\text{iter}} - \mathbf{X}\_{r2,j}^{\text{iter}}\right) + \mathbf{F} \ast \left(\mathbf{X}\_{r3,j}^{\text{iter}} - \mathbf{X}\_{r4,j}^{\text{iter}}\right)\right] \tag{24}$$

Where N(0,*σ*2) is a Gauss random variable with mean *zero* and standard deviation *σ*. Recommended value for *σ* is 0.1. The new proposed DE is implemented as in Pseudocode 1 and The optimization process is described in Pseudocode 2.


2.**Evaluation and ranking population**: Evaluating and ordering all individuals based on their fitness value. Next, the first best NP individuals are selected to survive and kept for the next generation.

4.**Mutation operation**: Mutation vectors V are created by applying adaptive selection learning strategy through Eq. (23) to (24).

7. Steps 2 to 6 is repeated while termination condition is checked

<sup>3.</sup>**Adaptive scaling factor**: Computing scale factors F by Eqs. (17) to (20).

<sup>5.</sup>**Crossover operation**: Calculating trial vector U using Eq. (21).

<sup>6.</sup>**Selection Operation**: Comparing trial vector *Uiter <sup>i</sup>* to target vector *Xiter <sup>i</sup>* is implemented based on evaluating their fitness value.

The better candidate will be chosen for propagating new offspring in the next generation by Eq. (22).

