A general CPG network and its implementation on the microcontroller

A general CPG network and its implementation on the microcontroller

Neurocomputing ∎ (∎∎∎∎) ∎∎∎–∎∎∎ Contents lists available at ScienceDirect Neurocomputing journal homepage: www.elsevier.com/locate/neucom A general...

1MB Sizes 0 Downloads 30 Views

Neurocomputing ∎ (∎∎∎∎) ∎∎∎–∎∎∎

Contents lists available at ScienceDirect

Neurocomputing journal homepage: www.elsevier.com/locate/neucom

A general CPG network and its implementation on the microcontroller Liang Li, Chen Wang, Guangming Xie n Intelligent Control Laboratory, College of Engineering, Peking University, Beijing 100871, PR China

art ic l e i nf o

a b s t r a c t

Article history: Received 12 May 2014 Received in revised form 21 April 2015 Accepted 23 April 2015 Communicated by R.W. Newcomb

Over the last few years, it has been confirmed by the biologists that Central Pattern Generator (CPG) is the key mechanism of generating adaptive and versatile locomotion in animals. This gives a new inspiration of locomotion control for robots. Although the design of CPG controller using coupled oscillators has been proposed previously, it cannot comprehensively reproduce different rhythmic motion along with smooth transitions to mimic the versatility of animal locomotion. To tackle this problem, we propose a general CPG model emphasizing on its stability analysis, smooth transition and implementation architecture. Global exponential stability of the model is derived by using strict mathematical analysis. Transitions between different oscillating forms are also smooth, and the implementation architecture has low computational cost, thus suitable for microcontrollers. Moreover, all control parameters not only have clear relationships with the physical outputs, but also can be modified online. Both virtual and real robotic fish are developed to verify the effectiveness of our CPG controller together with the proposed implementation architecture, through the experiments of four locomotion gaits and three transitions among them. Crown Copyright & 2015 Published by Elsevier B.V. All rights reserved.

Keywords: Central Pattern Generator (CPG) Implementation architecture Microcontroller system Virtual reality simulation Robotic fish

1. Introduction With million years of evolution, animals are endowed with the basic ability to efficiency move in complex environments. An enormous amount of experimental and theoretical researches have been performed by numerous biologists to uncover the locomotion mechanism concealed by this ability [1,2]. They found that the locomotion controls both in vertebrate and invertebrate animals are mainly depended on a special neural network named Central Pattern Generator (CPG). All these findings give an inspiration to the researches of robotics, in which researchers try to provide robots with good locomotor skills to adapt to a variety of environments. Compared to traditional locomotion controllers that highly depend on the priori knowledge of environment, CPG models have the following three main advantages [3,4]: (1) highly accurate dynamic model is not required and all the control parameters can be optimized online according to external environments, (2) CPG is capable of sustaining rhythmic motion in the absence of inputs sent by brain controller, thus the high-level controller is free to deal with other complicated tasks, (3) transitions between locomotion patterns are smooth. There are an increasing number of applications of CPG controllers applied in robots, such as flapping flight robot [5], robotic fish [6] and

n

Corresponding author. E-mail addresses: [email protected] (L. Li), [email protected] (C. Wang), [email protected] (G. Xie).

humanoid robot [7]. To the authors' knowledge, all previous CPG controllers are designed in a special oscillation form (i.e., sinusoidal oscillation, harmonic oscillation and special nonharmonic oscillation). Furthermore the smooth transitions are implemented only among these special oscillating forms. Ijspeert et al. [8] proposed an oscillatorbased CPG controller for a salamander-like robot which focused on the transitions between gaits on the land and in the water. Moreover, they supposed all rhythmic motion including the transition is in sinusoidal oscillation. Zhao et al. [9] developed a CPG controller based on Hopf oscillator to achieve flexible locomotion of a robotic turtle. However, all the outputs of CPG are regarded as harmonic oscillation. Zhou and Low [10] designed a CPG controller for the locomotion control of a robotic manta ray based on Hopf oscillator. A special nonharmonic oscillating form of this control is considered and only modified by the speed of rising and declining phase, while the detailed processes of rising and declining are ignored. Nevertheless, locomotion of creatures contains many oscillating and switching forms that are different from the above movement forms. For instance, in [11–13], researches found both sinusoidal and nonsinusoidal oscillating movements of vertebrates and invertebrates. Lamprey usually superimposes periodic and secular movements to adjust its body wave to overcome the unsteadiness in swimming [14]. And several smooth transitions are usually triggered when a lamprey swims in a complex environment. Moreover, in order to capture energy from vortices, a novel gait called Karman gait is shown by fish in school [15]. These gaits contain both a lot of irregular rhythmic motion and frequent smooth transitions. Therefore, a general form CPG that can mimic all the natural rhythmic

