Abstract
The motion smoothness of 3C locking robot directly affects the machining performance. Improving the motion smoothness can optimize the motion trajectory and reduce the processing time. In this paper, a novel machining path optimization model including motion smoothness is built by employing the coordinate boundary of velocity and acceleration after evaluating the machining motion smoothness of the 3C locking robot. Secondly, based on the creation of the ant colony of adaptive function algorithm, the optimization model of the 3C locking robot in the situation of fixed bolt hole position and floating bolt hole position is resolved. Lastly, the proposed approach collects and analyses a huge amount of data to enable robots to make on-the-fly decisions in the middle of production, even when faced with unexpected circumstances. In the Spark distributed environment, we use the conventional K clustering technique to improve the final output utilizing clustering means. The results show that the machining path optimization of fixed hole considering the motion smoothness improves the smoothness but extends the machining path; the cooperative machining path optimization of multiregion floating bolt holes can significantly improve the motion smoothness and effectively reduce the length of the path. The research results provide theoretical support and design guidance for designers.
1. Introduction
Computer electronic products, communication electronic products, and consumer electronic products are collectively referred to as 3C products. 3C products have the characteristics of fast replacement, large quantity of shipment, and many batches. Therefore, the performance requirements of high speed, high precision, and high efficiency in the processing process are more and more stringent. The position of the traditional 3C laptop’s locking hole generally considers only the strength and stiffness of the structure in the design. It pays less attention to the smoothness in the machining process, which makes it challenging to improve the machining accuracy and efficiency of the 3C locking robot. Many researchers have conducted a relevant study to improve the traditional processing path of fixed bolting holes. For example. Tsai et al. [1] proposed a parallel genetic algorithm to solve the global path planning and used cubic B-spline technology to optimize the feasible path. Xu et al. [2] proposed an optimization method based on honeybee intelligent behavior to optimize the path globally and considered various constraints to find the optimal path. Roberge et al. [3] used genetic algorithms and particle swarm algorithms to tackle the problem of pathway design. In a complicated three-dimensional environment, the authors calculated the best way and created paths. Zhou et al. [4] studied the problem of path planning in three-dimensional environment. The ant colony's heuristic function had been updated to make the algorithm search more targeted and enhance the pheromone updating technique to expedite the algorithm convergence. Bai et al. [5] designed an ant colony algorithm with a negative feedback mechanism using search histories and feedback. The author initiative ant colony's optimization technique is to explore uncharted space through expanding the diversity of solutions and improving search efficiency. Wang et al. [6] proposed a path planning method for improving ant colony algorithm, which is optimized by introducing the distance heuristic function factor and adjusting state transition probability and changing pheromone update rules. Zhou et al. [7] improved the fast search random tree optimization algorithm for the path planning of the 6-degree-of-freedom robot and improved the quality of the path.
However, the target position in these optimization methods is fixed and the moving distance between holes remains unchanged. In the actual design stage, the bolt locking hole design position of 3C products can be floating in the local limited area and the real design position can be moved freely. Therefore, floating hole path optimization in the joint design and manufacturing stage is difficult to solve effectively by using traditional optimization methods. Besides, the smoothness of the 3C locking robot is related to the motion accuracy, efficiency, and service life of the robot. The uneven motion trajectory will have a significant impact and seriously affect the positioning accuracy of the end effector. Also, it will wear joints and reduce the service life of the robot [8]. Therefore, to ensure the smoothness of the robot, it is necessary to optimize the robot’s trajectory. The screw hole position design has always been limited to the product structure strength as the constraint boundary, and the speed and acceleration of machining smoothness are seldom considered. Suppose that the smoothness collaborative path optimization method is adopted. In that case, the conventional optimization method can only obtain the regional optimal position between some screw holes, and it is easy to fall into local optimum.
To solve the optimization problem of this kind of complex model, many scholars have developed many algorithms to solve it. Huang et al. [9] used adaptive inertia weight and crossover probability parameters to improve the particle swarm optimization algorithm, enhancing the individual communication ability and collective communication ability of particles, which improves the global search ability of the algorithm and the positioning efficiency of the manipulator. Xu et al. [10] solved the motion of the robot by reducing the constraints of the robot end effector and combining hybrid algorithms such as quadratic programming and particle swarm optimization. Xu et al. [11] proposed a method of weighting the trajectory of each segment of the robot. The parameters such as joint velocity, acceleration, acceleration, force, and torque are used as constraints to optimize the motion time and energy consumption of the end effector. Liu et al. [12] carried out manipulator trajectory planning through the fifth-order B-spline interpolation approximation principle and introduced the particle swarm optimization algorithm to solve the problem, and the control error is within a certain range. Shi et al. [13] used genetic algorithm to constrain the speed, acceleration, and torque of each joint to optimize the trajectory of the robot, which satisfies the smoothness of the joint angle and ensures the running efficiency of the manipulator. These methods can solve the conventional optimization problem with sufficient constraints, but it is still impossible to solve the multiregion path uncertainty problem efficiently.
In this research, we proposed the motion smoothness-machining path optimization model of the 3C locking robot. The major contributions of the paper are as follows to improve the ant colony algorithm with the K-means algorithm.(i)The proposed ant colony algorithm with adaptive function is developed to solve the collaborative optimization model.(ii)The proposed model improves the motion smoothness-machining path of a fixed hole and multiregion floating hole, respectively.(iii)The proposed model analyses a huge amount of data to enable robots to make on-the-fly decisions in the middle of production.(iv)The performance of the suggested model is thoroughly assessed using the powerful computing abilities of the Spark cluster to handle the 3C locking robot’s machining efficiency and trajectory ride quality.
The rest of the paper is organized as follows. In Section 2, a proposed design of the spatial trajectory analysis of 3C locking SCARA robot is given. The establishment of collaborative optimization model process analysis is conducted in Section 3. Solving ant colony and K-means algorithms with adaptive function is discussed in Section 4. The experimental results and discussion are further summarized in Section 5. Finally, Section 6 concludes the paper with a summary and future research directions.
2. Spatial Trajectory Analysis of 3C Locking SCARA Robot
2.1. Structural Analysis of 3C Locking SCARA Robot
The Selective Compliance Assembly Robot Arm (SCARA) robot has four degrees of freedom. The upper arm of component 1 and the forearm of component 2 do rotational motions and , respectively, as well as the rotational motion of component 3 and the translation motion of component 4 along the z-axis. The coordinate system XYZ of each component is established according to the right-hand rule. The Cartesian coordinate system of each joint of the SCARA robot is shown in Figure 1, and there are four active joint components.

