# Initial Estimation of Kinematic Structure of a Robotic Manipulator as an Input for Its Synthesis
## 2 Materials and Methods
### Type B--Joints on Bezier Curve to Achieve a Position  
This method places joints between the base and the pose on a Bezier curve. To be able to obtain DH parameters, the proposed algorithm is orienting the \((i-1)\)th joint (its rotational matrix) in a way that the \(i\)th joint lies in the XZ plane of the previous joint. The schematic is shown in Figure 5:  
Using Equations (11)-(15), the Bezier spline is approximated between a given base and a pose. The number of approximated points is equal to the number of joints \(n\). \(Q_{1..n}\) is the set of these points--coordinates of each point with respect to the base frame. Let us define a set \(\mathbf{J}_{1..n}\) of SE3 objects representing the translation and orientation of the joints in the manipulator's default position. As a first step, all \(\mathbf{J}_{1..n}\) are set to be equal to the given base (in our case, an identity matrix). We also define an SE3 object \(\mathbf{J}_{n+1}\) representing the given end-effector pose. Now, for joints \(\mathbf{J}_{2..n}\), the following procedure is done. Figure 4: The schematic of type A estimation; the base frame is black, the pose frame is red, and the end-effector frame is green and does not fulfil the orientation of the pose. The \(i\)th joint is equal to the previous \((i-1)\)th joint:  
\[\mathbf{J}_{i}=\mathbf{J}_{i-1} \tag{18}\]  
The frame \(\mathbf{J}_{i}\) is translated on the Bezier curve changing its translation vector \(\vec{t}_{i}\):  
\[\vec{t}_{i}=Q_{i} \tag{19}\]  
The position vector \(\vec{t}_{i}\) of \(\mathbf{J}_{i}\) is expressed in the coordinate frame of the previous \(\mathbf{J}_{i-1}\) using its inverse matrix:  
\[\vec{p}_{i}=\mathbf{J}_{i-1}^{-1}\vec{t}_{i} \tag{20}\]  
A projection of the \(\vec{t}_{i}\) vector in the XY plane of the \(\mathbf{J}_{i-1}\) frame is determined:  
\[\vec{t}^{\prime\prime}_{i}=\vec{p}_{i}- \begin{bmatrix}0\\ 0\\ \vec{p}_{i,z}\end{bmatrix}  \tag{21}\]  
The angle \(\theta_{i}\) (DH parameter) between the unit vector \(\vec{i}\) of the \(\mathbf{J}_{i-1}\) frame and the projection of the \(\vec{t}_{i}\) vector is calculated as  
\[\theta_{i}=\tan^{-1}\left(\frac{||\vec{i}\times\vec{t}^{\prime\prime}_{i}||}{ \vec{i}\cdot\vec{t}^{\prime\prime}_{i}}\right) \tag{22}\]  
While using a right-handed coordinate frame, it is necessary to check if an angle is rotating around an axis in the positive (counter clockwise) or negative (clockwise) direction. To determine this, we used the projection property of the dot product between the two vectors. In this case, if the dot product of the \(\mathrm{X}_{i}\) axis is in the negative direction of the \(\mathrm{Y}_{i-1}\) axis, the angle \(\theta_{i}\) has to be multiplied by \(-1\):  
\[\theta_{i}= \begin{cases}-\theta_{i},&\mathbf{if}\,\vec{j}\cdot\vec{t}^{\prime \prime}_{i}<0\\ \theta_{i},&\mathbf{otherwise}\end{cases}  \tag{23}\]  
Now, \(\mathbf{J}_{i}\) can be updated using the matrix multiplication:  
\[\mathbf{J}_{i}=\mathbf{J}_{i}\mathrm{Rot}(z_{i-1},\theta_{i}) \tag{24}\]  
Figure 5: The schematic of type B estimation; the base frame is black, the pose frame is red, and the end-effector frame is green and does not fulfil the orientation of the pose. Bézier spline is shown as a light blue curve. Thanks to the known translations, \({}_{i}\) and \(a_{i}\), between the frames (from the Bezier curve approximation), and the calculated \(\theta_{i}\), only the angle \(\alpha_{i}\) is missing among the DH parameters. The steps to determine it are similar as in the case of \(\theta\). Following the DH convention, the \(i\)th and \((i+1)\)th frames are involved.