http://dx.doi.org/10.1016/j.neucom.2015.04.066 0925-2312/Crown Copyright & 2015 Published by Elsevier B.V. All rights reserved.

Please cite this article as: L. Li, et al., A general CPG network and its implementation on the microcontroller, Neurocomputing (2015), http://dx.doi.org/10.1016/j.neucom.2015.04.066i

L. Li et al. / Neurocomputing ∎ (∎∎∎∎) ∎∎∎–∎∎∎

2

oscillations is needed, so as to obtain a further understanding of the mechanism of locomotion control in nature. In this paper, an improved CPG model is proposed based on [16], which supports locomotion in arbitrarily rhythms, plus of smooth transitions among them, especially between different oscillating forms. A CPG model based on neural network, such as CPG controller based on Matsuoka oscillator [17], may generate any rhythmic motion. Incapable of strict mathematical analysis on stability and simple engineering implementation, these models are rarely applied on microcontroller-based robots. The proposed CPG controller in general form is not only endowed with global exponentially stability, but also can be implemented on microcontrollers with low computational cost. Moreover, a simple implementation architecture is built so as to implement our CPG controller in microcontrollers easily. As a case study, we apply our CPG controller and implementation architecture to a three-link robotic fish. Validity of the proposed approaches is verified by simulations using virtual reality technology and experiments on a real robotic fish. The reminder of this paper is organized as follows. In Section 2, the architecture of our CPG controller is described and an in-depth stability analysis is given. A detailed implementation of a CPG controller in a microcontroller system is introduced in Section 3. In Section 4, simulation results of a three-link robotic fish are shown to demonstrate the effectiveness of our proposed method. And some conclusions are summarized in Section 5.

2. Architecture of CPG controller In this section, a general form of CPG controller based on the CPG model in [16] is proposed and its stability analysis is also given. 2.1. CPG controller in a general form Consider a CPG network with N oscillators and we assume that the ith oscillator is in the following form: r_ i ðtÞ ¼ αi ðRi  r i Þ

ð1Þ

x_ i ðtÞ ¼ β i ðX i  xi Þ

ð2Þ

ϕ€ i ðtÞ ¼

N X j ¼ 1;j a i

h







i

μij μij ϕj ðtÞ  ϕi ðtÞ  φij  2 ϕ_ i ðtÞ  2πω ; h

i



ϕi ðt kþ Þ ¼ Hσðt1kþ Þ Hσðtk Þ ϕi ðt k Þ ; 



θi ðtÞ ¼ xi ðtÞ þr i ðtÞH σ ϕi ðtÞ ;

ϕ_ i ðt kþ Þ ¼ H_ σðtkþ Þ ðϕi ðt kþ ÞÞ

t A ½t k  1 ; t k Þ

ð3Þ ð4Þ

where Eqs. (1)–(3) are the dynamical equations and Eq. (4) is the output equation. ri, xi and ϕi are state variables of ith oscillator, respectively denoting the amplitude, the offset and the phase, and θi being the output variable of ith oscillator. Ri, Xi, φij and ω represent the desired amplitude, offset, phase difference and frequency, respectively. αi and βi are structure parameters, representing the dynamic performance of ith oscillator. μij is also a structure parameter, denoting the strength of coupling between ith oscillator and jth oscillator. Let  H p : p A P ¼ f1; 2; …g be a family of 2π-periodic functions from R to ½  1; 1. And H p 1 ðϕÞ A ½0; π  denotes the inverse function of H p ðϕÞ, H_ p ðϕÞ ðϕ A ½0; π ) is the derivation of H p ðϕÞ. σ ðtÞ : ½0; þ1Þ-P is a piecewise constant function of time, called switching signal of oscillating form function H σ . t k A R þ , ft k g1 0 called switching sequence, satisfies 0 ¼ t 0 o t 1 o ⋯ o t k  1 o t k o ⋯ þ 1. When t A ½t k  1 ; t k Þ, σ ðtÞ ¼ ik A P and meanwhile the corresponding periodic function H ik  1 converts to H ik .

In our CPG controller, different rhythmic locomotion and transitions between them are included. A block diagram consisting of three oscillators is shown in Fig. 1. For each oscillator, Eqs. (1) and (2) ensure the amplitude and offset gradually increase to the desired inputs. And Eq. (3) makes all the oscillators converge to the same frequency and desired phase differences. Moreover, another important element of creature locomotion is the oscillating form H σ , which is mainly adjusted by living creatures. According to whether the oscillation is changed, we divide locomotion pattern transitions into two classes. One is called basic pattern transition, in which basic CPG parameters Ri , X i , φij and ω vary; another is called oscillating form transition, in which both basic CPG parameters and/or oscillating form H σ can be controlled. Stability and smooth transitions are totally considered, and then strict mathematical analysis is given.

