## 4 Software System
### Path Planning
#### 4.2.2 Alignment of the Adhesive Line with the Outside Height Profile  
In traditional manual adhesive application for the lasted upper, the outside is first temporarily fitted onto the upper, and a bonding line is manually marked around the upper to indicate the height of the outside's sidewall. After removing the outside, adhesive is applied to the region below this bonding line, as illustrated in Figure 18.  
In the automated process, a similar approach is adopted. First, the bonding line must be identified on the 3D model of the lasted upper. This is accomplished by aligning the 3D point cloud of the lasted upper with its corresponding outside model. Once the outside's sidewall is properly registered with the upper in 3D space, the bonding height is extracted from the outside geometry and projected onto the upper surface, thereby defining the bonding line. Based on this bonding line, an adhesive line is then generated to guide the robotic arm's spraying path. This ensures that the adhesive is applied only within the intended bonding region, replicating the precision of manual processes while enabling automation.  
Since the 3D models of the outside and the shoe upper are acquired using different scanning devices, they must first be registered within a common coordinate system. This  
Figure 17: Bottom view depth image of the lasted upper for determining size and foot orientation.  
Figure 18: Schematic diagram showing the outside and its corresponding bonding line on the lasted upper.  
alignment is critical to ensure that the outside's sidewall can be accurately used to define the bonding line on the upper surface. As illustrated in Figure 19, Figure 19a shows the depth map of the shoe upper from both sides, while Figure 19b presents the depth map of the outside. It is evident that a translational and rotational offset exists between the two models due to differences in their respective scanning coordinate systems. Without proper alignment, directly overlaying the outside onto the upper results in the misalignment shown in Figure 19c, where the geometries fail to correspond accurately.  
To resolve the XY-coordinate offset between the shoe upper and outside models, a set of key reference points is used to estimate the translational displacement. Specifically, two center points--**p**1 and **p**2--are extracted from the shoe upper point cloud at one-quarter and three-quarters of its total length, respectively, by averaging the coordinates across its width at those locations. Similarly, two corresponding points--**p**3 and **p**4--are selected from the outside model using the same longitudinal proportions and lateral centering method. These four points form two longitudinal reference lines, one on the upper and one on the outside, which are then used to compute the required XY translation vector for alignment.  
Next, the slope \(m1\) and center coordinate \(c1\) of the line connecting points **p**1 and **p**2 (where \(\textbf{pi}=(p\textbf{i}_{x},p\textbf{i}_{y})\)) on the shoe upper are computed, along with the slope \(m2\) and center coordinate \(c2\) of the line connecting points **p**3 and **p**4 on the outside model. Based on these values, the translational offset **D** of the outside relative to the shoe upper in the XY plane, as well as the rotation angle \(\theta\), can be determined using the equations provided below.  
\[c1=\left(\frac{p1_{x}+p2_{x}}{2},\frac{p1_{y}+p2_{y}}{2}\right),\ \ \ \ \ \ \ \ \ \ \  
boundary, which varies along the contour of the upper, serves as the bonding line for adhesive path generation.