A shaft hole assembly method and device based on a nearest neighbor algorithm

Through the shaft-hole assembly method based on the nearest neighbor algorithm, feature extraction and mapping discrimination model are used to quickly adjust the end of the robotic arm to the center of the hole, which solves the problem of online reasoning uncertainty in robot shaft-hole assembly and improves the assembly success rate.

CN117260208BActive Publication Date: 2025-10-21HUAZHONG UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311146607.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-05
Publication Date
2025-10-21
Estimated Expiration
2043-09-05

AI Technical Summary

Technical Problem

In existing technologies, the online reasoning uncertainty of robot shaft-hole assembly under the conditions of few samples and large positioning deviation makes it impossible to guarantee the assembly success rate.

Method used

A shaft-hole assembly method based on the nearest neighbor algorithm is adopted. By obtaining the current position data of the end of the robotic arm and a preset number of sample data, feature extraction and classification are performed, a mapping discrimination model is constructed, and the nearest sample point is calculated using the nearest neighbor algorithm to adjust the end of the robotic arm to the center of the hole.

Benefits of technology

With few samples and large positioning deviations, fast training and efficient assembly are achieved, the assembly success rate is improved, and the assembly failure problem caused by online reasoning uncertainty is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117260208B_ABST
    Figure CN117260208B_ABST
Patent Text Reader

Abstract

The application provides a shaft hole assembly method and device based on a nearest neighbor algorithm, and the method comprises the following steps: determining a hole center position according to a to-be-executed shaft hole task, obtaining first current position data of an end of a mechanical arm, and a preset number of sample data with the hole center position as the center; performing feature extraction and feature classification on the preset number of sample data to obtain a feature classification result corresponding to each sample data, and constructing a mapping discrimination model according to all the feature classification results; performing calculation on the first current position data and the preset number of sample data according to the nearest neighbor algorithm to obtain a nearest sample point; processing the first current position data according to the mapping discrimination model to obtain a stepping direction; controlling the end of the mechanical arm according to a preset position trajectory, the nearest sample point and the stepping direction, and when the end of the mechanical arm is adjusted to the hole center position, performing operation according to a preset depth to complete the to-be-executed shaft hole task. The application achieves the purpose of improving the assembly success rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of shaft hole assembly, and in particular to a shaft hole assembly method and device based on a nearest neighbor algorithm. Background Art

[0002] In industrial production, assembly costs account for over 50% of total production costs. Due to the high cost, time-consuming, and labor-intensive nature of manual assembly, robotic automated assembly has been widely researched and is gradually replacing manual labor. Traditional shaft-hole assembly relies on contact model-based approaches, most of which identify contact states from assembly forces and control assembly motions based on this identified contact state. However, for single-axis or multi-axis holes with large initial deviations, the contact model is more complex, making it difficult to accurately identify contact states using six-dimensional force sensors. Furthermore, contact model-based approaches are sensitive to environmental noise, making them difficult to generalize to new assembly tasks.

[0003] Currently, learning-based robotic flexible assembly and automated assembly methods are being widely researched. Deep learning (DL) and reinforcement learning (RL) can be used to solve assembly tasks requiring contactless state recognition. Through continuous interaction with the environment over multiple assembly processes, human-like assembly skills can be learned. However, previous methods based on assembly strategy learning typically use large, deep, and complex networks and rely on extensive exploration of the entire assembly process, resulting in long training times and low data efficiency. With few samples and large positioning deviations, the uncertainty of online reasoning makes it impossible to guarantee assembly success rates.

[0004] Therefore, it is urgent to propose a shaft-hole assembly method and device based on the nearest neighbor algorithm to solve the technical problem in the existing technology that the assembly success rate cannot be guaranteed due to the uncertainty of online reasoning under small samples and large positioning deviation. Summary of the Invention

[0005] In view of this, it is necessary to provide a shaft-hole assembly method and device based on the nearest neighbor algorithm to solve the technical problem in the existing technology that the assembly success rate cannot be guaranteed due to the uncertainty of online reasoning under small samples and large positioning deviations.

[0006] In one aspect, the present invention provides a shaft-hole assembly method based on a nearest neighbor algorithm, comprising:

[0007] Determine the hole center position according to the axis-hole task to be executed, obtain first current position data of the end of the robot arm, and a preset number of sample data centered on the hole center position;

[0008] Performing feature extraction and feature classification on the preset number of sample data to obtain a feature classification result corresponding to each sample data, and constructing a mapping discrimination model based on all feature classification results;

[0009] Calculating the first current position data and the preset number of sample data according to a nearest neighbor algorithm to obtain a nearest sample point; and processing the first current position data according to the mapping discriminant model to obtain a step direction of the nearest sample point;

[0010] The end of the robotic arm is controlled according to the preset position trajectory, the nearest sample point and the stepping direction. When the end of the robotic arm is adjusted to the center position of the hole, the operation is performed according to the preset depth to complete the shaft hole task to be executed.

[0011] In some possible implementations, the method further includes:

[0012] When the end of the robotic arm detects an obstacle, obtaining the obstacle force exerted on the end of the robotic arm by the obstacle;

[0013] determining an additional position based on the preset position trajectory and the first current position data;

[0014] Determining a deviation value of the end of the robotic arm based on the obstacle force and a preset desired force at the end of the robotic arm;