Fig. 1. A typical CPG network with three oscillators. The inputs are the amplitudes Ri, the offsets Xi, phase differences φij, frequency ω and oscillating switching signal σ. The outputs are the angles of the joints θi. (i; j ¼ 1; 2; 3, and i a j ).

2.2. Stability analysis In order to simplify analysis and computation, the following two assumptions are made. (1) φij satisfies the following three conditions: φii ¼ 0, φij ¼  φji and φik þ φkj ¼ φij . (2) α A R þ , β A R þ and μ A R þ of each oscillator are respectively set as the same ones denoted by αi, βi and μij. In order to derive the stability, smooth transitions and other properties of the model, solutions of differential equations (1)–(3) are considered. Eqs. (1) and (2) explain the dynamics of amplitude and offset of oscillator i, and solutions are r i ðtÞ ¼ Ri  Ri e  αt ;

ð5Þ

xi ðtÞ ¼ X i X i e  βt ;

ð6Þ

which mean ri(t) and xi(t), respectively, converge to Ri and Xi exponentially. And the convergence speed depends on the structure parameter α or β. In order to simplify the analysis of phase variables, Eq. (3) is written in a matrix form by denoting ϕ as a column vector ½ϕ1 ϕ2 ⋯ ϕN T

ϕ€ ¼ Aϕ_ þ Bϕ þ C;

ð7Þ

where A ¼  2ðN  1ÞμI N ; B ¼ μ J NN  NI N , 2 4π ðN  1Þv PN 3 þ j ¼ 2 φ1j μ 6 7 6 4π ðN  1Þv þ PN 7 6 j ¼ 1;j a 2 φ2j 7 μ 6 7 6 7 ⋮ 7; C ¼ μ2 6 P 6 4π ðN  1Þv þ N 7 6 j ¼ 1;j a i φij 7 μ 6 7 6 7 ⋮ 4 5 P N 4π ðN  1Þv þ j ¼ 1;j a N φNj μ 2

where IN is an unit matrix and J NN is a matrix of unit elements.

Please cite this article as: L. Li, et al., A general CPG network and its implementation on the microcontroller, Neurocomputing (2015), http://dx.doi.org/10.1016/j.neucom.2015.04.066i

L. Li et al. / Neurocomputing ∎ (∎∎∎∎) ∎∎∎–∎∎∎

Decoupling is the first step to solve Eq. (3) because ϕi in Eq. (3) is coupled. Suppose an invertible matrix T is 2 3 1 1 1 ... 1 61 1 0 ... 0 7 6 7 6 7 61 0 1 ... 0 7 6 7; 6 7 ⋮ ⋮ ⋱ ⋮ 5 4⋮ 1 0 0 … 1 and the inverse matrix is 2 1 1 1 6 1 N1 1 6 6 6 1 1 N1 6 6 ⋮ ⋮ 4 ⋮ 1

1

Let z ¼ T z€ ¼ T

1

... ... ... ⋱

1 1



3

1

1 7 7 7 1 7 7: 7 ⋮ 5 N1

AT z_ þ T  1 BTZ þ T  1 C;

ð8Þ

therefore it can be simplified as z€ ¼ Az_ þ DZ þ T  1 C;

ð9Þ

0

0

1

and because φij þ φji ¼ 0, T  1 C can be simplified as 2 3 4ðN  1Þπωμ 6 μ 2 P2 7 6 j ¼ 1;j a 1 φj2 7 6 7: 6 7 ⋮ 4 5 P

μ2

2 j ¼ 1;j a i

φji

Then the solution of Eq. (9) is as 2 3 c11 þc12 e  2ðN  1Þμt þ 2πωt 6 c eλ1 t þ c eλ2 t þ 1 PN 7 6 21 22 j ¼ 1;j a 2 φj2 7 N 7 z¼6 6 7 ⋮ 4 5 P φ cN1 eλ1 t þ cN2 eλ2 t þ N1 N j ¼ 1;j a i ji

ϕ is 2

6 6 ϕ ¼ TZ ¼ 6 6 4

z1 

PN

i¼2

z1 þ z2 ⋮

zi

ð10Þ

3 7 7 7 7 5

2πωt þ c11 þ c12 e  2ðN  1Þμt þ N1

ð12Þ Therefore, phase differences (ϕi  ϕj ) also exponentially converge to the desired CPG parameter φij by our model. In particular, when an oscillating form is switched, initial values ϕi ðt k Þ including ϕ_ i ðt k Þ for Eq. (11) should be redefined by the condition described in Eq. (3) to guarantee the smooth transitions between different oscillating forms.