When 3C products need to lock multiple holes in known positions, the end effector of the SCARA locking robot can travel the shortest path from the position waiting for work on the production line and pass through all the locking hole positions and lock the screws. After the screw locking is completed, the end effector returns to the initial position [14, 15]. At this time, the assembly line continues to move forward and the next laptop to be assembled moves to the assembly position [16, 17]. The specific parameters are shown in Table 1.
2.2. Inverse Kinematic Analysis of 3C Locking Robot
The 3C locking SCARA robot starts from the base i = 0 and numbers each component from 1 to the i-th component (i = 1, 2, 3, 4). According to the right-hand rule to establish the rectangular coordinate system , the adjacent coordinate systems can be connected through a certain homogeneous transformation matrix [18, 19]. By multiplying the homogeneous transformation matrix from i = 1 component to i = 4 component coordinate system, the absolute coordinate system relationship of i = 1 component coordinate system relative to i = 4 end effector position can be obtained. The kinematic model of robot is established by the DH method. For the sake of convenience, the expression is simplified. The matrix transformation of the end effector relative to the base can be expressed aswhere denotes the homogeneous transformation matrix of the coordinate system from the i − 1 component to the i-th component.
The homogeneous coordinate transformation matrix from i = 1 connecting rod to i = 2 connecting rod is
The homogeneous coordinate transformation matrix from i = 2 connecting rod to i = 3 connecting rod is
The homogeneous coordinate transformation matrix from i = 3 connecting rod to i = 4 connecting rod is
Through the above matrix transformation, the vector of the end effector relative to the base i = 0 iswhere
Equation (6a) is the positive solution of the pose matrix, which is obtained by the transformation of the Cartesian coordinate system of the adjacent joints of the robot. The pose matrix can also be expressed as follows:where R is the rotation matrix of 3C locking SCARA robot end effector coordinates relative to the base coordinates of robot base and P is the coordinate translation vector of end effector relative to the base coordinates. The end effector can reach the target position from the initial point through the general rigid body transformation through the pose matrix A. If the robot moves from the current position to the target position, the following conditions need to be met:where is the pose matrix of the end effector reaching the target point and is the pose matrix of the current end effector.
Equation (8) represents that the angle of motion of each joint in the current end effector matrix is equal to that of each joint in the target position. The inverse kinematic problem of the robot can be transformed into solving the optimal value of nonlinear multivariate function by equation (4), which provides the basis for establishing the model of joint motion smoothness and end effector path collaborative optimization of 3C locking robot.
3. Establishment of Collaborative Optimization Model
3.1. Motion Smoothness Construction of 3C Locking Robot
The smoothness optimization of the trajectory of the end effector of SCARA locking robot can be achieved by the quartic third-order B-spline interpolation method [20]. In order to determine the boundary conditions of velocity and acceleration of the end effector passing through the screw hole, the determined joint angle can be obtained by inverse solution. Each trajectory of the quartic third-order B-spline function in each joint is determined by four known target points. If four points are defined as, , , , then the B-spline function is expressed aswhere t denotes time, , and are B-spline basis functions.
Because of the continuity of the trajectory, the end of the previous track and the initial point of the next track should be equal, and thus there are
Because the locus is continuous, the cubic B-spline function is also continuous in the first and second derivative.
The following equation can be obtained from the transformation relation of Cauchy equation.
Therefore, the coefficient of the basis function here can be determined as
Equation (9a) can be rewritten as
Taking derivatives of equation (5), we can obtain the constraint function of its position, velocity, and acceleration.
The expressions of velocity, acceleration, and acceleration of any trajectory curve of SCARA robot can be known from equations (10a)–(10c). To make the end effector run smoothly and improve the running efficiency, the running time of each track is set within the same time and each parameter is limited. Thus, the motion smoothness, velocity, and acceleration constraints of the 3C locking robot can be constructed as follows:where are the absolute values of the initial velocity and the maximum velocity of the trajectory; are the absolute values of the initial acceleration and the maximum acceleration of the trajectory; are the absolute values of the initial jerk and the maximum jerk of the trajectory; and , , and are the maximum values of velocity, acceleration, and jerk corresponding to this trajectory. At the same time, the range of motion of each joint should be the same as that of the selected robot model, that is,where and , respectively, represent the minimum and maximum allowable joint angles of the i-th joint axis.
3.2. Collaborative Optimization Model of Motion Smoothness and Machining Path
A three-dimensional Cartesian coordinate system [21–23] establishes the working environment of the 3C locking SCARA robot. In the three-dimensional space, the lower-left corner of the laptop is used as the coordinate origin, the horizontal direction of the origin is the X-axis, the vertical direction of the origin is the Y-axis, and the thickness direction of the laptop is the Z-axis. In this way, each screw hole has a coordinate that represents the position in the three-dimensional plane. The midpoint of the X-axis is taken as the initial point of the robot end effector. According to the idea of the ant colony algorithm for solving the traveling salesman problem (TSP), the initial point is also regarded as a hole position that needs to be machined so that the solution path is a closed path. The end effector can always return to the original point in the end. Each locking hole number represents the original counterclockwise processing order. In this way, there is a coordinate in the center of each hole that represents the location of the locking hole. Because the joint motion angle of the locking SCARA robot is limited, the locking hole to be machined needs to meet the allowable machining range of the robot. By equation (2), the joint angle of the robot can be connected with the position of the coordinate point, and the relationship between the joint angle and the position of the coordinate point iswhere denotes the initial position coordinate of the end effector. Within the range of motion of the robot’s joints, the end effector can reach any position in space. The SCARA robot locking position area is shown in Figure 2.