[0015] The preset position trajectory is corrected according to the deviation value and the additional position, so that the end of the robotic arm operates according to the corrected position trajectory.

[0016] In some possible implementations, determining the hole center position according to the shaft-hole task to be executed and obtaining a preset number of sample data centered on the hole center position include:

[0017] Determining a preset number of sample positions around the center position of the hole in a preset order according to a preset shaft-hole gap and a preset sampling interval;

[0018] Determine the action direction label corresponding to each sample position according to the preset number of sample positions and the hole center position; the action direction label is used to indicate the direction of the next action of each sample position;

[0019] A preset number of sample data of the preset number of sample positions is obtained according to the motion direction label corresponding to each sample position.

[0020] In some possible implementations, obtaining a preset number of sample data for the preset number of sample positions according to the motion direction label corresponding to each sample position includes:

[0021] When determining the preset number of sample positions according to the preset sequence, obtaining the force and torque required for each sample position to proceed to the next step;

[0022] A preset number of sample data of the preset number of sample positions is obtained according to the force, the torque and the action direction label corresponding to each sample position in the preset number of sample positions.

[0023] In some possible implementations, performing feature extraction and feature classification on the preset number of sample data to obtain a feature classification result corresponding to each sample data includes:

[0024] Determining the movement direction corresponding to each sample data according to the movement direction label, thereby constructing a six-dimensional force-motion dataset;

[0025] Performing one-dimensional feature extraction on all sample data in the six-dimensional force-motion data set to obtain one-dimensional feature data corresponding to each sample data;

[0026] Performing global feature extraction on all one-dimensional feature data according to the self-attention mechanism to obtain the global data features corresponding to each sample data;

[0027] All global data features are labeled and classified according to the preset activation function to obtain the feature classification results corresponding to each sample data.

[0028] In some possible implementations, calculating the first current position data and the preset number of sample data according to a nearest neighbor algorithm to obtain the nearest sample point includes:

[0029] Performing deviation classification on the preset number of sample data to obtain sample data in a large deviation domain and sample data in a small deviation domain;

[0030] Comparing the first current position data with the sample data of the large deviation domain and the sample data of the small deviation domain to determine the category to which the first current position data belongs;

[0031] All sample data in the category are calculated according to the nearest neighbor algorithm to obtain the nearest sample point.

[0032] In some possible implementations, controlling the end of the robotic arm according to the preset position trajectory, the nearest sample point, and the stepping direction includes:

[0033] When the category belongs to the sample data of the large deviation domain, the center position of the hole is calculated according to the nearest sample point to obtain a step value;

[0034] Controlling the end of the robotic arm according to the step value and the step direction;

[0035] When the category is sample data of the small deviation domain, the end of the robotic arm is controlled according to a preset fixed step value and the step direction.

[0036] In some possible implementations, after controlling the end of the robotic arm according to the step value and the step direction, the method further includes:

[0037] Acquiring second current position data of the end of the robotic arm;

[0038] Replace the second current position data with the first current position data, and execute the steps of "calculating the first current position data and the preset number of sample data according to the nearest neighbor algorithm to obtain the nearest sample point; and processing the first current position data according to the mapping discrimination model to obtain the stepping direction of the nearest sample point".

[0039] In some possible implementations, after controlling the end of the robotic arm according to the preset fixed step value and the step direction, the method further includes:

[0040] Acquiring third current position data of the end of the robotic arm;

[0041] determining, based on the third current position data, whether the position of the end of the robotic arm is the center position of the hole;

[0042] If not, processing the third current position data according to the mapping discrimination model to obtain a target stepping direction;

[0043] The end of the robotic arm is controlled according to the preset fixed step value and the target step direction, and the step of "obtaining third current position data of the end of the robotic arm" is performed.

[0044] On the other hand, the present invention also provides a shaft-hole assembly device based on a nearest neighbor algorithm, comprising:

[0045] a data acquisition module, configured to determine the hole center position according to the shaft-hole task to be executed, obtain first current position data of the end of the robotic arm, and a preset number of sample data centered on the hole center position;

[0046] A model building module is used to extract and classify features of the preset number of sample data, obtain feature classification results corresponding to each sample data, and build a mapping discrimination model based on all feature classification results;

[0047] a sample determination module, configured to calculate the first current position data and the preset number of sample data according to a nearest neighbor algorithm to obtain a nearest sample point; and to process the first current position data according to the mapping discriminant model to obtain a stepping direction of the nearest sample point;

[0048] The task execution module is used to control the end of the robotic arm according to the preset position trajectory, the nearest sample point and the stepping direction. When the end of the robotic arm is adjusted to the center position of the hole, it operates according to the preset depth to complete the shaft hole task to be executed.

[0049] The beneficial effect of adopting the above embodiment is that the shaft-hole assembly method based on the nearest neighbor algorithm provided by the present invention can obtain a preset number of sample data at positions with different deviations around the center position of the hole, and construct a mapping discrimination model by extracting and classifying the preset number of sample data. Since the sample data is small, the training process is short, which can solve the technical problem that the existing technology relies on a large amount of exploration of the entire assembly process, resulting in a long training time, and realizes the process of training the model under the condition of few samples and large positioning deviation. Furthermore, the nearest sample point of the current position data can be determined according to the mapping discrimination model, and a judgment can be made based on the position of the nearest sample point. The end of the robot arm can be adjusted according to the judgment result, thereby looping until the end of the robot arm is adjusted to the center position of the hole to complete the shaft-hole task to be executed, thereby solving the technical problem in the existing technology that the assembly success rate cannot be guaranteed due to the uncertainty of online reasoning. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0051] Figure 1 A schematic flow chart of an embodiment of the shaft-hole assembly method based on the nearest neighbor algorithm provided by the present invention;