This section presents the engineering implementation of CPG network in general microcontrollers. In order to implement our proposed CPG controller to low computing power microcontrollers, two key points of implementation are given. Moreover, implementation steps concluded with a pseudo-code algorithm. 3.1. Key points and architecture of the implementation

r i ðn þ 1Þ ¼ r i ðnÞ þ h  αðRi  r i ðnÞÞ

ð13Þ

xi ðn þ 1Þ ¼ xi ðnÞ þ h  β ðX i  xi ðnÞÞ

ð14Þ

8 <

μ2

:

N h X

ϕi ðnÞ  ϕj ðnÞ  φji

i

j ¼ 1;j a i

9

= þ 2ðN  1Þ  μ dϕi ðnÞ  2πω ;

ð15Þ

ϕi ðn þ 1Þ ¼ ϕi ðnÞ þ h  dϕi ðnÞ

ð16Þ 



θi ðn þ 1Þ ¼ xi ðn þ1Þ þr i ðn þ1Þ  HσðnÞ ϕi ðn þ1Þ ;

ð17Þ

þ

where h is time step, and n A N denotes the iteration step. The selection of h is crucial for the convergence of these difference equations. Eq. (13) can be rewrite as r i ðn þ 1Þ þ ðh  α  1Þr i ðnÞ þ h  αRi ¼ 0

ð18Þ

Thus, the characteristic equation of the difference equation (18) is

z1 þ zn 2

N N 1 X 1 X N 1 1 φ  φ ¼ φpq þ ðφq  φp Þ ¼ φpq N j ¼ 1;j a q ji N j ¼ 1;j a p ji N N

dϕi ðn þ 1Þ ¼ dϕi ðnÞ h 

where coefficients cij are determined by initial values ϕi ðt k Þ and qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ϕ_ i ðt k Þ, while tk is the triggering time, λ1 ¼  ðN  1Þ þ ðN  1Þ2  N qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi and λ2 ¼ ðN 1Þ  ðN  1Þ2  N . Therefore the analytical solution of

lim ðϕq  ϕp Þ ¼

t-1

Microcontrollers have a limited computing power as they are based on the Reduced Instruction Set Computing (RISC), and cannot realize operations for some complex control algorithms in real-time manner. Therefore, designing a high-efficiency controller is of great significant to microcontrollers in robots. Discretization is necessary for implementing our continuous CPG model on a digital microcontroller. Eulerian difference method is applied to seek a balance between the limited computing power of microcontrollers and proper calculation precision. Let dϕi denote _ . Thereupon, the difference the first order differential of phase ϕ i equation of Eqs. (1)-- (4) can be written as

3

07 7 7; ⋮5



0

difference is

3. Implementation of CPG network

ϕ, Eq. (7) can be rewritten as

where D equals 2 0 0 ... 60 1 ... 6 6 4⋮ ⋮ ⋱

3

PN

j¼2

φj1

3

6 7 6 2πωt þ c þc e  2ðN  1Þμt þ c eλ1 t þ c eλ2 t þ 1 PN 7 11 12 21 22 6 j ¼ 1;j a 2 φj2 7 N ¼6 7 6 7 ⋮ 4 5 PN 1  2ðN  1Þμt λ t λ t þ cN1 e 1 þcN2 e 2 þ N j ¼ 1;j a i φjN 2πωt þ c11 þ c12 e ð11Þ In Eq. (11), limt-1 ϕi ¼ 2πωt and phases of each oscillator exponentially converge to a stable state depending on CPG parameter ω. For pth and qth oscillators (1 o p a q o N), their stable phase

x þ hα 1 ¼ 0

ð19Þ

Characteristic root of Eq. (19) is x ¼ 1  hα, and Eq. (18) is global stability if and only if j xj o1, namely, 0 o h o 2=α. Similarly, in Eq. (14), time step h should satisfy 0 o h o2=β . Stability analysis of differential equations (15) and (16) is difficult because the variable ϕi is coupled. Since Eq. (9) is a decoupling form of Eq. (3), stability of Eqs. (15) and (16) can be analyzed through differential equations of Eq. (9), which is divided into two forms of differential equation: z€1 ¼  2ðN  1Þμz_1 þ c01

ð20Þ

Please cite this article as: L. Li, et al., A general CPG network and its implementation on the microcontroller, Neurocomputing (2015), http://dx.doi.org/10.1016/j.neucom.2015.04.066i

L. Li et al. / Neurocomputing ∎ (∎∎∎∎) ∎∎∎–∎∎∎