In the machining of locking the hole, the space processing time of the robot is mainly due to the travel factor. The shortest travel space path of the end effector can be expressed aswhere and represent different sequence numbers of two locking holes.
Equation (9g) can convert the joint rotation angle of 3C locking robot into the travel path of the end effector. By equation (10a), the optimal path can be obtained under the condition that the locking hole is fixed. However, with a limited number of holes and fixed hole coordinates, the number of paths obtained by permutation and combination is limited, and the shortest path is also determined. Evidently, such a single solution cannot meet the actual demand under the condition of pursuing efficiency in the 3C production line. Therefore, under the premise of satisfying the structural strength, according to the random search characteristics of the ant colony algorithm, the multiregion screw hole design position search is carried out, and the screw hole position is adjusted to obtain an optimal design and manufacturing collaborative optimization path. At the same time, the machining efficiency is related not only to the path of the end effector but also to the pose change angle of the robot. Because each joint has to rotate at a certain angle when the end effector reaches the target point, there are often multiple solutions to the inverse of the pose matrix. In order to minimize the angle change when the robot end effector reaches the target point, each angle of inversion is required:
It means that when a joint finds that multiple angles can reach the target point (), choose the angle with the smallest rotation angle. Therefore, the mathematical model of the shortest path for collaborative optimization of the design location of multiregion locking holes is as follows:
The optimal path of fixed hole and floating hole can be solved by using equations (11) and (15). When the fixed hole is optimized, represent the definite value, and when the floating hole is optimized, represent the corresponding floating value.
4. Solving Ant Colony and K-Means Algorithms with Adaptive Function
4.1. Search Environment Modeling of Multiregion Floating Holes
In order to solve the multiregion floating hole motion smoothness-machining path optimization model, this paper divides the floating hole region into grid division and takes each grid intersection as the target point for each optimization, so as to finally find the shortest path that meets the accuracy requirements [24–26], as shown in Figure 3. The size of the grid is related to the size of the screw hole. In order to make the design position of the screw hole fall within the theoretical optimal position, the length of the grid must be designed not to exceed half the diameter of the screw hole. Therefore, the relationship between the diameter of the screw hole and the grid can be expressed aswhere denotes the length of the floating hole area and represents the width of the floating hole area. If the area is circular, its diameter is , l is the number of columns of the grid, c is the number of rows of the grid, and is the number of rows of the circular area grid. The distribution area of the screw hole is divided equally by the grid method, and the intersection point between the grids is the search position of the screw hole. After rasterizing the floating hole area, each grid has its serial number and coordinate, its i-th row and j-th column grid is marked as , and the serial number is m. The coordinate corresponding to each grid iswhere x0 and y0 are the coordinates of the lower-left corner of the floating hole region in the working environment of the robot, int is the integral calculation, and mod is the remainder calculation. If the area is circular, .