[0052] Figure 2 A schematic structural diagram of an embodiment of the shaft hole equipment provided by the present invention;

[0053] Figure 3 A schematic structural diagram of an embodiment of a preset number of sample positions provided by the present invention;

[0054] Figure 4 A schematic structural diagram of an embodiment of a motion direction label with a preset number of sample positions provided by the present invention;

[0055] Figure 5 A schematic diagram of the structure of an embodiment of the large deviation domain and the small deviation domain provided by the present invention;

[0056] Figure 6 A schematic structural diagram of an embodiment of a shaft-hole assembly device based on a nearest neighbor algorithm provided by the present invention;

[0057] Figure 7 This is a schematic structural diagram of an embodiment of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0058] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present invention.

[0059] Some of the blocks shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor systems and / or microcontroller systems.

[0060] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0061] The embodiments of the present invention provide a shaft-hole assembly method and apparatus based on a nearest neighbor algorithm, which are described below.

[0062] Figure 1 A schematic flow chart of an embodiment of the shaft hole assembly method based on the nearest neighbor algorithm provided by the present invention is shown in FIG. Figure 1 As shown in the figure, the shaft-hole assembly method based on the nearest neighbor algorithm includes:

[0063] S101, determining the hole center position according to the axis-hole task to be executed, obtaining first current position data of the end of the robot arm, and a preset number of sample data centered on the hole center position;

[0064] S102, performing feature extraction and feature classification on a preset number of sample data, obtaining a feature classification result corresponding to each sample data, and constructing a mapping discriminant model based on all feature classification results;

[0065] S103, calculating the first current position data and a preset number of sample data according to a nearest neighbor algorithm to obtain a nearest sample point; and processing the first current position data according to a mapping discriminant model to obtain a step direction of the nearest sample point;

[0066] S104, controlling the end of the robotic arm according to the preset position trajectory, the nearest sample point and the stepping direction. When the end of the robotic arm is adjusted to the center of the hole, the operation is performed according to the preset depth to complete the axis hole task to be executed.

[0067] Compared with the prior art, the shaft-hole assembly method based on the nearest neighbor algorithm provided by the present invention can obtain a preset number of sample data at positions with different deviations around the center of the hole, and construct a mapping discrimination model by extracting and classifying the preset number of sample data. Since the sample data is relatively small, the training process is relatively short, which can solve the technical problem that the prior art relies on a large amount of exploration of the entire assembly process, resulting in a long training time, and realizes the process of training the model under the condition of few samples and large positioning deviations. Furthermore, the nearest sample point of the first current position data can be determined according to the mapping discrimination model, and a judgment can be made based on the position of the nearest sample point. The end of the robot arm can be adjusted according to the judgment result, and the cycle is carried out until the end of the robot arm is adjusted to the center of the hole to complete the shaft-hole task to be executed, thereby solving the technical problem in the prior art that the assembly success rate cannot be guaranteed due to the uncertainty of online reasoning.

[0068] It should be understood that the shaft hole task to be executed in step S101 can be a task that requires a robotic arm to operate and is set by the staff according to actual needs.

[0069] In a specific embodiment of the present invention, Figure 2 As shown, the shaft hole equipment at the end of the robotic arm can be an shaft diameter of 8.0 mm, a hole diameter of 8.5 mm, a hole chamfered with 1 mm, and a shaft hole assembly with a diameter of 10.5 mm. The chamfer can be added or not, and can be set according to actual conditions. The embodiment of the present invention is not limited here.

[0070] It should be noted that, in order to obtain data of sample points around the center of the hole, in some embodiments of the present invention, step S101 includes:

[0071] According to the preset shaft-hole gap and the preset sampling interval, a preset number of sample positions around the hole center position are determined in a preset order;

[0072] According to the preset number of sample positions and the hole center position, the action direction label corresponding to each sample position is determined; the action direction label is used to indicate the direction of the next action of each sample position;

[0073] According to the motion direction label corresponding to each sample position, a preset number of sample data of the preset number of sample positions is obtained.

[0074] It should be noted that the action direction labels may include moving left, moving downward, moving right and moving upward, and the preset order may be a square wave order.

[0075] In a specific embodiment of the present invention, Figure 3 As shown, taking the position adjustment in the horizontal X and Y directions as an example, assuming that the preset shaft hole gap is 0.5mm and the preset sampling interval is 0.4mm, the accurate positions around the hole center position are traversed in a square wave order with the preset sampling interval to obtain sample points 1, sample points 2, sample points 3, ..., sample points 49, thereby obtaining a preset number of sample positions, wherein sample point 25 is the hole center position. It is also possible to calculate the optimal operation that should be performed for each sample position based on the deviation between each sample position and the hole center position, thereby determining the action direction label corresponding to each sample position. For example, the action direction label of sample point 1 can be downward movement, the action direction label of sample point 2 can be downward movement, the action direction label of sample point 14 can be rightward movement, and so on; it is also possible to classify according to the action direction label of each sample position, such as Figure 4 As shown, a triangle represents upward movement, a five-pointed star represents downward movement, a circle represents leftward movement, and a square represents rightward movement, thereby classifying the 49 sample points into these four categories. The specific method for calculating the motion direction label can be set according to actual conditions and is not limited in this embodiment of the present invention.