4

z€i ¼  2ðN  1Þμz_i  N μ2 zi þ c0i ; i4 1

ð21Þ

The differential form of Eq. (20) with time step h is dz1 ðn þ 1Þ ¼ dz1 ðnÞ þ h½  2ðN  1Þμ

ð22Þ

1 dz1 ðnÞ ¼ ½z1 ðn þ 1Þ  z1 ðnÞÞ h

ð23Þ

1 dz1 ðn þ 1Þ ¼ ½z1 ðn þ 2Þ  z1 ðn þ 1Þ h

ð24Þ

dz1 þ c01 

1 2 3 4 5 6

Substitute Eqs. (23) and (24) into Eq. (22) 0

z1 ðn þ2Þ þ2½μhðN  1Þ  1z1 ðn þ 1Þ þ ½1  2μhðN  1Þz1 ðnÞ ¼ hc1

7 8 9

PSEUDO-CODE.

initialization repeat if locomotion pattern transition then Update CPG control parameters if Oscillating form need change _ then Calculate corresponding ϕi and ϕ i else Update amplitude ri and its derivative r_i Update offset xi and its derivative x_i _ Update phase ϕ and its derivative ϕ i

i

Update output angle θi 11 if minðϕi Þ Z 2π 12 then ϕi ’ϕi  2π 13 until Received “stop control” from the up computer by wireless communication. 10

ð25Þ And then, characteristic equation of Eq. (25) is x2 þ2½μhðN  1Þ  1x þ 1  2μhðN  1Þ ¼ 0

CPG IMPLEMENTATION

ð26Þ

Hence, the corresponding characteristic roots of Eq. (26) are x1 ¼ 1 and x2 ¼ 1  2μhðN  1Þ, which should satisfy j x2 j o 1 to make Eq. (25) converge exponentially, namely 0 o h o1=μðN  1Þ. Similarly, qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi in Eq. (21) we get 0 oh o 2=μ½ðN  1Þ  ðN  1Þ2  N  and qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 0 o h o 2=μ½ðN  1Þ þ ðN  1Þ2  N . Therefore, time step h should satisfy h o 1=μðN  1Þ in Eqs. (16) and (15). To sum up, h should be smaller than minf1=μðN  1Þ; 2=α; 2=βg because of the same fixedstep being used in our controller. Although Hp is a 2π-periodic function from  1 to 1, the independent variable ϕ is a function of time t (see the solution equation (11)), which may result the register overflow. Periodization of ϕ is also necessary before the CPG controller is used in a microcontroller system. Because the phases are coupled, this problem cannot be tackled by subtracting 2π for each oscillator whenever each ϕi is equal or larger than 2π. This problem is addressed through simultaneously triggering periodization for all phases when the minimum phase reaches 2π. Phase differences keep unchanged though some phase values may be a little larger than 2π by this method. Fig. 2 depicts the phase outputs with periodization and phase difference in a threeoscillator-coupled network. Phase differences shown in Fig. 2 (b) reach the desired states exponentially, verifying the validity of this method.

where step 5 means the oscillating form transition checking.

4. Application to a bio-inspired robotic fish In this section, the CPG controller is applied in a bio-inspired robotic fish. At first, a brief introduction to the robotic fish and methods of application of the controller are given. And then, a robotic virtual reality animating the robotic fish is applied to simulate the movements with our controller. Finally, the CPG controller is tested on the AVR microcontroller in a real robotic fish. 4.1. Robotic prototype and control structure design A radio-controlled, three-link fish-like swimming robotic fish [18] is tested under the laboratory environment. This robotic fish consists of three parts: a rigid head, a flexible body and a caudal fin (as shown in Fig. 3). Inspired by real fish in nature, this robotic fish generates propulsion by a rhythmic undulation of its body, which adopts three joints to mimic all locomotion patterns, therefore three oscillators are arranged in the CPG network.

Fig. 3. Prototype of a robotic fish with three joints. Fig. 2. (a) Periodization of phase whenever the minimum of three phases reaches 2π. (b) Three phase differences still converge to the desired states.

A detailed pseudo-code of our CPG network is shown hereinafter to conclude the notes, which benefits the implementation in actual applications. Detecting the update of control parameters is also included during the physical implementation besides generating oscillating outputs. That is to say, CPG parameters can be modified in real time without turning power off, which contributes to online control parameters update.

Fig. 4 schematically shows structure of the CPG controller and the robotic fish. The CPG network applied in the robotic fish consists of three oscillators arranged in a chain form. Each oscillator generates one angle output, which is converted to a Pulse Width Modulation (PWM) signal to drive the corresponding servomotor. Both the CPG controller and PWM generator algorithm are run on a AVR microcontroller, which is cheap and of little power consumption. All CPG parameters are received and sent to the CPG network through the serial ports in AVR. Moreover,