4.2. Construction of Ant Colony Optimization Algorithm Based on Adaptive Function
When the traditional ant colony algorithm is used to solve the path optimization problem, is the calculation method of ant position transfer, which represents the transfer probability of ant k from position i to j at a certain time.where is the pheromone concentration of (i, j) in the graph and is the heuristic information associated with (i, j), that is, the visibility of ants. are the weight parameters of and , respectively.
The update of pheromone includes two processes: volatilization and release of pheromone. When all ants complete a search, the current optimal path will guide other ants to search the path, and the ants that do not arrive will not be counted [27, 28]. The pheromone update equation iswhere , , is the evaporation rate of the pheromone; represents the residue of pheromone volatilization; and represents the newly released pheromone of k ants on the path i to j.
For the multiregion floating hole path optimization problem, the traditional ant colony algorithm is difficult to solve. The path optimization model considering motion smoothness will increase the difficulty of operation, and multiregion floating hole path optimization needs to calculate a large number of paths on the grid. Therefore, in order to improve the computing ability of the traditional ant colony algorithm, it is necessary to construct the ant colony algorithm with adaptive function to solve the problem [29]. The fitness of the nonfixed value is expressed by ω, which is contrary to the pheromone. When the fitness ω is large, it shows that the result of the previous step has a great influence on the current result and the global search is carried out, while when ω is small, the local search is carried out. This setting can speed up the operation of the algorithm and iterate faster.where ωmax denotes the maximum fitness, ωmin is the minimum, and Q is constant and represents the pheromone released by the ant movement. The closer it is to the objective function, the more the pheromone released by the ant. To verify whether the ant colony algorithm for constructing adaptive function can effectively and reasonably distribute the computing power and improve the running efficiency of the algorithm, it needs to use the Schaffer function, that is, test function, to verify the operation effect of the algorithm. The ant colony algorithm and the ant colony algorithm for constructing adaptive function are used to calculate, respectively. The parameters are selected as follows: the number of ant colony is 300, the moving number is 80, the number of pheromone evaporation is 0.9, the transition probability is 0.2, and the initial fitness value is 0.4. In the case of ensuring that both algorithms can obtain a minimum value of −1 at (0, 0), the adaptive function is calculated by both algorithms as shown in Figure 4.

