# A Bio-Inspired Control Strategy for Locomotion of a Quadruped Robot
## 4 CPG-NN-WT-Based Control Strategy
### Realization of CPG-NN-WT Control Model  
With the preplanned WT and CPG introduced above, the CPG-NN-WT-based control strategy can be achieved after the following steps. **Step 1:** the NN choosing and its input and output determining  
In this paper, the radial basis function neural network (RBFNN) is chosen for two reasons: (1) It is a local approximation network, which learns fast and can effectively avoid falling into the local minimal. (2) It is a three-layer feed-forward network with a single hidden layer and can approximate any continuous function with arbitrary precision [7; 30; 31; 32; 33; 34]. Considering the performance and the structure size of the NN as well as computational cost, the NN is defined as the follows: one input to receive the CPG output and outputting two coordinated signals to simultaneously control the hip and knee joints within a leg. However, it can be seen easily form Figure 9 that the CPG output falls in the same range of (\(-1\),\(1\)) during both its swing and stance phases. That is, the input of NN is overlapped. Although the NN has the capability to automatically classify if the leg should be in swing or stance phase based on the CPG outputs, it makes the structure size bigger, relatively. Fortunately, each CPG oscillator unit has two outputs, no matter what state it is in, there is a strict correspondence between its two outputs, as shown in Figure 9 (where \(i=1\)). The corresponding relationship is: when the CPG oscillator unit output \(x_{i}\) is in the swing phase (in this paper, the decline part of the curve \(x_{i}\) is the swing phase), the other output \(y_{i}\leq 0\); while \(x_{i}\) is in stance phase, the other output \(y_{i}>0\). Figure 8: The CPG-NN-WT control model for a quadruped robot. Figure 9: The output of single CPG oscillation unit. In order to solve the problem of NN input overlap and make the structure of NN smaller (the smaller the structure of NN, the smaller the computational cost), the corresponding relationship between the two outputs of the CPG oscillator unit is used with the piecewise function method. Two NNs corresponding to the swing and stance phases of a CPG oscillator unit respectively are used to receive the CPG output. Then, the NN is given by  
\[N_{network}=\left\{ \begin{array}{ll}N_{swing}&y_{i}\leq 0\\ N_{stance}&y_{i}>0\end{array} \right. \tag{13}\]  
where \(N_{network}\) is the RBFNN; and \(N_{swing}\) and \(N_{stance}\) are the subsections of the RBFNN corresponding to the swing and stance phases, respectively. **Step 2:** NN construction and training  
The key point of the RBFNN construction is the nodes in its hidden layer, which is related to the network performance and its computation complexity. In this paper, the hip and knee joints' coordinated control signals are used as the output, and the main output \(x_{i}\) of the CPG unit with the duty factor \(\beta\) = 0.5 in a gait period is used as the input to train the RBFNN. The total number of the training sample pairs is 2002 (the swing and stance phase are evenly distributed in 1001 pairs respectively). The distribution density of the radial basis function (RBF) is 0.34 for the swing phase neural network \(N_{swing}\) and 0.8 for the stance phase neural network \(N_{stance}\). The MATLAB neural network toolbox is used to analyze its number of nodes in hidden layer and other parameters of the RBFNN with its training performance, as shown in Figure 10.  
In view of the locomotion control of a quadruped robot, the goal of RBFNN training mean square error is chosen to be \(3\times 10^{-6}\). It can be seen from Figure 10 that the goal is achieved when the number of the hidden layer nodes of the \(N_{swing}\) and \(N_{stance}\) reach 9 and 10, respectively. The network structure is shown in Figure 11.  
In this study, 2000 pairs of test samples (the swing phase and stance phase are evenly distributed in 1000 pairs respectively) are used to test the trained RBFNN. The test results are shown in Figure 12.  
Figure 11: RBFNN network structure.