Please cite this article as: L. Li, et al., A general CPG network and its implementation on the microcontroller, Neurocomputing (2015), http://dx.doi.org/10.1016/j.neucom.2015.04.066i

L. Li et al. / Neurocomputing ∎ (∎∎∎∎) ∎∎∎–∎∎∎

our proposed implementation architecture enables all the CPG controller, transition detection and PWM generation to be processed by the AVR chip in a real-time manner.

5

Table 1 Parameters set in simulation. States

State 1

State 2

State 3

State 4

Time (s) R1 (rad) R2 (rad) R3 (rad) X1 (rad) X2 (rad) X3 (rad) φ12 (rad) φ13 (rad) ω (Hz) Hp

[0, 3) 0.2269 0.4014 0.4887 0 0 0 1.396 2.094 0.4808 H1

[3, 6) 0.2967 0.4712 0.5585 0.733 0.8203 0.9076 1.396 2.094 1.1364 H1

[6, 9) 0.2967 0.4712 0.5585 0.733 0.8203 0.9076 1.396 2.094 1.1364 H2

[9, 12) 0.2967 0.122 0.2967 0 0 0 4.147 2.953 1.5 H1

Fig. 4. Control structure of the CPG network.

4.2. Simulation results using VRML Before applying our CPG model to the real robotic fish, we had simulated this model using open dynamic environment (ODE), where we built a robotic fish based on the Virtual Reality Modeling Language (VRML) [19]. Through this 3D animation of oscillation and locomotion of the robotic fish, both our approach and input CPG parameters can be evaluated. In order to verify the movements and smooth transitions of our controller, dynamics models between the fish and environments are ignored. In the simulation, Hp is defined as an element of collection fH 1 ; H 2 g, where H1 and H2 are H 1 ðϕÞ ¼ cos ðϕÞ

H 2 ðϕÞ ¼

ð27Þ

8 2 > > <  1 þ ϕ;

ϕ A ½0; π Þ

2 > > : 1  ϕ;

ϕ A ½ π ; 2π Þ

π

π