[0076] In some embodiments of the present invention, obtaining a preset number of sample data at a preset number of sample positions according to the motion direction label corresponding to each sample position includes:

[0077] When determining a preset number of sample positions according to a preset sequence, obtaining the force and torque required for each sample position to proceed to the next step;

[0078] A preset number of sample data of the preset number of sample positions is obtained according to the force, torque and action direction label corresponding to each sample position in the preset number of sample positions.

[0079] In a specific embodiment of the present invention, when the positions of the sample points around the center position of the hole are detected in a preset order, the force and torque required for each sample position to proceed to the next step can be detected, so that the force, torque and action direction label of each sample position can be determined, and a preset number of sample data based on the preset number of sample positions can be obtained.

[0080] In some embodiments of the present invention, step S102 includes:

[0081] According to the motion direction label, the movement direction corresponding to each sample data is determined to construct a six-dimensional force-motion dataset;

[0082] Perform one-dimensional feature extraction on all sample data in the six-dimensional force-motion dataset to obtain one-dimensional feature data corresponding to each sample data;

[0083] Perform global feature extraction on all one-dimensional feature data based on the self-attention mechanism to obtain the global data features corresponding to each sample data;

[0084] All global data features are labeled and classified according to the preset activation function to obtain the feature classification results corresponding to each sample data.

[0085] It should be noted that the label classification can be the classification of the six-dimensional force label calculated according to the activation function.

[0086] In a specific embodiment of the present invention, the position error of the axis relative to the hole can be reduced by the action direction label. For the posture adjustment in the X and Y directions, a similar strategy can be adopted to construct different angle deviations for sampling. Therefore, after obtaining a preset number of sample data, a six-dimensional force-action data set can be constructed. The preset number of sample data in the six-dimensional force-action data set can also be batch normalized so that the preset number of sample data can be maintained in a stable range. The features of each sample data in the preset number of sample data can also be extracted by one-dimensional convolution of a convolutional neural network, thereby obtaining one-dimensional feature data corresponding to each sample data. After obtaining all the one-dimensional feature data, the one-dimensional feature data can be fitted according to the fully connected layer and a nonlinear activation layer after each fully connected layer, and then the one-dimensional feature data is input into the self-attention mechanism to extract the global data features corresponding to each one-dimensional feature data. All global data features can also be fitted again through the fully connected layer and the nonlinear activation layer. Multiple fitting can prevent overfitting. All global data features after fitting again are labeled and classified by the softmax excitation function to obtain feature classification results corresponding to each sample data, wherein the feature classification results can be divided into positive and negative levels of different axes, as shown in Table 1:

[0087] Table 1: Feature classification results

[0088]

[0089] The different values ​​calculated by the softmax excitation function represent the six-dimensional force labels, for example, 1 represents X+, 3 represents Y+, and so on.

[0090] It should be noted that the label classification is a six-dimensional force label. The preset mapping discrimination model is trained according to the force, torque and feature classification results corresponding to each sample data to obtain a mapping discrimination model with input as force and torque and output as the feature classification result of the six-dimensional force label.

[0091] The preset mapping discrimination model in the shaft-hole assembly process can be learned and trained through convolutional neural networks and self-attention mechanisms to obtain a six-dimensional force-action mapping discrimination model.

[0092] In a specific embodiment of the present invention, after obtaining the six-dimensional force-action mapping discrimination model, the model can be called in the subsequent assembly stage to predict the action in the new contact state. For example, the first current position data of the end of the robotic arm can be input into the six-dimensional force-action mapping discrimination model. The six-dimensional force-action mapping discrimination model can output the feature classification result corresponding to the first current position data.

[0093] Among them, in the process of sampling six-dimensional force data, when sampling according to a certain position rule, the force in each direction will show a certain change rule. Since the force information is strongly correlated with the sampling position, the introduction of the self-attention mechanism allows the six-dimensional force-action mapping discriminant model to pay attention to the correlation between the different dimensions of the input vectors under the entire six-dimensional force-action dataset, extract the characteristics and change rules of the entire six-dimensional force-action dataset, and improve the convergence speed and accuracy of training. The self-attention mechanism can be calculated based on the feature classification results corresponding to the first current position data output by the six-dimensional force-action mapping discriminant model. The self-attention mechanism is the core of the Transformer model. Each input is multiplied by the learnable transformation matrix to obtain the vectors Q (query), K (key), and V (value). The dimensions of vectors Q and K are d K , the dimension of v is d V , the final self-attention output can be calculated according to formula (1) and formula (2), which are as follows:

[0094]

[0095]

[0096] Where, e is a natural constant, express xi Refers to an input vector, c is the subscript, there are C input vectors in total, T represents the matrix transpose; among them, e is generally 2.7828.

[0097] In some embodiments of the present invention, step S103 includes:

[0098] Perform deviation classification on a preset number of sample data to obtain sample data in a large deviation domain and sample data in a small deviation domain;

