# A Neural Network Based Approach to Inverse Kinematics Problem for General Six-Axis Robots
## 2 Robot Architecture and Kinematic Modeling  
Robot kinematics specifies the relationship between joint angles and the pose of the end-effector, which contains two parts: forward kinematics and inverse kinematics. As mentioned before, the complexity of kinematics, especially the IKP, is closely associated with robot architecture. In our work, to study the IKP of a general six-joint manipulator, Xarm6 is chosen, a six-joint manipulator with an offset wrist from Ufactory. With this architecture, analytical solution of the IKP cannot be expected and, thus, the presented algorithms are universal for any 6-DoF robot.  
In forward kinematics, the pose of the end-effector can be calculated with D-H conventions and homogeneous matrix once the joint variables are obtained. Figure 1 illustrates the assignment of D-H frames on Xarm6, while Table 2 lists related D-H parameters in the attached frames, where \(a\), \(\alpha\), \(d\), \(\theta\) denote link length, link twist, link offset, and joint variable, respectively.  
With D-H parameters, the transformation matrix \(\mathbf{A_{i}}\) from frame \(i-1\) to frame \(i\) is defined as  
\[\mathbf{A_{i}}=\begin{bmatrix}c\theta_{i}&-s\theta_{i}c\alpha_{i}&s\theta_{i}s \alpha_{i}&a_{i}c\theta_{i}\\ s\theta_{i}&c\theta_{i}c\alpha_{i}&-c\theta_{i}s\alpha_{i}&a_{i}s\theta_{i}\\ 0&s\alpha_{i}&c\alpha_{i}&d_{i}\\ 0&0&0&1\end{bmatrix} \tag{1}\]  
where \(c(\cdot)\) and \(s(\cdot)\) stand for \(\cos(\cdot)\) and \(\sin(\cdot)\), respectively.  
Then, the pose of the end-effector, represented by homogeneous matrix \(\mathbf{T_{6}}\), can be calculated as:  
\[\mathbf{T_{6}}=\mathbf{A_{1}}\mathbf{A_{2}}\mathbf{A_{3}}\mathbf{A_{4}} \mathbf{A_{5}}\mathbf{A_{6}}=\begin{bmatrix}\mathbf{R_{6}}&\mathbf{d_{6}}\\ 0&1\end{bmatrix} \tag{2}\]  
in which \(\mathbf{R_{6}}\) and \(\mathbf{d_{6}}\) are the 3 \(\times\) 3 rotation matrix and the 3 \(\times\) 1 position vector of the end-effector with respect to the base frame.  
Since the nine entries in \(\mathbf{R_{6}}\) are not independent, it is advantageous to obtain the minimum representation of the pose rather than using the homogeneous matrix directly. Obtaining the position of the end-effector is quite straightforward, as this can be read directly from \(\mathbf{d_{6}}\). The expression of orientation, nevertheless, is more complex and Euler angles, roll pitch yaw, and quaternions are the three most commonly used notations. In our work, the orientation of a pose is described by Euler angles \(\phi\), \(\theta\), \(\psi\) with ZYZ sequence. Hence, the pose of the end-effector is represented with the following form:  
\[\mathbf{p}=[x,y,z,\phi,\theta,\psi]^{T} \tag{3}\]  
in which \(x\), \(y\), and \(z\) denote the position of the end-effector in the base frame, \(\phi\), \(\theta\), and \(\psi\) being the Euler angles.  
For practical revolute joints, unlike the ideal model which can rotate within 0-360\({}^{\circ}\), the physical restrictions limit their motions. For our robot, the joint limitations are:  
\[\begin{split} 0\leq\theta_{1}&\leq 360^{\circ},\\ 0\leq\theta_{2}&\leq 90^{\circ},\\ -180&\leq\theta_{3}&\leq-90^{\circ},\\ 0\leq\theta_{4}&\leq 180^{\circ},\\ 0\leq\theta_{5}&\leq 180^{\circ},\\ 0\leq\theta_{6}&\leq 360^{\circ},\end{split} \tag{4}\]