As can be seen from Figure 4, in the case that both algorithms can find the optimal value, the ant colony algorithm for constructing the adaptive function reaches the minimum pheromone concentration faster, indicating that the adaptive function is more efficient.
4.3. K-Means Algorithm
This section describes the basic flow of the K-means algorithm. First, determine the initial cluster center. Enter the number of cluster centers k (the dataset contains n cluster objects), select k data objects arbitrarily from the dataset X, and set it as the initial centroid . Secondly, calculate the distance from the point in the dataset to the k initial centroids. If is satisfied, then . Then, recalculate the centroid of the clusters again, and the calculation equation is as follows:
Finally, if the distance between the new and prior centers of mass is zero, the new center of mass is equal to the old center of mass. If the difference between the two distances is less than the set threshold value, the calculation and algorithm are both halted; otherwise, the iterative computation is resumed by proceeding to Step 2.
5. Comparison and Verification of Results
5.1. Experimental Setup
We have established a Spark cluster that uses six default physical processing nodes. Table 2 explains the key hardware and software requirements used in the testing. The latest Ubuntu 18 LTS, Spark 2.3.4, and Hadoop 2.7.3 operating systems have been used on all processing nodes [30]. One processing node is considered as the master, and the other five nodes have been configured as functioning nodes.
5.2. Path Optimization Solution of End Effector of 3C Locking Robot
The route of the robot end effector crossing all the locking hole positions is computed from the beginning point using two methods in Matlab, using the center of the locking hole as the target point. As shown in Figure 2, the three-dimensional coordinates of the center of the locking hole are as follows: X = (20, 100, 370, 70, 220, 220, 115, 370, 295, 220, 10, 105, 225, 370), Y = (20, 20, 20, 30, 70, 160, 160, 215, 230, 248, 265, 265, 265, 265, 265), and Z = (4, 4, 4, 12, 12, 12, 12, 4, 12, 12, 4, 4, 4, 4) (unit is mm). The coordinate of the initial point of the end effector is = (180, 0, 0).
In order to establish the moving target model, the parameters are selected as follows: the number of ant colony is 300, the moving number is 80, the number of pheromone evaporation is 0.5, the initial fitness value is 0.3, and the total amount of information released Q = 1, , . Use the ant colony algorithm and the ant colony algorithm for generating adaptive functions to run the test 50 times to discover the best path and compare it to the optimal path of the fixed hole and the path of the fixed hole smoothness optimization. Figure 5 depicts the end outcome. The achieved optimal path of the fixed hole, the optimized path of the fixed hole, and the optimal path of the multiregion floating hole in the case of many consecutive testing are presented in the table below.