[0099] Comparing the first current position data with the sample data of the large deviation domain and the sample data of the small deviation domain to determine the category to which the first current position data belongs;

[0100] All sample data in the category are calculated according to the nearest neighbor algorithm to obtain the nearest sample point.

[0101] It should be noted that: the deviation classification can be performed based on the deviation between each sample data in the six-dimensional force-action data set and the hole center position, and the sample data belonging to the large deviation domain and the sample data belonging to the small deviation domain can be obtained. In order to determine the corresponding appropriate operation according to the current position of the first current position data, the first current position data can be compared with the sample data of the large deviation domain and the sample data of the small deviation domain to determine the category to which the first current position data belongs. Thus, the weighted Euclidean distance of the six-dimensional force between all the sample data in the category to which the first current position data belongs can be calculated by the nearest neighbor algorithm (KNN). For example, when the category belongs to the sample data of the large deviation domain, all the sample data in the sample data of the large deviation domain are calculated pairwise to obtain the weighted Euclidean distance of the six-dimensional force between the two pairs, so that the nearest sample point of the first current position data can be obtained. The calculation of the weighted Euclidean distance is shown in formula (3):

[0102]

[0103] Where w i represents the weight, x i 、y i Represents the force data of one dimension of the two six-dimensional forces. The weight can be set according to the actual situation, and the present invention is not limited thereto.

[0104] In a specific embodiment of the present invention, Figure 5 As shown, the large circle is the large deviation domain, the small circle is the small deviation domain, the most similar sample point is the closest sample point, the instance point is the point of the first current position data, the solid line represents the current trajectory of the first current position number, and the dotted line represents the preset position trajectory.

[0105] It should be noted that the force and torque of the first current position data are input into the mapping discrimination model, and the mapping discrimination model can output the stepping direction of the first current position data corresponding to the nearest sample point.

[0106] In the mapping discriminant model, the label determines the next movement direction, and the set step value determines the movement length of each action. If the step value is set larger, the assembly time can be reduced, but the assembly accuracy is difficult to ensure; if it is set smaller, higher assembly accuracy can be guaranteed, but the assembly time is longer. Therefore, in order to determine different step values ​​according to different positions, in some embodiments of the present invention, step S104 includes:

[0107] When the category belongs to the sample data of the large deviation domain, the hole center position is calculated according to the nearest sample point to obtain the step value;

[0108] Control the end of the robotic arm according to the step value and step direction;

[0109] When the category belongs to the sample data of the small deviation domain, the end of the robot arm is controlled according to the preset fixed step value and step direction.

[0110] It should be noted that the axis deviation range can be determined before each movement is executed. If the axis is in the large deviation range, variable step size adjustment is performed; otherwise, fixed step size adjustment is used.

[0111] In a specific embodiment of the present invention, when the category of the sample data is a large deviation domain, it means that the deviation of the first current position data from the center position of the hole is large, and the center position of the hole needs to be calculated based on the nearest sample point to obtain the step value, so that the end of the robot arm can be controlled according to the step value pair and the step direction; when the category of the sample data is a small deviation domain, it means that the deviation of the first current position data from the center position of the hole is small, and at this time, the end of the robot arm only needs to be controlled according to the step direction and the pre-set fixed step value.

[0112] In some embodiments of the present invention, after controlling the end of the robotic arm according to the step value and the step direction, the method further includes:

[0113] Obtaining the second current position data of the end of the robotic arm;

[0114] The first current location data replaces the second current location data, and step S103 is executed.

[0115] In a specific embodiment of the present invention, after the end of the robotic arm completes a step according to the step value and step direction, the second current position data after the step of the robotic arm can be obtained. The second current position data can then be determined as the first current position data, the nearest sample point is re-determined according to the nearest neighbor algorithm, the step direction is determined according to the mapping discriminant model, and the subsequent steps are looped until the small deviation domain is entered. In an ideal state, the small deviation domain can generally be entered after two variable step size adjustments.

[0116] In some embodiments of the present invention, after the fixed step value and step direction are preset to control the end of the robotic arm, the method further includes:

[0117] Obtaining the third current position data of the end of the robotic arm;

[0118] Determining whether the position of the end of the robotic arm is the center position of the hole according to the third current position data;

[0119] If not, the third current position data is processed according to the mapping discrimination model to obtain the target stepping direction;

[0120] The end of the robotic arm is controlled according to the preset fixed step value and the target step direction, and the step of "obtaining the third current position data of the end of the robotic arm" is performed.

[0121] In a specific embodiment of the present invention, when the end of the robotic arm completes a stepping operation within a small deviation domain, the third current position data of the end of the robotic arm can be obtained to determine whether the third current position data after the end of the robotic arm steps is the center position of the hole. If not, it means that the end of the robotic arm still needs to be controlled. At this time, the third current position data can be processed by the mapping discrimination model to obtain the target stepping direction, and the end of the robotic arm can be controlled again by the preset fixed step value and target stepping direction. The above steps are repeated until the third current position data of the end of the robotic arm is the center position of the hole.

[0122] In some embodiments of the present invention, the method further comprises:

[0123] When the end of the robotic arm detects an obstacle, the obstacle force exerted on the end of the robotic arm is obtained;

[0124] determining an additional position based on the preset position trajectory and the first current position data;

[0125] Determine the deviation value of the end of the robotic arm based on the force of the obstacle and the preset expected force of the end of the robotic arm;

