# Vision-Based Path Guidance to Achieve Dies-Free Roller Hemming Process
## 2 Experimental Apparatus and Methodology
### Hemming Path Adjustment  
After completing the above-mentioned calibration procedure, the 3D surface model of the actual workpiece can be reconstructed by the scanned data. Because a general working platform instead of a special die was used in this study, there is no supporting surface for the reference or alignment point under the sheet metal. In this situation, the working posture theoretically is non-ideal. As such, if an ideal hemming path that is generated from the ideal CAD model is used, hemming failure and defects will certainly occur. On the other hand, the real hemming path that will adapt to such deviations can be generated and obtained through the 3D reconstructed surface model. This real hemming path, which apparently is different from the ideal hemming path generated by the CAD model, can be used to overcome the position deviation caused by the manufacture tolerances, the sheet metal deflection deformation, and position errors introduced by loading-unloading of the work pieces.  
For an illustrated example to explain how the actual hemming point can be estimated, please see Figure 11: Take the surface model of the inner sheet S1 as a reference line, the projection point, marked by \(p_{i}\), of the tip of the outer sheet S2, denoted as \(q_{f}\), on this reference line can be calculated to obtain the actual hemming point \(O\). Since the sensor coordinate \([L]\) is only on the X-Z plane, each slice of the 3D surface model can certainly be reduced to a two-dimensional plane.  
The reference line equation is defined as  
\[f(x_{i})=ax_{i}+b=z_{i}, \tag{5}\]  
Figure 11: Illustrated example of estimating the actual hemming point.  
Figure 10: Photographs showing the (a) robot arm reference point calibration with the reference ball and (b) hand–eye relationship with the optic calibration plate.  
where \(x_{i}\) and \(z_{i}\) are the horizontal and vertical coordinates of the point \(\mathbf{p}_{i}\) in S1, respectively, and the cost function is expressed as  
\[J(a,\ b)=\frac{1}{2n}\sum_{i=1}^{n}(f(x_{i})-z_{i})^{2}, \tag{6}\]  
where \(n\) is the amount of 3D points \(S_{1}\). To obtain the parameters \(a\) and \(b\) so as to minimize \(J(a,\ b)\), a partial derivative is performed on \(J(a,\ b)\) with the following calculation.  
\[\left[\begin{array}{ccc}x_{1}&1&-z_{1}\\ x_{2}&1&-z_{2}\\ &\vdots\\ x_{3}&1&-z_{i}\end{array}\right]\left[\begin{array}{c}a\\ b\\ 1\end{array}\right]=\left[\begin{array}{c}0\\ 0\\ \vdots\\ 0\end{array}\right]\Rightarrow\mathbf{A}\mathbf{x}=\mathbf{0} \tag{7}\]  
\[\mathbf{o}=\mathbf{p}_{i}+\frac{\mathbf{u}\cdot\mathbf{v}}{||\mathbf{v}||^{2}}\mathbf{v}, \tag{8}\]  
Through singular value decomposition (SVD), the optimal \(\mathbf{x}\) can be obtained from the minimal eigenvector of matrix \(A^{\prime}A\). When \(a\) and \(b\) are obtained, by calculating the flange point \(q_{f}\) from the 3D model \(S_{2}\), and subtracting any point \(\mathbf{p}_{i}\) on the reference line to obtain vector \(u\), the hemming point \(O\) can then be solved by projection of \(v\) onto the vector \(u\). After each path point is calculated from the scanned data cloud, that is the data points that form a cloud, the hemming path is in fact the collection of all the path point coordinates that are calculated through the above process.