The switching function σ ðtÞ is chosen as ( 1; t A ½0; 6Þ [ ½9; 12 σ ðtÞ ¼ 2; t A ½6; 9Þ

Fig. 5. Neural simulation results: (a) amplitudes outputs, (b) offset outputs, (c) phase outputs, (d) oscillating angle outputs.

ð28Þ

snapshots of simulation results. As an outcome of this simulation, oscillations of three joints, especially for the locomotion pattern transitions, are continuous as well as converge to a stable state quickly.

ð29Þ

4.3. Experimental results

Basic CPG parameters are set as Table 1. Four locomotion patterns are simulated. Fig. 5 shows transitions from forward swimming in sinusoidal oscillation t A ½0; 3Þ s, turning swimming in sinusoidal oscillation t A ½3; 6Þ s, turning swimming in sawtooth oscillation t A ½6; 9Þ s, to backward swimming in sinusoidal oscillation t A ½9; 12 s. Basic pattern switches at t¼ 3 s, oscillating form switches at t¼6 s, and basic pattern together with oscillating form switches at t¼ 9 s. Amplitude variables ri, offset variables xi, phase variables ϕi and oscillating angles θi of all the three oscillators are presented in Fig. 5(a), (b), (c), and (d) respectively. 3D animation of these four locomotion models and transitions among them indicates that CPG outputs smoothly converge to a new stable state corresponding to the inputs whenever a pattern transition happens. And once the oscillation converges to a stable state, these movements hold this state until next group of parameters input. Only results of fish's swimming forward and the process of transition from swimming forward to turning right in sinusoidal oscillation are given because of the limited space. The details are shown in the online supplementary video (http://dx.doi. org/10.1016/j.neucom.2015.04.066). Figs. 6 and 7 present a series of

The experiments on the robotic fish with AVR controller are carried out to verify the validity of the proposed CPG controller. Four locomotion patterns (namely swimming forward in sinusoidal oscillation, turning right in sinusoidal oscillation, turning right with sawtooth oscillation and swimming backward in sinusoidal oscillation) and their transitions are designed and tested on the robotic fish. The parameters sent to the CPG controller match those listed in Table 1. In this paper, snapshots of the robotic fish's turning right and the process of transition from turning right in sawtooth oscillation to swimming backward in sinusoidal oscillation are given (see Figs. 8 and 9 and Supporting video in http://dx.doi.org/10.1016/j.neucom.2015.04.066). These snapshots have proven that locomotion of swimming in one oscillation as well as transition between oscillations is effective and smooth, which indicates the proposed CPG controller is applicable to the locomotion control of bio-inspired robots. 5. Conclusion and future work In this paper, one general architecture of CPG network and its implementation on general microcontrollers have been proposed.

Please cite this article as: L. Li, et al., A general CPG network and its implementation on the microcontroller, Neurocomputing (2015), http://dx.doi.org/10.1016/j.neucom.2015.04.066i

6

L. Li et al. / Neurocomputing ∎ (∎∎∎∎) ∎∎∎–∎∎∎

Fig. 6. Snapshots of fish movements during the first locomotion pattern. The time step is 1 s.

Fig. 7. Snapshots of transition from first mode to second mode. The time step is 0.2 s.

Fig. 8. Snapshot sequence of fish turning right with sawtooth-wave like oscillation. The time step is 0.2 s.

Fig. 9. Snapshot sequence of transition from turning right with sawtooth-wave like oscillation to swimming backward in sinusoidal oscillation. The time step is 0.2 s.

This CPG network can support transitions in a same oscillation as well as produce smooth transitions between different oscillations, which correspond to the different rhythmic locomotion presented in animals. Moreover, both theoretical analysis and simulations have been carried out to validate the effectiveness of the proposed model. In order to apply this controller to mobile robots, especially for bio-inspired robots, a detailed architecture implementation algorithm is given for the microcontroller system. A case study has been introduced on a robotic fish with our CPG controller. At last, 3D animation using virtual reality technology and tests on the prototype of three-joint robotic fish have

been carried out to verify the validity of our model and approaches. The controller is more powerful for dealing with locomotion control issues if it is further optimized. Evolution optimization algorithms, such as GA (genetic algorithm) [20], Powell's method [21] and PSO (Particle Swarm Optimization) [22], are widely used to find the appropriate CPG parameters. Although these algorithms are easy to understand and implement, but they cannot meet the conditions requiring a low time cost and global optimum. Moreover, how to optimize the periodical function H σ is remains an open issue. These open topics will be investigated in our future work, so

Please cite this article as: L. Li, et al., A general CPG network and its implementation on the microcontroller, Neurocomputing (2015), http://dx.doi.org/10.1016/j.neucom.2015.04.066i

L. Li et al. / Neurocomputing ∎ (∎∎∎∎) ∎∎∎–∎∎∎

as to acquire the optimal CPG parameters and rhythmic oscillation for those special bio-inspired robots under various environments.

Acknowledgements This work was supported by grants from the China Postdoctoral Science Foundation (No. 2015M570013) and Opening Fund of State Key Laboratory of Nonlinear Mechanics.

7

[18] W. Zhao, J. Yu, Y. Fang, L. Wang, Development of multi-mode biomimetic robotic fish based on central pattern generator, in: IEEE/RSJ International Conference on Intelligent Robots and Systems, 2006, pp. 3891–3896. [19] G. Taubin, W.P. Horn, F. Lazarus, J. Rossignac, Geometry coding and vrml, Proc. IEEE 86 (6) (1998) 1228–1243. [20] H. Inada, K. Ishii, Behavior generation of bipedal robot using central pattern generator (CPG), in: International Conference on Intelligent Robots and Systems, vol. 3, 2003, pp. 2179–2184. [21] A. Crespi, A.J. Ijspeert, Online optimization of swimming and crawling in an amphibious snake robot, IEEE Trans. Robot. 24 (1) (2008) 75–87. [22] J. In-Bae, P. Chang-Soo, N. Ki-In, H. Seungbeom, K. Jong-Hwan, Particle swarm optimization-based central patter generator for robotic fish locomotion, in: IEEE Congress on Evolutionary Computation (CEC), 2011, pp. 152–157.

Appendix A. Supplementary material Supplementary data associated with this article can be found in the online version at http://dx.doi.org/10.1016/j.neucom.2015.04.066. References [1] F. Delcomyn, Neural basis of rhythmic behavior in animals, Science 210 (4469) (1980) 492–498. [2] A.J. Ijspeert, Central pattern generators for locomotion control in animals and robots: a review, Neural Netw. 21 (4) (2008) 642–653. [3] R.J. Lock, S.C. Burgess, R. Vaidyanathan, Multi-modal locomotion: from animal to application, Bioinspiration Biomim. 9 (1) (2014) 011001. [4] N.M. Nor, S. Ma, Smooth transition for CPG-based body shape control of a snake-like robot, Bioinspiration Biomim. 9 (1) (2014) 016003. [5] S.J. Chung, M. Dorothy, Neurobiologically inspired control of engineered flapping flight, J. Guid. Control Dyn. 33 (2) (2010) 440–453. [6] J. Yu, M. Wang, M. Tan, J. Zhang, Three-dimensional swimming, IEEE Robot. Autom. Mag. 18 (4) (2011) 47–58. [7] A. Gams, A.J. Ijspeert, S. Schaal, J. Lenarcic, On-line learning and modulation of periodic movements with nonlinear dynamical systems, Auton. Robots 27 (1) (2009) 3–23. [8] A.J. Ijspeert, A. Cresp, D. Ryczko, J.M. Cabelguen, From swimming to walking with a salamander robot driven by a spinal cord model, Science 315 (5817) (2007) 1416–1420. [9] W. Zhao, Y. Hu, L. Wang, Construction and central pattern generator-based control of a flipper-actuated turtle-like underwater robot, Adv. Robot. 23 (2009) 19–43. [10] C. Zhou, K.H. Low, Design and locomotion control of a biomimetic underwater vehicle with fin propulsion, IEEE/ASME Trans. Mechatron. 17 (1) (2012) 25–35. [11] S.L. Katz, R.E. Shadwick, Curvature of swimming fish midlines as an index of muscle strain suggests swimming muscle produces net positive work, J. Theor. Biol. 193 (2) (1998) 243–256. [12] M.M. Koochesfahani, Vortical patterns in the wake of an oscillating airfoil, Am. Inst. Aeronaut. Astronaut. J. 27 (9) (1989) 1200–1205. [13] M.S. Triantafyllou, F.S. Hover, A.H. Techet, D.K. Yue, Review of hydrodynamic scaling laws in aquatic locomotion and fishlike swimming, Appl. Mech. Rev. 58 (4) (2005) 226–237. [14] R.G. Root, H.W. Courtland, W.L. Shepherd, H.J. John, Flapping flexible fish – periodic and secular body reconfigurations in swimming lamprey, petromyzon marinus, Exp. Fluids 43 (5) (2007) 779–797. [15] J.C. Liao, D.N. Beal, G.V. Lauder, M.S. Triantafyllou, Fish exploiting vortices decrease muscle activity, Science 302 (5650) (2003) 1566–1569. [16] C. Wang, G. Xie, L. Wang, M. Cao, CPG-based locomotion control of a robotic fish: using linear oscillators and reducing control parameters via PSO, Int. J. Innov. Comput. Inf. Control 7 (7B) (2011) 4237–4249. [17] Y. Fukuoka, H. Kimura, A.H. Cohen, Adaptive dynamic walking of a quadruped robot on irregular terrain based on biological concepts, Int. J. Robot. Res. 22 (3–4) (2003) 187–202.

Liang Li received his B.Sc. degree in Automation from ChongQing University, ChongQing, China, in 2011. He is currently a doctoral candidate at Intelligent Control Laboratory, College of Engineering, Peking University, Beijing, China. His current research interests include biomimetic robotics, hydrodynamics in fish school and collective animal behavior.

Chen Wang received her Bachelor's degree in Electronic and Information Engineering from Xi'an Jiaotong University, Xi'an, China, in 2007 and since then has been enrolled in a joint-PhD training program, for which she obtained her Ph.D. in General Mechanics and Foundation of Mechanics from Peking University, Beijing, China, in 2013. In October 2014, she received her second Ph.D. degree in the field of Systems and Control with the Faculty of Mathematics and Natural Sciences, ITM, University of Groningen, the Netherlands. Now she is a Postdoctoral Researcher in the College of Engineering, Peking University. Her research interests include multiagent systems, biomimetic robotics and game theory.

Guangming Xie received his B.S. degrees in both Applied Mathematics and Electronic and Computer Technology, his M.E. degree in Control Theory and Control Engineering, and his Ph.D. degree in Control Theory and Control Engineering from Tsinghua University, Beijing, China, in 1996, 1998, and 2001, respectively. Then he worked as a Postdoctoral Research Fellow in the Center for Systems and Control, Department of Mechanics and Engineering Science, Peking University, Beijing, China, from July 2001 to June 2003. In July 2003, he joined the Center as a Lecturer. Now he is a Professor of Dynamics and Control in the College of Engineering, Peking University. He is also a Guest Professor of East China Jiao tong University. He is an Associate Editor of the International Journal of Advanced Robotic Systems and an Editorial Board Member of the Journal of Information and Systems Science. His research interests include smart swarm theory, multi-agent systems, multi-robot cooperation, biomimetic robot, switched and hybrid systems, and networked control systems.

Please cite this article as: L. Li, et al., A general CPG network and its implementation on the microcontroller, Neurocomputing (2015), http://dx.doi.org/10.1016/j.neucom.2015.04.066i