[0126] The preset position trajectory is corrected according to the deviation value and the additional position, so that the end of the robot arm operates according to the corrected position trajectory.

[0127] In a specific embodiment of the present invention, an impedance controller is also provided in the shaft-hole assembly. The impedance controller can detect whether the end of the robot arm contacts an obstacle. Impedance control can establish a dynamic relationship between the end of the robot arm and the working environment. The present invention can adopt a strategy based on the inner loop of position control and the outer loop of force control. When the end of the robot arm detects an obstacle (when the impedance control detects the contact force between the robot arm and the outside world), the obstacle force detected by the impedance control is obtained, and an additional position is generated through a second-order admittance model. The additional position can be used to correct the preset position trajectory, and finally the end of the robot arm is sent to the inner loop of position control to complete the final position control. Among them, the function of the relationship between the force of the external environment acting on the robot arm and the position of the end of the robot arm is shown in formula (4):

[0128]

[0129] Where M, B, and K are the desired impedance parameters, K is the target stiffness matrix, B is the target damping matrix, and M is the target inertia matrix; F ext F is the obstacle force exerted on the robot arm by the external environment, d X is the force that the robot arm expects to receive from the external environment; d is the desired position of the robot arm (the corresponding position on the preset position trajectory), and X is the actual position of the robot arm (the current position on the current trajectory).

[0130] When only considering the impedance model in one-dimensional space, the one-dimensional additional position force can be calculated according to formula (4), and the position deviation e=xx d , the difference between the actual force and the expected force at the end of the robot arm is e f =f ext -f e , perform Laplace transformation on formula (4), and the transfer function of the impedance-controlled second-order system is shown in formula (5):

[0131]

[0132] Therefore, the preset position trajectory can be corrected according to the results calculated by formula (5) and formula (4), and the process of the present invention can be repeated according to the corrected position trajectory.

[0133] In the embodiment of the present invention, when the manipulator is in free motion, the environmental contact force and the desired force are both zero, and the manipulator only performs position tracking control. When the manipulator is in contact motion, the sensor detects the external force F ext Get and expect force F dDeviation value. As can be seen from formula (5), the force tracking deviation is used to obtain the position correction in the outer loop of impedance control to correct the motion position of the robot arm. Then, the position tracking control is performed through the inner loop of the system's position control, ultimately satisfying the desired dynamic relationship between the force and position of the robot arm. By setting the damping force, when the force in a certain direction exceeds the damping force, the robot arm is allowed to move at the maximum speed in this direction, reducing the damage to components and posture disturbances that may be caused during the assembly process.

[0134] It should be noted that the robotic arm is set with a preset depth. After starting the robotic arm, the robotic arm can be controlled according to the axis hole task to be executed, so that the robotic arm moves to the initial position within a certain deviation range. Then, the robotic arm can be controlled by the impedance controller to move in the Z-axis direction. When the force in the Z-axis direction exceeds the set threshold F Z0 When , the robot stops moving. Then the current position data is input into the trained mapping discriminant model to predict the next step direction, and then the deviation between the nearest sample point of the current position and the hole center position is calculated to determine the deviation range and the size of the step value. Figure 6 As shown in the figure, the steps for adjusting the end of the robot arm by step value and step direction are as follows: first adjust the horizontal rotation deviation R x 、R y , then adjust the horizontal position deviation X, Y, and gradually increase the insertion preset depth h, and repeat this process until the insertion preset depth h meets the requirements, and the assembly process is completed.

[0135] In order to better implement the shaft hole assembly method based on the nearest neighbor algorithm in the embodiment of the present invention, on the basis of the shaft hole assembly method based on the nearest neighbor algorithm, the embodiment of the present invention also provides a shaft hole assembly device based on the nearest neighbor algorithm, such as Figure 6 As shown, the shaft-hole assembly device based on the nearest neighbor algorithm includes:

[0136] The data acquisition module 601 is used to determine the hole center position according to the axis-hole task to be executed, obtain the first current position data of the end of the robot arm, and a preset number of sample data centered on the hole center position;

[0137] The model building module 602 is used to extract and classify features of a preset number of sample data, obtain the feature classification results corresponding to each sample data, and build a mapping discriminant model based on all the feature classification results;

[0138] The sample determination module 603 is used to process the first current position data according to the nearest neighbor algorithm and the mapping discrimination model to obtain the nearest sample point and the step direction of the nearest sample point;

[0139] The task execution module 604 is used to control the end of the robot arm according to the preset position trajectory, the nearest sample point and the stepping direction. When the end of the robot arm is adjusted to the center position of the hole, it operates according to the preset depth to complete the axis hole task to be executed.

[0140] The shaft hole assembly device based on the nearest neighbor algorithm provided in the above embodiment can realize the technical solution described in the above embodiment of the shaft hole assembly method based on the nearest neighbor algorithm. The specific implementation principles of the above modules or units can be found in the corresponding contents in the above embodiment of the shaft hole assembly method based on the nearest neighbor algorithm, and will not be repeated here.

[0141] like Figure 7 As shown, the present invention also provides an electronic device 700. The electronic device 700 includes a processor 701, a memory 702 and a display 703. Figure 7 Only some of the components of the electronic device 700 are shown, but it should be understood that it is not required to implement all of the shown components, and more or fewer components may be implemented instead.

