Cerebellum-inspired neural network solution of the inverse kinematics problem

The demand today for more complex robots that have manipulators with higher degrees of freedom is increasing because of technological advances. Obtaining the precise movement for a desired trajectory or a sequence of arm and positions requires the computation of the inverse kinematic (IK) function, which is a major problem in robotics. The solution of the IK problem leads robots to the precise position and orientation of their end-effector. We developed a bioinspired solution comparable with the cerebellar anatomy and function to solve the said problem. The proposed model is stable under all conditions merely by parameter determination, in contrast to recursive model-based solutions, which remain stable only under certain conditions. We modified the proposed model for the simple two-segmented arm to prove the feasibility of the model under a basic condition. A fuzzy neural network through its learning method was used to compute the parameters of the system. Simulation results show the practical feasibility and efficiency of the proposed model in robotics. The main advantage of the proposed model is its generalizability and potential use in any robot.


Introduction
Robots are widely used primarily in industrial and medical applications where responsible, stable, and highly accurate operations are required. The demand today for more complex robots that have manipulators with higher degrees of freedom (Dof) is increasing because of technological advances. Obtaining the precise movement for a desired trajectory or sequence of arm and positions requires the computation of the inverse kinematic (IK) function, which is a major problem in robotics (Alavandar and Nigam 2008;Köker 2013;Wu and Rao 2007).
Forward kinematics involves determining the position of the end-effector of the robot given its joint variables. Obtaining the joint variable of a robot manipulator, given the desired position of the end-effector of the robot, is called IK (de Jesús Rubio et al. 2013;Zhang and Paul 1991). The solution of the IK problem requires the real-time computation and uniqueness of the inverse function. The solution of the IK problem has been studied by many researchers (Ali et al. 2010;Kanoun et al. 2011;Kumar et al. 2010;Reinhart and Steil 2011;Wang et al. 2010). Many approaches to solving the IK problem can be categorized into (1) analytical-based and (2) learning-based methods.
Although both types of methods can efficiently solve the problem, they have several shortcomings. First, the computations of the complex models in both methods are time-consuming because of the complexity of the mathematical formulation. Furthermore, poor efficiency results from the failure of the model to specify the robot characterization.
By contrast, if the model can reflect all of the robot characterization, then the results are more specific. Second, the learning data generated from the IK function in a restricted domain in most learning-based methods result in limited convergence. Neither method proposes a general solution for IK problems (Hasan et al. 2006(Hasan et al. , 2010. The proposed solution can be categorized into a learningbased method in the present study. However, two major distinctions can be recognized. First, this study proposes a new artificial neural network (ANN) model inspired by the anatomy of the cerebellum. Second, the IK function is learned using the forward kinematics function, unlike in other studies.
Different solutions to the IK problems of serial manipulators through learning-based methods exist. Among these solutions, learning-based methods that use ANNs are similar to the method used in the present study.
The approach used by Alavandar and Nigam (2008) in solving the IK problem is based on an adaptive neurofuzzy interface system, which was used to predict and estimate the problem. The said researchers collected training data from the forward kinematics of the 2-Dof and 3-Dof robot manipulator to show the effectiveness of this approach. The obtained results are inconsistent with the analytical IK function. The disadvantage of this method is its limited convergence because collecting data from forward kinematics covers only a part of the IK function domain. Karlik and Aydin (2000) implemented a robot manipulator with six Dof through the best ANN configuration from two ANNs: a three-layer back-propagation (BP) with six outputs and six four-layer BPs with one output. The error obtained from the second ANN is smaller than that from the first configuration. The data set elements (i.e., inputs and outputs) for training NNs were calculated from analytic equations based on restrictions. Xia and Wang (2001) developed a recurrent NN called the dual network, which has a single neuron layer. The approach proposed by Arefi and Sadigh (2011) is based on a fuzzy algorithm and a polar coordinate displacement of the robot manipulator's tip. The model overcomes blind spots and singularities. NNs based on the radial basis function and multilayer perceptron, used to predict incremental joint angles, were proposed by Chiddarwar et al. and K.K. Dash et al., respectively (Chiddarwar and Ramesh Babu 2010;Dash et al. 2011). A genetic algorithm was used to improve the accuracy of the ANN model in several of these studies (Köker 2013;Oyama et al. 2001).
The ability of biological motor control systems to finetune themselves and enhance their performance is one of their major inspiring aspects. The cerebellum is indispensable in achieving fast and precise coordinated movements and accurately perceiving body motion; thus, the use of the cerebellum as a model for control and learning movement has attracted the attention of researchers for many years (Albus 1975b;Darlot 1993;Eccles et al. 1967;Kawato et al. 1987;Miall et al. 1993).
The current study attempts to modify the shortcomings of previous models of cerebellar NNs, which is more consistent with the general anatomy and functioning of the cerebellar pathways to solve the IK problem. Moreover, the disadvantage of previous cerebellar NN models and strong point of the proposed model have been mathematically proven.

Cerebellar NN Model
Computing an inverse function is an "ill-posed problem" with no general solution, except in trivial cases (Cannon and Robinson 1987;Tikhonov and Arsenin 1979).
The forward kinematics function is shown in Eq. (1), where θ(t) = (θ 1 (t), θ 2 (t), . . . θ n (t)) is the joint variable of a manipulator with n Dof at any instant of time. The position variable at any instant of time in the x, y, and z directions is denoted by P(t) = (x(t), y(t), z(t)), and f is a nonlinear function.
By contrast, the IK function can be computed using Eq. (2). However, the inverse function ( f −1 ) is not unique, and the set of solution is infinite because of the nonlinear, uncertain, and time-varying nature of f .
A direct function is deterministic, whereas an inverse function is not necessarily so. Therefore, similar effects can be induced by different sets of causes. For instance, the biomechanical function of the arm, which expresses movement caused by exerting forces, is deterministic according to Newton's law. Conversely, the same hand displacement can result from various configurations of articulated arm segments and can be induced at different levels of stiffness of articulations. Given that different causes can produce similar effects, a cause-effect relationship is generally not bijective but is rather a surjection from the domain of the causes to that of the effects. Therefore, no general method permits a definite return from an effect to a single cause, and finding an inverse function is a process that is very sensitive to the initial conditions and noise. Thus, in practice, an inverse function that is appropriate at one instant can be inappropriate at the next. Specifically, the number of possible solutions is infinite for the IK of a limb, when the number of moving segments is larger than the Dof of the end-effectors. Similarly, an infinite number of solutions are possible for inverse dynamics, when the number of actuators (muscles) is larger than that of moving segments. One of the early famous computational models of cerebellum is the cerebellar model articulation controller, which is based on the Marr-Albus ideas of the cerebellum (Albus 1975a,b;Pouget et al. 2000;Wolpert 1997). However, it was not originally proposed as a biological plausible approximation (Wolpert et al. 1998).
Given the unavailability of a training signal to the central nervous system (CNS), one of the most challenging tasks in modeling the cerebellum as an inverse model is acquiring an inverse dynamic model through motor learning. Kawato and colleagues (Kawato et al. 1987;Kawato and Gomi 1992) proposed a cerebellar feedback-error-learning model to solve this problem.
The learning process in the Kawato model is conducted in slow movement, after which the speed is increased . However, the model is insensitive to the noise because of the use of an open-loop control system, but one of the most important shortcomings is that it is not based on cerebellum physiology. Previous studies show that the cerebellum does not compute the inverse dynamic solutions and instead learns the forward one (Gentili et al. 2009). The other inverse model for the cerebellum as a controller is based on the Smith predictor (Miall et al. 1993). This model is a forward model and has a delay structure that postpones the sensorimotor predictions for regulating the sensorimotor outcomes. In contrast to the Kawato model, the Smith model uses the inverse function, and the main (forward) function is trained. One of its advantages is that the error in this model is lower than that in the Kawato model (Wolpert et al. 1998).
The inverse problem can be bypassed by placing in a feedback loop a circuit that predicts the effect of motor orders, which provides it with a deterministic direct function (Barto et al. 1999;Darlot 1993;Houk 1996;Miall 1998;Miall et al. 1993;Miall and Wolpert 1996;Wolpert et al. 1998). The proposed theory holds that anticipating signal values is similar to the function of the cerebellar cortex and that computing approximate inverse functions is similar to the function of the entire cerebellum.
The model in Fig. 1 shows a feedback loop with a direct function Γ (α, u), a short delay of the feedback loop, and a delay to the motoneuron (α). The mathematical equations used to obtain Γ (α, u) with x(t) = y(t) x = y are as follows [i.e., x(t) is the input signal and y(t) is the output]: This equation must be α(t +1) = α(t) to obtain a fixed point. Thus, With x = y and (3) and (5) combined, Substituting (6) into (4) yields The modified model with respect to the equation for obtaining a fixed point is shown in Fig. 2.
The condition of the model stability (proven in "Appendix 1") is The model is sometimes unstable because this condition is unsatisfied in every situation. The following modified model ( Fig. 3), however, can satisfy the condition in every situation: The above equation must be α(t +1) = α(t) to obtain a fixed point. Thus, Combining (9) and (12) yields ⇒ x(t) = y(t).
Therefore, the proposed model works as an inverter. The stability condition of the proposed model (calculated in "Appendix 2") is shown in (22): Thus, the proposed model works in every situation because B can be varied as the stability condition is satisfied. This circuit resembles the cerebellar pathways because positive and negative loops arranged in parallel evoke the excitatory mossy fibers that reach the cerebellar nuclei and cerebellar cortex. The inhibitory axons of the Purkinje cells project to the cerebellar nuclei. Thus, the predictor resembles the cerebellar cortex, and the summing element resembles the cerebellar nuclei (Figs. 3, 4). This anatomical interpretation matches the importance of the cerebellum in motor coordination and error compensation. The cerebellum is indispensable in achieving fast and precise coordinated movements and accurately perceiving body motion.
The input signal x reaches the summing element, which issues α through two pathways: a direct pathway that transmits this signal unchanged and an indirect pathway that processes the signal. This side circuit represents a motor part of the cerebellar pathways, which are situated outside the direct sensory or motor pathways.
The element, h (α, u), which is the predictor, represents the cerebellar cortex, which receives many sensory signals and efferent copies of motor signals through the mossy fibers. The cerebellar cortex processes these signals to increase the activity of Purkinje cells. This activity P is assumed to encode a dynamic signal that predicts the state of the body at the time the motor orders generate their effects (Figs. 3, 4).
The summing element placed immediately downstream h (α, u), where the signal of the positive loop is summed to the output P of h (α, u) and issues the signal Q, represents a group of neurons in a cerebellar nucleus (Figs. 3, 4). The same feedback signals reach the predictor and summing element, as the messages conveyed by the mossy fibers reach both the  (Eccles et al. 1967;Kandel et al. 2000) cerebellar cortex and cerebellar nuclei. The negative output of the predictor is comparable with the inhibitory projection of the Purkinje cells to the neurons of the cerebellar nuclei (Figs. 3, 4).

Fuzzy NN (FNN)
Calculating the optimal value of the model's parameter (B in Eq. 13) is computationally complex. ANN must be employed to predict this value at any instant of time. FNN is used in this study to predict the optimal value of the model's parameter at any instant of time. The other ANNs that work as predictor cannot be employed because the nonlinear function (i.e., feedback loop in the model) learning methods can be implemented only in the FNNs.
The approximation of nonlinear functions can be modeled using a fuzzy rule based on a set of if-then rules defined as follows: where A i j and B i are fuzzy sets, x = (x 1 , . . . , x n ) T is the input variable, and y is the output variable of the fuzzy system.
Equation (15) is used to map a fuzzy set A to a fuzzy set B through the product inference engine.
A real-value point x * can be fuzzified by a singleton fuzzifier, which maps x * to a fuzzy singleton A with a membership value of 1 at x * and 0 at other points: A defuzzifier is an algorithm that maps from a fuzzy set Bto a crisp point y * . y −i is the center of the ith fuzzy set and w i is its height. The center average defuzzifier determines y * as Fuzzy systems with the fuzzy rule base, a product inference engine, a singleton fuzzifier, and a center average defuzzifier have the following form for a fuzzy set B i with a centery −i : where x and f (x) are the input and output of the fuzzy system (Wang 1999). The corresponding network of the fuzzy model can be built as shown in Fig. 5. The FNN has four layers. The output of each node in the first layer equals μ A i j (x j ) and the membership value of fuzzy set A i j . The nodes in the second layer are used to calculate the product of the membership values and inputs in all the dimensions for each rule: The third layer is the normalization layer, where the output of node i is calculated as follows: Finally, the output of the ith node of the last (output) layer is the summation of its input values from the previous layer: where v i s are the consequent parameters that should be learned through least-squares or gradient descent. For the Takagi-Sugeno-Kang fuzzy model, one layer before the output layer is added to replace the consequent parameters with a linear combination of inputs. Thus, the output of the network is calculated as follows: A hybrid learning algorithm determines the parameters in several neuro-fuzzy networks, wherein epochs involve forward and backward passes. All training data are presented to the network, and output weights are identified by the least-squares algorithm in the forward pass. Recursive least squares can also be used to determine the weights of the output layers (Kosko 1994;Malek et al. 2012).

Proposed model to solve the IK problem
The control of the two-segmented arm is studied to test the proposed model. This examination requires the calculation of IK with two inputs and two outputs. The model in the previous section is proposed with one input and one output, so that the proposed model must be developed. In this section, the equation of the forward kinematics of the two segments is calculated, and the proposed model is developed. With regard to Fig. 6, the equation of forward kinematics can be written as follows: x = a 1 cos θ 1 + a 2 cos(θ 1 + θ 2 ) (23) y = a 1 sin θ 1 + a 2 sin(θ 1 + θ 2 ) where a 1 and a 2 are the lengths of the first and second segments, θ 1 and θ 2 are the angles of the same segments, and x and y are the Cartesian positions of the end-effector. The velocity of x and y at any instant of time is calculated as follows: • y = a 1 cos θ 1 • θ 1 +a 2 cos(θ 1 + θ 2 )( The developed model with regard to the previous equations for controlling a two-segmented arm is shown in Fig. 7.
The equations must be Thus, The results verify that the developed model acts as an inverter. The stability condition of the developed model (calculated in the "Appendix 3") is shown in Eq. (31): The coefficients B 1 and B 2 must satisfy the condition of Eq. (31) to prove the stability of the proposed model. The values of these coefficients depend on Eqs. (25) and (26). The appropriate values of B 1 and B 2 depend on angles θ 1 and θ 2 and their velocity at any instant of time, which indicates  Figure 8 shows the location of two FNNs, and Fig. 9 shows the proposed FNN for learning B 1 and B 2 .
is unknown, so that the weights v i of the network must be learned. One of the most important reasons for selecting FNNs is the learning method, which runs only through these networks. The FNN used in this study is a one-layer network with a normal triangular fuzzy set. Normal triangular fuzzy sets are created as shown in Fig. 10, where μ and v are the membership function and weight, respectively.
Considering y = f (x), the output of the network is calculated according to can be defined as a piecewise linear function. Given that f (x) is an unknown function, the weight v i should be learned by the network. Gradient and pseudo-inverse learning methods are inapplicable because the functions in the proposed model are nonlinear and cannot be differentiated as a result of the feedback loop.
The FNN has several features that make it an appropriate object of learning through the proposed learning method: 1. The point values in the fuzzy sets equal the function (μ = 1). 2. The points in the s intervals are a linear combination of the preceding and following output values (y = μ 1 y 1 + μ 2 y 2 ). 3. The fuzzy sets in this study are normal; hence, μ 1 +μ 2 = 1.
Therefore, only a maximum of two rules is equal to one, and the other rules are equal to zero at every instant of time.
We use FNN in this study because the nodes in the other networks are active at each step, which entails high cost. Our solution to this problem is shown as a learning algorithm in Fig. 11.
As previously mentioned, we cannot use differentiation because of the feedback loop. Therefore, whether or not the weight of the active rule at each step must be increased or decreased cannot be determined. A solution to this problem is to increase the weight of the active rule and subsequently calculate the error (Fig. 11). If the error decreases, the increasing step is continued until the error becomes constant or drops. If the error increases, the weight must be decreased until the error is stabilized.

Results and discussion
Three experiments are designed and implemented in MAT-LAB (R2008a) 7.6.0.324 to evaluate the proposed model. The lengths of the first and second segments are considered to be a 1 = 0.35 m and a 2 = 0.3 m, respectively. The Gaussian function considers the velocity of θ to be the input of the model, and the velocity of movement is considered to be σ = 0.2.
The end-effector of the two-segmented robot moves from point (65, 0) to point (63, 15) in the first experiment (Fig. 12). The movement exhibits a trajectory in the joint coordinates, which is expected to be a straight line in the best-case scenario. Figures 12a, 13 and 14a show the angles of each arm segment that reach the desired position.
The models provide satisfying results, and the trajectory in the joint coordinates in all three experiments is approximately a straight line (Figs. 13, 14). These results show that the error of the model is acceptable in all cases (i.e., the mean square error is below the 0.0001).
Thus, the results of experiments show that the proposed approach is a feasible option for the real-time path planning and precise control of robots.

Conclusion
The IK problem is solved through a method that resembles cerebellar anatomy and function. Previous cerebelluminspired solutions were based on a direct function and a recursive model that remains steady only under certain conditions. Therefore, they cannot be applied to robot movement with high Dof.
We used mathematical analysis to propose a modified model that is stable under all conditions because only one parameter is determined. This dynamic parameter varies at any instant. Therefore, we use an FNN with a particular learning method. The proposed model is developed and modified for a simple two-segmented arm to show its feasibility. Two model parameters are approximated by FNN because of its specific learning method. The model has an acceptable and reliable performance in solving the IK problem of the two-segmented arm.
Moreover, the proposed model can be generalized for all functions because it is independent of the calculations for the inverse function, which is proven mathematically. This approach can be used for the prediction of IK solutions for any kind of robot regardless of the geometry and Dof associated with it.
Acknowledgments This study was supported by High Impact Research UM/MOHE/HIR Project No. D000010-16001 from the University of Malaya.
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecomm ons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Appendix 1
There are some methods obtaining the model stability. One of them is to linearize it in its fixed point.