Remarks on Learning Inverse Kinematics of a Robot Manipulator Using a Quaternion Neural Network

In this study, the application of a quaternion neural network (QNN) for solving the inverse kinematics problem of a robot manipulator is investigated. To obtain the solution of the inverse kinematics problem, the QNN earns the mapping be-tween the work space and the joint spaces of the robot manipulator through training on a dataset predetermined by the forward kinematics of the robot manipulator. A seven degree– of–freedom robot manipulator is employed in the computational experiments and the simulation results demonstrate the feasibility of using the QNN for this task.


Introduction
Although controlling robot manipulators is a difficult task due to the highly non-linear characteristics of their mechanical structure, numerous control techniques have been investigated to attain appropriate performance.In motion control of a robot manipulator, solutions of the forward/inverse kinematics problems are crucial. (1)For instance, usually most robotic manipulation applications are conducted within a work space (Cartesian space).The forward kinematics derives the end-effector's posture (position and orientation) in the work space based on the variables of the joint space; conversely, the inverse kinematics calculates the variables in the joint space that make the manipulator to achieve the desired end-effector's posture in the work space.Therefore, it is necessary to find an accurate and reliable solution of the inverse kinematics problem; thus, geometric, iterative, analytic, or algebraic approaches have been employed to obtain the solution.However, solving the inverse kinematics problem of robot manipulators, particularly articulated redundant manipulators, is a cumbersome task because the complexity of this problem is caused by the geometry and the nonlinear trigonometric equations that describe the relationship between the work space and the joint spaces.
Recently, artificial intelligence, including machine learning, has been expected to provide applicable solutions to intractable problems in robotic control engineering despite many limitations, such as the curse of dimensionality, samples and time constraints in the real-world.For instance, neural networks (NNs) provide numerous applications for solving robotic control problems due to their robust learning capability against highly complex mappings.In this study, a quaternion-valued NN (QNN), wherein all the network parameters and signals are based on quaternion numbers and algebra, is investigated with application to the inverse kinematics problem of a robot manipulator.) To obtain the solution to the inverse kinematics problem, the QNN is trained using the dataset predetermined by the forward kinematics of the robot manipulator.The input of the QNN comprises the end-effector's position and orientation, whereas the output of the QNN is the joint configuration corresponding to the given localisation of the end-effector.Computational experiments using a seven degree-of-freedom (DOF) robot manipulator are conducted to evaluate the characteristics of the QNN for this task.

Robot Manipulator
A seven DOF arm of a humanoid robot (Sciurus17, RT corp., Tokyo, Japan) as shown in Fig. 1 is considered as the robot manipulator.Assuming the left arm, the model of the robot manipulator, which comprises the shoulder, elbow and wrist joints having three, two and two DOFs, respectively, is depicted in Fig. 2, where θ i (i = 1, 2, • • • , 7) denotes the rotation angle of the joint and l i (i = 0, 1, 2, 3) denotes the length of the link. (11)Figure 2 shows the reference posture where all rotation angles of the joint are zero: The forward kinematics of the manipulator can be given by where is the position vector of the end-effector, are the vectors of the links 0, 1, 2 and 3, respectively, R x (θ), R y (θ) and R z (θ) are the rotation matrices around x-, yand z-axis, respectively. (12)

Quaternion-valued Neural Network
Quaternion numbers comprising four real numbers and bases {1, i, j, k} are defined as follows: H := {q = q 0 + q 1 i + q 2 j + q 3 k | q 0 , q 1 , q 2 , q 3 ∈ R} where the imaginary units satisfy the Hamilton rule: A three-layer network topology with one input layer, one hidden layer and one output layer is used as the QNN. (13)The forward calculation of the QNN is given as follows: where s i is an external input to the i-th neuron unit in the input layer, w 1ji is the weight between the i-th neuron in the input layer and the j-th neuron in the hidden layer, w 2 kj is the weight between the j-th neuron in the hidden layer and the k-th neuron in the output layer, z k is an output of the k-th neuron unit in the output layer and f (•) is an activation function of the neuron unit; f : H → H.In the representation of the network using Eq. ( 2), the threshold of the neuron in the hidden and output layers can be treated as part of the weights.
Using a backpropagation algorithm extended to quaternion numbers, the training of the QNN is performed to minimise the cost function E defined by the the output error ϵ k = d k − z k , where d k is the desired output of the k-th neuron unit of the output layer: where the norm of quaternion number q is defined by ∥q∥ = √ q 2 0 + q 2 1 + q 2 2 + q 2 3 .The network parameters can be updated as follows: where t is the iteration number and η ∈ R + is the learning factor.Using a split-type quaternion function with respect to a quaternion number q: f (q) = f 0 (q 0 )+f 1 (q 1 )i+f 2 (q 2 )j+ f 3 (q 3 )k, where the function f l (•) is a real-valued non-linear function (l = 0, 1, 2, 3); f l : R → R as the activation function of the neuron unit and applying the pseudo-derivative to the cost function (3), the gradient of the cost function with respect to the network parameters can be derived.