[0142] In some embodiments, the memory 702 may be an internal storage unit of the electronic device 700, such as a hard disk or memory of the electronic device 700. In other embodiments, the memory 702 may also be an external storage device of the electronic device 700, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 700.

[0143] Furthermore, the memory 702 may include both an internal storage unit of the electronic device 700 and an external storage device. The memory 702 is used to store application software installed in the electronic device 700 and various data.

[0144] In some embodiments, the processor 701 can be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or process data stored in the memory 702, such as the shaft-hole assembly method based on the nearest neighbor algorithm in the present invention.

[0145] In some embodiments, the display 703 can be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 703 is used to display information on the electronic device 700 and to display a visual user interface. Components 701-703 of the electronic device 700 communicate with each other via a system bus.

[0146] In some embodiments of the present invention, when the processor 701 executes the shaft-hole assembly program based on the nearest neighbor algorithm in the memory 702, the following steps may be implemented:

[0147] Determine the hole center position according to the axis-hole task to be executed, obtain the first current position data of the end of the robot arm, and a preset number of sample data centered on the hole center position;

[0148] Perform feature extraction and feature classification on a preset number of sample data to obtain the feature classification results corresponding to each sample data, and build a mapping discriminant model based on all feature classification results;

[0149] Calculating the first current position data and a preset number of sample data according to a nearest neighbor algorithm to obtain a nearest sample point; and processing the first current position data according to a mapping discriminant model to obtain a step direction of the nearest sample point;

[0150] The end of the robotic arm is controlled according to the preset position trajectory, the nearest sample point and the stepping direction. When the end of the robotic arm is adjusted to the center of the hole, it operates according to the preset depth to complete the axis hole task to be executed.

[0151] It should be understood that, when the processor 701 executes the shaft-hole assembly program based on the nearest neighbor algorithm in the memory 702 , in addition to the above functions, it can also implement other functions. For details, please refer to the description of the corresponding method embodiment above.

[0152] Furthermore, the embodiment of the present invention does not specifically limit the type of the electronic device 700 mentioned. The electronic device 700 may be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, or a laptop computer. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with iOS, Android, Microsoft, or other operating systems. The above-mentioned portable electronic devices may also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, the electronic device 700 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0153] Accordingly, an embodiment of the present application also provides a computer-readable storage medium, which is used to store computer-readable programs or instructions. When the program or instructions are executed by a processor, the shaft hole assembly method steps or functions based on the nearest neighbor algorithm provided in the above-mentioned method embodiments can be implemented.

[0154] Those skilled in the art will appreciate that all or part of the process steps of the above-described embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a magnetic disk, an optical disk, a read-only memory, or a random access memory.

[0155] The above is a detailed introduction to the shaft hole assembly method and device based on the nearest neighbor algorithm provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A shaft-hole assembly method based on the nearest neighbor algorithm, characterized in that: include: Determine the hole center position according to the axis-hole task to be executed, obtain first current position data of the end of the robot arm, and a preset number of sample data centered on the hole center position; Performing feature extraction and feature classification on the preset number of sample data to obtain a feature classification result corresponding to each sample data, and constructing a mapping discriminant model based on all the feature classification results; the input of the mapping discriminant model is force and torque, and the output is the feature classification result of the six-dimensional force label; Calculating the first current position data and the preset number of sample data according to a nearest neighbor algorithm to obtain the nearest sample point; and processing the first current position data according to the mapping discrimination model to obtain the stepping direction of the closest sample point; The end of the robotic arm is controlled according to the preset position trajectory, the nearest sample point and the stepping direction, and when the end of the robotic arm is adjusted to the center position of the hole, the operation is performed according to the preset depth to complete the axis hole task to be executed; The step of determining the hole center position according to the shaft hole task to be executed and obtaining a preset number of sample data centered on the hole center position includes: Determining a preset number of sample positions around the center position of the hole in a preset order according to a preset shaft-hole gap and a preset sampling interval; Determine the action direction label corresponding to each sample position according to the preset number of sample positions and the hole center position; the action direction label is used to indicate the direction of the next action of each sample position; Obtaining a preset number of sample data for the preset number of sample positions according to the motion direction label corresponding to each sample position; The obtaining of a preset number of sample data of the preset number of sample positions according to the motion direction label corresponding to each sample position includes: When determining the preset number of sample positions according to the preset sequence, obtaining the force and torque required for each sample position to proceed to the next step; Obtaining a preset number of sample data for the preset number of sample positions according to the force, the torque, and the motion direction label corresponding to each sample position in the preset number of sample positions; The calculating the first current position data and the preset number of sample data according to the nearest neighbor algorithm to obtain the nearest sample point includes: Performing deviation classification on the preset number of sample data to obtain sample data in a large deviation domain and sample data in a small deviation domain; Comparing the first current position data with the sample data of the large deviation domain and the sample data of the small deviation domain to determine the category to which the first current position data belongs; Calculate all sample data in the category according to the nearest neighbor algorithm to obtain the nearest sample point; The controlling of the end of the robotic arm according to the preset position trajectory, the nearest sample point and the stepping direction includes: When the category belongs to the sample data of the large deviation domain, the center position of the hole is calculated according to the nearest sample point to obtain a step value; Controlling the end of the robotic arm according to the step value and the step direction; When the category is sample data of the small deviation domain, the end of the robotic arm is controlled according to a preset fixed step value and the step direction.