Table 3 shows that the optimized path length of the fixed hole is somewhat shorter than the ideal length of the fixed hole owing to track smoothness considerations. The optimal path for smoothness optimization of multizone floating holes is, which considered the smoothness of joints, and the path length is better than the optimal path for fixed holes, saving 13.5% of the end effector travel cost.
5.3. Optimization Results of Motion Smoothness of 3C Locking SCARA Robot
The 4-degree 3C locking robots are used for the experimental tests and the inversely DH solution is calculated with Matlab software. As a consequence of posture optimization, the solution with the least angle of rotation is picked. The Cartesian robot base coordinates as the basis co-orders and the movement limit conditions of each robot joint comply with the specifications of the SCARA robot, as determined in the created robot model (shown in Table 1). Taking as the objective the best track of the permanent hole, the optimum fastening hole track, and the optimal trajectory of the floating multiregional hole, we achieved the arc value by reverse solution for each joint rotation. RobotStudio simulates the path of the handler using the robot joint arc, and each track’s movement duration is one second. A moving pair is the third joint, while a turning pair is the fourth joint. Consequently, its joint angle must not be optimized and expressed. The path of the fixed hole is made of straight lines without considering optimizing movement smoothness. The position of the point controls the robot’s end effector, and its speed is fixed. Figure 6 shows the curve of its angle and joint velocity.

The rapid shift in the joint angle after the target point without taking into account the movement smoothness optimization shows that the impact is quite big and each track is locked in its velocity. The immediate acceleration of the final effector at the beginning and the end of each trajectory to attain the desired speed is therefore potentially limitless. The motion smoothness of the end effector route of the robot must thus be optimized. The robot’s end effectors can improve the speed, acceleration angle, and acceleration changes in movement more smoothly by optimizing the motion smoothness. The results of the optimization of movement smoothness of the fixed hole are compared with angle, speed, and acceleration changes for every joint following optimization of the movement smoothness of the floating hole in many regions, as shown in Figure 7. The improved smooth movement of the floating multiple holes leads to decreased joint angle probability. Smaller variations in characteristics such as speed and acceleration, smoother paths, and slower direction impact changes in movement. It also depends on the joint angle, speed, and acceleration variation curve.

5.4. Scalability Analysis of 3C Locking SCARA Robot
This study conducts a comparison experiment on scalability to evaluate the clustering effect of the K-means clustering method based on 3C locking SCARA robot data. In Figure 8, the scalability analysis of the recommended model is done for a large number of datasets and various processing nodes. Figures show that the suggested model time has dropped significantly with an increasing number of processing nodes.

We also use the original K-means classification technique, together with the original K-means classification approach. We carried out twenty tests each and conducted a test on the algorithm of various algorithms. Table 4 gives the quickest runtime for 20 tests with varied size datasets, the maximum time, and the algorithm’s average duration. According to the data in Table 4, the minimum cluster time of the serial K-means algorithm in Dataset 1 is 12.36 seconds, while the parallel K-means method is running for the largest amount of time. The K-means serial method is better than the K-means parallel algorithm. The K-means method in parallel is better than the K-means serial technique in Dataset 2 and Dataset 3.
6. Conclusion
In this research, the machining path is optimized to solve the difficulties of the motion smoothness of 3C locking robots. A novel 3C locking robot model for motion-smoothness machining is built. The adaptive ant colony algorithm solves the model of optimizing the machining path of the 3C locking robots to improve the motion smoothness, where the screw holes are floating fixed. The findings reveal that the smoothness of the fixed hole has enhanced, but the path has been increased by 10.3% compared to the optimum path of the fixed hole.
The smooth optimization of the floating multiple controllable holes may increase movement smoothness effectively and minimize the work path (13.5% lower than the ideal path of the fastening holes). In reality, given that big data will play an increasingly essential role in the next several years in the 3C locking robot, legal concerns such as these will only become more relevant in the future.
Data Availability
The data used to support the findings of this study are included within the article.
Conflicts of Interest
The authors declare that they have no potential conflicts of interest.
Acknowledgments
This study was supported by the Technology Innovation and Application Development Project of Chongqing (nos. cstc2018jszx-cyzdX0159 and cstc2019jscx-mbdxX0049), Chongqing Science and Technology Bureau Technology Innovation and Application Development General Project (no. cstc2020jscx-msxmX0152), Special Funding for Postdoctoral Research Projects in Chongqing (no. xm2017034), and National Key Special Project for Technology Boosting Economy (no. 2020YFF0404209).