# Initial Estimation of Kinematic Structure of a Robotic Manipulator as an Input for Its Synthesis
## 2 Materials and Methods  
When an algorithm is searching for a local minima of a function, the results may differ upon the choice of initial values. To find the optimal solution for two initial values with different outcomes, the cost function has to be compared afterwards. More accurate initial values can lead to fewer iterations that the algorithm needs, which can also save computing time. In this section, four algorithms of automatic assignment of DH parameters are presented, so they can serve as initial values for the synthesis of kinematic structure. The inputs  
\[\text{Trans}(z_{i-1},d_{i})= \begin{bmatrix}1&0&0&0\\ 0&1&0&0\\ 0&0&1&d_{i}\\ 0&0&0&1\end{bmatrix}  \tag{4}\]  
\[\text{Trans}(x_{i},a_{i})= \begin{bmatrix}1&0&0&a_{i}\\ 0&1&0&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix}  \tag{5}\]  
\[\text{Rot}(x_{i},a_{i})= \begin{bmatrix}1&0&0&0\\ 0&\cos\alpha&-\sin\alpha&0\\ 0&\sin\alpha&\cos\alpha&0\\ 0&0&0&1\end{bmatrix}  \tag{6}\]  
\[\mathbf{J}_{i-1,i}=\text{Rot}(z_{i-1},\theta_{i})\,\text{Trans}(z_{i-1},d_{i}) \,\text{Trans}(x_{i},a_{i})\,\text{Rot}(x_{i},\alpha) \tag{7}\]  
It is clear that rotation and translation around and along the \(y\) axis are missing to achieve all possible poses. In DH convention, it is mitigated by placing the joint coordinate frames in a specific way and applying Equation (7), as explained in [24]. However, if there are two general poses \((i-1)\)th and \(i\)th which do not follow DH convention, it is possible to find a common perpendicular between their two \(z_{i-1}\) and \(z_{i}\) axes. Please see Figure 1. Rotation around \(z_{i-1}\) to the direction of the perpendicular is \(\theta_{i}\). \(d_{i}\) is the distance from the \(x_{i-1}\) axis to the intersection point \(P\) of the perpendicular and \(z_{i-1}\) axis. The distance along the perpendicular is equal to the \(a_{i}\) distance between these two frames. Finally, the rotation around the \(x_{i}\) axis to the direction of \(z_{i}\) is \(a_{i}\). If another displacement of \(d_{i+1}\) is added and a rotation \(\theta_{i+1}\) is applied, the previously unreachable (by four DH parameters) general pose \(i\)th becomes achievable by four DH parameters of \((i-1)\)th joint and two DH parameters \(d_{i+1}\) and \(\theta_{i+1}\) of the \(i\)th joint. It can also represent an end-effector coordinate frame if the \((i-1)\)th joint was the last joint. This approach is presented in detail in [27; 29]. For the following calculations, we enhanced a script made by [PERSON] [32] to find a common perpendicular and intersection points \(P\) and \(Q\). This can be found in the Supplementary Material of this paper. We used 3 poses to demonstrate the strong and weak points of the four presented algorithms to synthesise manipulators guiding their end-effector through the given position or pose, so everyone can choose the right solution for its implementation. They are also compared in Section 3 by manipulability and arm length. The first pose is a general one. The second pose is also general, but with a small offset between its Z axis and the Z axis of the base frame. The third pose has the parallel Z axis with the base Z axis. The poses are visualised in Figure 2:  
\[Pose(1)= \begin{bmatrix}-0.50&-0.18&-0.84&-1.0\\ -0.06&0.98&-0.17&0.9\\ 0.86&-0.02&-0.50&0.8\\ 0&0&0&1\end{bmatrix}  \tag{8}\]  
\[Pose(2)= \begin{bmatrix}0.81&-0.34&-0.46&-0.4\\ 0.48&-0.02&0.87&0.6\\ -0.30&-0.93&0.14&0.7\\ 0&0&0&1\end{bmatrix}  \tag{9}\]  
\[Pose(3)= \begin{bmatrix}0&1&0&0.4\\ 1&0&0&0.6\\ 0&0&-1&0.7\\ 0&0&0&1\end{bmatrix}  \tag{10}\]Two of the four presented algorithms utilised Bezier curves (splines) which are easy to implement between two given coordinate frames. For the presented calculations, only four control points are required to define a Bezier curve. We used a script by [PERSON] [33] to calculate the curve.