2. The shaft-hole assembly method based on the nearest neighbor algorithm according to claim 1, characterized in that: The method further comprises: When the end of the robotic arm detects an obstacle, obtaining the obstacle force exerted on the end of the robotic arm by the obstacle; determining an additional position based on the preset position trajectory and the first current position data; Determining a deviation value of the end of the robotic arm based on the obstacle force and a preset desired force at the end of the robotic arm; The preset position trajectory is corrected according to the deviation value and the additional position, so that the end of the robotic arm operates according to the corrected position trajectory.

3. The shaft-hole assembly method based on the nearest neighbor algorithm according to claim 1, characterized in that: The feature extraction and feature classification of the preset number of sample data are performed to obtain a feature classification result corresponding to each sample data, including: Determining the movement direction corresponding to each sample data according to the movement direction label, thereby constructing a six-dimensional force-motion dataset; Performing one-dimensional feature extraction on all sample data in the six-dimensional force-motion data set to obtain one-dimensional feature data corresponding to each sample data; Performing global feature extraction on all one-dimensional feature data according to the self-attention mechanism to obtain the global data features corresponding to each sample data; All global data features are labeled and classified according to the preset activation function to obtain the feature classification results corresponding to each sample data.

4. The shaft-hole assembly method based on the nearest neighbor algorithm according to claim 1, characterized in that: After controlling the end of the robotic arm according to the step value and the step direction, the method further includes: Acquiring second current position data of the end of the robotic arm; The first current position data is replaced by the second current position data, and the steps of "calculating the first current position data and the preset number of sample data according to the nearest neighbor algorithm to obtain the nearest sample point; and processing the first current position data according to the mapping discrimination model to obtain the stepping direction of the nearest sample point" are performed.

5. The shaft-hole assembly method based on the nearest neighbor algorithm according to claim 1, characterized in that: After controlling the end of the robotic arm according to the preset fixed step value and the step direction, the method further includes: Acquiring third current position data of the end of the robotic arm; determining, based on the third current position data, whether the position of the end of the robotic arm is the center position of the hole; If not, processing the third current position data according to the mapping discrimination model to obtain a target stepping direction; The end of the robotic arm is controlled according to the preset fixed step value and the target step direction, and the step of "obtaining third current position data of the end of the robotic arm" is performed.

6. A shaft hole assembly device based on the nearest neighbor algorithm, characterized in that: include: a data acquisition module, configured to determine the hole center position according to the shaft-hole task to be executed, obtain first current position data of the end of the robotic arm, and a preset number of sample data centered on the hole center position; A model building module is used to extract and classify features of the preset number of sample data, obtain feature classification results corresponding to each sample data, and build a mapping discriminant model based on all feature classification results; the input of the mapping discriminant model is force and torque, and the output is the feature classification result of the six-dimensional force label; a sample determination module, configured to calculate the first current position data and the preset number of sample data according to a nearest neighbor algorithm to obtain a nearest sample point; and to process the first current position data according to the mapping discriminant model to obtain a stepping direction of the nearest sample point; A task execution module is used to control the end of the robotic arm according to a preset position trajectory, the nearest sample point and the stepping direction, and when the end of the robotic arm is adjusted to the center position of the hole, it operates according to a preset depth to complete the shaft hole task to be executed; The step of determining the hole center position according to the shaft hole task to be executed and obtaining a preset number of sample data centered on the hole center position includes: Determining a preset number of sample positions around the center position of the hole in a preset order according to a preset shaft-hole gap and a preset sampling interval; Determine the action direction label corresponding to each sample position according to the preset number of sample positions and the hole center position; the action direction label is used to indicate the direction of the next action of each sample position; Obtaining a preset number of sample data for the preset number of sample positions according to the motion direction label corresponding to each sample position; The obtaining of a preset number of sample data of the preset number of sample positions according to the motion direction label corresponding to each sample position includes: When determining the preset number of sample positions according to the preset sequence, obtaining the force and torque required for each sample position to proceed to the next step; Obtaining a preset number of sample data for the preset number of sample positions according to the force, the torque, and the motion direction label corresponding to each sample position in the preset number of sample positions; The calculating the first current position data and the preset number of sample data according to the nearest neighbor algorithm to obtain the nearest sample point includes: Performing deviation classification on the preset number of sample data to obtain sample data in a large deviation domain and sample data in a small deviation domain; Comparing the first current position data with the sample data of the large deviation domain and the sample data of the small deviation domain to determine the category to which the first current position data belongs; Calculate all sample data in the category according to the nearest neighbor algorithm to obtain the nearest sample point; The controlling of the end of the robotic arm according to the preset position trajectory, the nearest sample point and the stepping direction includes: When the category belongs to the sample data of the large deviation domain, the center position of the hole is calculated according to the nearest sample point to obtain a step value; Controlling the end of the robotic arm according to the step value and the step direction; When the category is sample data of the small deviation domain, the end of the robotic arm is controlled according to a preset fixed step value and the step direction.

Citation Information

Patent Citations

  • Method and system for alignment and insertion of wire contact with wire contact insertion holes of a connector

    CN112350114A

  • Flexible shaft hole assembling method based on contact state model and self-adaptive impedance control

    CN116175148A