Computational Experiments
To investigate the characteristics of solving the inverse kinematic problem using the QNN, computational experiments are performed.Even if a solution of the inverse kinematic problem exists, the redundancy of the robot manipulator often provides multiple possible solutions for a given posture of the end-effector.Considering the ranges of the robot manipulator's motion in the work space under the limited range of joint angles, the training datasets for the QNN was produced using the forward kinematics of the robot manipulator, Eq. ( 1), with respect to the combination of joint angles (Table 1).In dataset 1, each joint angle covers almost quarter range of movable joint angle of the robot manipulator.In dataset 2, the work space of the robot manipulator is limited in front of the robot body.In addition, it is limited to the left side in front of the robot body in dataset 3. To generate the training data, the lengths of the link are set to l 0 = 0.2, l 1 = l 2 = 0.5 and l 3 = 0.1.As a result, each training dataset has 16384 (= 4 7 ) data comprising the joint angle values and the corresponding locations of the end-effector.These datasets do not contain the training data that would provide singular configurations and multiple solutions.
To obtain the solution of the inverse kinematics problem using the QNN, the QNN employed two input units s ∈ H 2 and two output units z ∈ H 2 as follows:

}
where represents the orientation of the end-effector given by the direction cosine of the link 3. The number of neurons in the hidden layer was 40 and the real-valued function of the activation function in the neuron was a sigmoid function.The training of the QNN was conducted using the training dataset with the stochastic gradient descent, and it was terminated when the normalised cost function was less than the threshold value of 10 −3 or the number of iterations exceeded 10 5 .Each component of the quaternion numbers representing the network parameters was initialised randomly from the interval [−0.1, 0.1] and the learning factor was 0.01.
After the termination of the QNN's training, the QNN was tested using the training data and the untrained desired posture of the end-effector in the work space.Figure 3 2 because normal distribution is unobserved in the norm of the error vectors for all dataset according to the Kolmogorov-Smirnov test (p < 0.05).The norms of the error vector decrease as the range of training data in the work space becomes smaller.The Kruskal-Wallis test shows statistical difference between the results for corresponding to each dataset.
Figure 4 shows the response of the end-effector's posture against the untrained trajectory and position, where the QNN is trained using dataset 3 and the desired orientation of the end-effector is set to α . Table 3 shows the norm of the error vector against the straight-line trajectory: x = 0.6−0.1σ,y = 0.2+0.3σ,z = −0.5+0.6σ.With a 0.01 discretisation to the range of σ ∈ [0, 1], the resulting 100 data points are on the trajectory.Table 4 shows the norm of the error vector against the grid points on the plane parallel to the YZ-plane: x = 0.  where the desired trajectory is drawn with green line, the position of the end-effector located using the NN is drawn with blue line and the stick figure illustrates the posture of the robot manipulator.The right figure shows the result against the untrained position on the plane parallel to the YZ-plane where the desired position of the end-effector is a grid point drawn with green mesh, the position of the end-effector located using the NN is drawn with blue mesh and the stick figure illustrates the reference posture of the robot manipulator.
CNN use a 6-58-7 and 3-50-4 network topology, respectively, where the total number of parameters of these NNs is almost the same as that of the QNN.As shown in Tables 3  and 4, normal distribution is unobserved in the norm of the error vectors for all NNs according to the Shapiro-Wilk test (p < 0.05), and the norm is similar among the NNs.

Conclusions
This study investigated the capabilities of highdimensional NNs using quaternion numbers to solve the in- verse kinematics problem of a robot manipulator.A QNN, the input of which comprises the end-effector's position and orientation and the output of which is used to the joint angle of the robot manipulator, was trained using a backpropagation algorithm extended to quaternion numbers on a dataset predetermined by the forward kinematics of the robot manipulator.The training and control performance using the QNN was evaluated for computational experiments using a seven DOF robot manipulator.The simulation results demonstrated the feasibility of the QNN for solving the inverse kinematics problem of the robot manipulator.
Although the results presented in this study show the capability of the QNN for the inverse kinematics problem, attention should be paid to the following in future work: optimisation of the QNN to improve the training and control accuracy and experiments to evaluate the performance of the QNN in real robot manipulators.
shows the training results of the QNN in the work space against each training dataset.The left figure shows the desired position of the end-effector p d in the training data, whereas the right figure shows the position of the end-effector p located by the forward kinematics of the robot manipulator using the output of the QNN as the joint angles.Defining the position error vector e p = p d − p and the orientation error vector e o = α d − α, the median and inter quartile range of the norm of the error vectors are summarised in Table

Fig. 3 .
Fig. 3. Training results of the QNN, where the distribution of training data in the work space is drawn with green dot in the left figure and the position of the end-effector located using the output of the QNN after terminating the training of the QNN is drawn with blue dot in the right figure.In each figure, the stick figure drawn with red lines illustrates the reference posture of the robot manipulator.Table 2. The norm of error vectors in the work space against the training dataset.

(Fig. 4 .
Fig.4.Responses of the end-effector's posture controlled using the NNs trained with the dataset 3. The left figure shows the result against the untrained trajectory of the end-effector where the desired trajectory is drawn with green line, the position of the end-effector located using the NN is drawn with blue line and the stick figure illustrates the posture of the robot manipulator.The right figure shows the result against the untrained position on the plane parallel to the YZ-plane where the desired position of the end-effector is a grid point drawn with green mesh, the position of the end-effector located using the NN is drawn with blue mesh and the stick figure illustrates the reference posture of the robot manipulator.

Table 1 .
The set of joint angles for generating the training data.

Table 4 .
The norm of error vectors in the work space against the grid points on the plane parallel to the YZ-plane.† : p < .1,* : p < .05,* * : p < .01)