A High-Precision Axle Part Positioning Method for Axle-Hole Assembly Based on Machine Learning
The method uses machine learning to enhance cone shaft assembly precision by predicting initial positions, optimizing paths, and applying optimal forces, effectively addressing the challenges of precise force control in complex assembly processes.
Patent Information
- Application Number
- CN202510431647.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-04-08
AI Technical Summary
In the prior art, it is difficult to accurately control force information during shaft hole assembly, resulting in difficult assembly accuracy and cannot meet high-precision requirements.
Using a machine learning-based method, by acquiring the axis part images, feature extraction and key point position detection, combined with a pre-trained assembly position positioning model, the optimal assembly path and force are calculated, and the force position mixing control algorithm is used for precise assembly.
It improves the accuracy and efficiency of shaft hole assembly, realizes an intelligent and adaptive assembly process, and reduces assembly errors.
Smart Images

Figure CN119952729B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automated assembly, and particularly to a positioning method for shaft parts in high-precision shaft-hole assembly based on machine learning. Background Art
[0002] In the development of modern industry, hole-shaft assembly components are core components in the industrial field, mainly applied in fields such as aerospace, mechanical manufacturing, and vehicle manufacturing. With the continuous improvement of the assembly level and assembly accuracy of equipment and industrial products in fields such as aerospace, ships, and automobiles, higher requirements are put forward for the assembly equipment of large and complex hole-shaft products. During the hole-shaft assembly process, due to the complex structure of the parts to be assembled and the deviation of the attitude and pose, the assembly points and assembly paths deviate from the optimal solutions.
[0003] In an existing technology, the shaft-hole assembly method mainly includes: controlling the robot for alignment and assembly through sensors. For example, a rapid clamping method for a robot box based on reinforcement learning, which realizes the state representation of the robot box clamping process through the definition of the state space and action space, constructs a state evaluator to evaluate the position information of the box workpiece, and iteratively optimizes the control strategy of the robot end effector to achieve assembly.
[0004] However, the force information during the shaft-hole assembly process is a necessary parameter to ensure the assembly accuracy. In the existing technology, only the alignment and assembly of the manipulator or robot are targeted, and it is difficult to accurately control the force information during the assembly process, resulting in difficult control of the hole-shaft assembly accuracy and difficulty in meeting the accuracy requirements. Summary of the Invention
[0005] The present invention provides a positioning method, device, electronic device, and storage medium for shaft parts in high-precision shaft-hole assembly based on machine learning to improve the accuracy of shaft parts in shaft-hole assembly.
[0006] In a first aspect, to solve the above technical problems, the present invention provides a positioning method for shaft parts in high-precision shaft-hole assembly based on machine learning, including:
[0007] Obtain an image of the shaft part;
[0008] Extract features from the image of the shaft part to obtain the positions of key points;
[0009] Input the positions of the key points into a pre-trained assembly position positioning model, and output the initial assembly position;
[0010] Perform path planning according to the initial assembly position to obtain the optimal assembly path;
[0011] According to the optimal assembly path, combined with the force-position hybrid control algorithm, calculate the optimal assembly position and the optimal assembly force;
[0012] Install the shaft part according to the optimal assembly path, the optimal assembly position and the optimal assembly force.
[0013] In an alternative embodiment, the feature extraction of the shaft part image to obtain the key point positions includes:
[0014] Preprocess the shaft part image to obtain a grayscale shaft part image;
[0015] Perform edge detection based on the grayscale shaft part image to obtain a shaft part contour image;
[0016] Perform shaft point detection based on the shaft part contour image to obtain the key point positions;
[0017] The key point positions include the shaft center position, the center of the circular hole at the shaft end, the center contact point, and the center point of the contact surface.
[0018] In an alternative embodiment, the training process of the assembly position positioning model includes:
[0019] Construct an assembly position positioning model based on historical key point positions and historical assembly positions, train the model, and determine that the training is completed after the loss function of the model meets the conditions to obtain a trained assembly position positioning model;
[0020] Input the key point positions into the trained assembly position positioning model to obtain an initial assembly position.
[0021] In an alternative embodiment, the path planning based on the initial assembly position to obtain the optimal assembly path includes:
[0022] Randomly generate an initial search path according to the initial assembly position;
[0023] Calculate the energy function according to the initial search path through the following formula:
[0024]
[0025] Where, is the energy function, is the initial energy value of the search path planning, is the iteration coefficient, is the n search path length obtained in the total search path length, n is the number of iterations;
[0026] Iteratively search for the path through the gradient descent method formula:
[0027]
[0028] Among them, is the search path for the th iteration, is the search path for the th iteration, is the learning rate, is the gradient of the energy function;
[0029] When the energy function reaches the minimum value, the corresponding search path is used as the optimal assembly path.
[0030] In an alternative implementation, calculating the optimal assembly position and the optimal assembly force according to the optimal assembly path and combining the force-position hybrid control algorithm includes:
[0031] Calculating the expected assembly force through the following formula:
[0032]
[0033] Among them, is the expected assembly force on the coordinate, is the distance between the axis of the initial position point of the workpiece and the axis of the position to be assembled, is the planned assembly force, is the path planning parameter corresponding to the optimal assembly path, is the initial assembly position;
[0034] Obtaining the assembly movement time and the assembly movement speed;
[0035] Calculating the optimal assembly position according to the following formula:
[0036]
[0037] Among them, is the optimal assembly position, is the assembly movement speed, is the assembly movement time, is the expected assembly force on the coordinate, is the workpiece mass, is the initial assembly position,
[0038] Calculating the optimal assembly force through the following formula:
[0039]
[0040] Among them, is the optimal assembly force, is the position control gain, is the force control gain, is the optimal assembly position, is the initial assembly position, is the expected assembly force on the coordinate, is the planned assembly force.
[0041] In an alternative embodiment, the installation of the shaft part according to the optimal assembly path, the optimal assembly position, and the optimal assembly force includes:
[0042] Install the shaft part for each of the optimal assembly positions in the order of the optimal assembly path of the workpiece using the optimal assembly force.
[0043] In an alternative embodiment, after inputting the key point position into the pre-trained assembly position positioning model and outputting the initial assembly position, it further includes:
[0044] Calculate the position deviation based on the initial assembly position and the pre-obtained planned assembly position;
[0045] When the position deviation is greater than a preset position threshold, replace the initial assembly position with the planned assembly position;
[0046] When the position deviation is less than the position threshold, continue with the subsequent steps.
[0047] In a second aspect, the present invention provides a high-precision shaft-hole assembly shaft part positioning device based on machine learning, including:
[0048] A data acquisition module for acquiring shaft part images;
[0049] A feature extraction module for extracting features from the shaft part image to obtain key point positions;
[0050] An initial positioning module for inputting the key point positions into a pre-trained assembly position positioning model and outputting the initial assembly position;
[0051] A path optimization module for performing path planning based on the initial assembly position to obtain an optimal assembly path;
[0052] A force-position optimization module for calculating the optimal assembly position and the optimal assembly force based on the optimal assembly path in combination with a force-position hybrid control algorithm;
[0053] A workpiece installation module for installing a shaft part according to the optimal assembly path, the optimal assembly position, and the optimal assembly force.
[0054] In a third aspect, the present invention further provides an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a method for positioning a shaft part in high-precision shaft-hole assembly based on machine learning as described in any one of the above.
[0055] In a fourth aspect, the present invention further provides a computer-readable storage medium. The computer-readable storage medium includes a stored computer program. When the computer program runs, it controls the device where the computer-readable storage medium is located to execute a method for positioning a shaft part in high-precision shaft-hole assembly based on machine learning as described in any one of the above.
[0056] Compared with the prior art, the present invention has the following beneficial effects: The present invention discloses a method for positioning a shaft part in high-precision shaft-hole assembly based on machine learning. The method includes obtaining an image of the shaft part; extracting features from the image of the shaft part to obtain the positions of key points; inputting the positions of the key points into a pre-trained assembly position positioning model to output an initial assembly position; performing path planning based on the initial assembly position to obtain an optimal assembly path; calculating an optimal assembly position and an optimal assembly force according to the optimal assembly path in combination with a force-position hybrid control algorithm; and installing the shaft part according to the optimal assembly path, the optimal assembly position, and the optimal assembly force. This method can improve the assembly accuracy of shaft-hole components.
[0057] Specifically, this method introduces an innovative path planning algorithm to determine the optimal assembly path. This method first randomly generates an initial search path based on the initial assembly position, which provides a starting point for subsequent iterative optimization. Then, the quality of the search path after each iteration is evaluated through a defined energy function. The design of the energy function combines factors such as the initial energy value, iteration coefficient, the lengths of the search paths obtained in each iteration, and the total length of the search path, quantifying the quality of the path in the form of a mathematical formula. The energy function reflects the sensitivity to changes in path length: when the path length approaches the total length of the search path, the energy function value tends to decrease, indicating that the path is closer to the ideal state; conversely, if the path deviates from the ideal state, the energy function value increases. Such a design enables the algorithm to effectively distinguish paths of different qualities and guide the search towards a better direction. Next, the gradient descent method is used for iterative optimization, adjusting the search path according to the update rule, where the learning rate determines the step size of each adjustment, and the gradient of the energy function with respect to the path indicates the direction in which the current path needs to be improved. As the number of iterations increases, the search path gradually approaches the state that minimizes the energy function, that is, the optimal assembly path is found. This method applies the optimization idea in machine learning to the field of mechanical assembly. Especially for the specific problem of shaft-hole assembly, by constructing a suitable objective function (the energy function in this method) and using an effective optimization algorithm (such as gradient descent), the purpose of automatically selecting the optimal solution from numerous possible assembly paths is achieved. Compared with the traditional method that relies on experience and manually sets parameters, this technology can provide a more accurate and efficient assembly path planning, helping to improve the assembly accuracy and efficiency and reduce assembly errors.
[0058] Furthermore, this method deepens the application of the optimal assembly path by combining a force-position hybrid control algorithm to accurately calculate the optimal assembly position and the optimal assembly force. This method first defines a calculation formula for the expected assembly force, where each parameter represents a specific physical meaning: the distance between the axis of the initial position point of the workpiece and the axis of the position to be assembled, the dimensions of the shaft-hole to be assembled, the planned assembly force, the path planning parameters corresponding to the optimal assembly path, and the initial assembly position. This formula reflects the magnitude of the assembly force required at different positions, which is adjusted with the change of the distance x, ensuring the force adaptability during the assembly process. Then, after obtaining the assembly movement time and speed, kinematic equations are used to determine the optimal assembly position. Here, the assembly movement speed and time are introduced as variables, and at the same time, the influence of the acceleration caused by the expected assembly force on the final position is considered. This step realizes the conversion from the theoretically optimal path to the specific position in actual operation, ensuring the consistency between theory and practice. Finally, in order to calculate the optimal assembly force, a formula containing position control gain and force control gain is adopted, which embodies the core idea of force-position hybrid control. The position control part adjusts the magnitude of the force by comparing the deviation between the actually reached position and the expected position; the force control part makes fine adjustments according to the difference between the current expected assembly force and the planned assembly force. Such a design enables the entire assembly process to not only accurately reach the predetermined position but also apply an appropriate force to avoid excessive impact or insufficient contact force, thereby improving the assembly quality and efficiency.
[0059] Generally speaking, this method combines the path planning results optimized by machine learning with the classical force-position hybrid control theory to achieve intelligent decision-making during the shaft-hole assembly process. It can improve the assembly accuracy of shaft-hole components. Brief Description of the Drawings
[0060] Figure 1 is a schematic flow chart of a method for positioning a shaft part in high-precision shaft-hole assembly based on machine learning provided by the first embodiment of the present invention;
[0061] Figure 2 is a schematic structural diagram of a device for positioning a shaft part in high-precision shaft-hole assembly based on machine learning provided by the second embodiment of the present invention. Detailed Embodiments
[0062] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0063] Refer to Figure 1, the first embodiment of the present invention provides a method for positioning the shaft part in high-precision shaft-hole assembly based on machine learning, including the following steps:
[0064] S11, obtain the shaft part image;
[0065] S12, perform feature extraction on the shaft part image to obtain the key point positions;
[0066] S13, input the key point positions into a pre-trained assembly position positioning model, and output the initial assembly position;
[0067] S14, perform path planning according to the initial assembly position to obtain the optimal assembly path;
[0068] S15, according to the optimal assembly path, combined with the force-position hybrid control algorithm, calculate the optimal assembly position and the optimal assembly force;
[0069] S16, complete the installation of the shaft part according to the optimal assembly path, the optimal assembly position and the optimal assembly force.
[0070] In step S11, obtain the shaft part image.
[0071] In one implementation, the shaft part image is obtained through an industrial vision system. The industrial vision system consists of multiple cameras, light sources, and software for capturing and processing images. In an industrial environment, to ensure the quality and consistency of the images, specially designed high-resolution industrial cameras are used, and fixed shooting distances and angles are set to ensure that each acquired image has the same scale and perspective. This method selects the PNG format to store the acquired shaft part images. At the same time, to simplify the image preprocessing work in the model training and inference processes, all images are adjusted to the same resolution, such as 1024x768 or a higher resolution. The present invention does not limit this.
[0072] In step S12, perform feature extraction on the shaft part image to obtain the key point positions.
[0073] In one implementation, preprocess the shaft part image to obtain a grayscale shaft part image; perform edge detection on the grayscale shaft part image to obtain a shaft part contour image; perform shaft point detection on the shaft part contour image to obtain the key point positions; where the key point positions include the shaft center position, the center of the circular hole at the shaft end, the center contact point, and the center point of the contact surface.
[0074] It should be noted that the purpose of preprocessing is to reduce noise interference, simplify the image, and prepare for subsequent edge detection and feature extraction. The specific methods include grayscale conversion. By using the grayscale conversion formula, the brightness value of each pixel is calculated from the RGB channel values of each pixel of the color axis part image. Grayscale conversion is an existing method and will not be elaborated in detail in this method. Then, a low-pass filter is used to smooth the image and reduce random fluctuations caused by sensor noise or ambient light changes. Finally, histogram equalization is used to improve the contrast of the grayscale image, obtaining the grayscale axis part image.
[0075] In one implementation, the Canny Edge Detection algorithm is used for edge detection. The purpose of edge detection is to extract the contour of the object in the image. In this method, the contour of the axis part is to be extracted. The specific method includes: First, apply a Gaussian filter to smooth the image. Then, calculate the image gradient magnitude and direction. Next, through non-maximum suppression, only the maximum response points along the edge direction are retained. Finally, use the double thresholding method combined with hysteresis tracking to determine the final edge.
[0076] In one implementation, the purpose of shaft point detection is to locate the key geometric points of the shaft part, such as the shaft center, the center of the round hole, etc. The core idea of the Hough transform is to map each pixel point in the image space to a parameter space. In this new space, pixel points from the same shape will form a peak, so the existence and position of the shape can be determined by detecting these peaks. When applied to circular detection, the Hough transform maps each point in the image space to a three-dimensional parameter space, and then the accumulator counts in the parameter space to find the peak, thereby determining the center and radius of the circle. The specific method for positioning using the Hough transform includes: creating a three-dimensional accumulation array to record all possible center positions of the circle and their corresponding radius values; for each edge point in the image, consider all possible circles passing through this point. For each such circle, increment the accumulator corresponding to its parameters by one; in the parameter space, the accumulated votes form peaks, and the position of the peak corresponds to the parameters of the circle existing in the image. When the accumulated votes at a position exceed the threshold, a circle is considered to be found, and the thresholds of different key geometric points are obtained based on historical data.
[0077] In step S13, the key point positions are input into a pre-trained assembly position positioning model, and the initial assembly position is output.
[0078] It should be noted that an assembly position positioning model is constructed based on historical key point positions and historical assembly positions, the model is trained, and after the loss function of the model meets the conditions, it is determined that the training is completed, and the trained assembly position positioning model is obtained; the key point positions are input into the trained assembly position positioning model to obtain the initial assembly position.
[0079] In one implementation, the assembly position positioning model is trained based on a BP neural network. The input layer receives the preprocessed key point coordinates. First, all the weights and biases in the network are randomly initialized; the loss function is defined as the mean squared error; Adam is set as the optimizer; the entire historical key point coordinate dataset is divided into a training set, a validation set, and a test set, with a ratio of 7:1:2, and this method does not limit this. Then, the training data is fed in batches, and the loss value for the current batch is calculated. Then, the network parameters are updated using the backpropagation mechanism to reduce the loss value. The assembly position positioning model can predict the initial assembly position by inputting the key point positions.
[0080] In one implementation, after the key point positions are input into the pre-trained assembly position positioning model and the initial assembly position is output, it further includes: calculating the distance based on the initial assembly position and the pre-obtained planned assembly position to obtain a position deviation; when the position deviation is greater than a preset position threshold, replacing the initial assembly position with the planned assembly position; when the position deviation is less than the position threshold, continuing with the subsequent steps.
[0081] It should be noted that once the initial assembly position is obtained through the assembly position positioning model, it needs to be compared with the pre-determined planned assembly position. The planned assembly position refers to the ideal assembly position defined based on design drawings or other specification documents, which represents the desired target state.
[0082] In step S14, an optimal assembly path is obtained according to the initial assembly position.
[0083] In one implementation, an initial search path is randomly generated according to the initial assembly position;
[0084] The energy function is calculated according to the initial search path through the following formula:
[0085]
[0086] where, is the energy function, is the initial energy value of the search path planning, is the iteration coefficient, is the n search path length obtained in the The total length of the search path n is the number of iterations;
[0087] Iteratively search for the path through the gradient descent formula:
[0088]
[0089] where is the search path for the th iteration, is the search path for the th iteration, is the learning rate, is the gradient of the energy function;
[0090] When the energy function reaches the minimum value, the corresponding search path is taken as the optimal assembly path.
[0091] It should be noted that the design purpose of this energy function is such that as the path length decreases, the energy value will gradually decrease until it reaches the minimum value. When the path becomes shorter, the corresponding energy will also become smaller, thus guiding the algorithm to converge to a better solution. The gradient descent method is used to iteratively update the search path. The core idea of gradient descent is to adjust the parameters in the opposite direction of the gradient of the energy function, thereby gradually reducing the energy value. For the path optimization problem, the "parameters" here are the position coordinates of each point on the path. The initial energy value of the search path planning is a preset value, and the magnitude of the value has no impact on subsequent calculations. The iteration coefficient and the number of iterations define the maximum number of loops for the optimization algorithm to run and the current loop iteration. The learning rate controls the magnitude of each step adjustment in the gradient descent method. A smaller learning rate means a more refined but slower improvement, while a larger learning rate speeds up the convergence but is also prone to missing the optimal solution. The gradient of the energy function is calculated by a computing tool.
[0092] In step S15, according to the optimal assembly path, combined with the force-position hybrid control algorithm, the optimal assembly position and the optimal assembly force are calculated.
[0093] In one implementation, the expected assembly force is calculated by the following formula:
[0094]
[0095] where is the expected assembly force on the coordinate, is the distance between the axis of the initial position point of the workpiece and the axis of the position to be assembled, is the size of the shaft hole to be assembled, is the planned assembly force, is the path planning parameter corresponding to the optimal assembly path, is the initial assembly position;
[0096] Obtain the assembly motion time and the assembly motion speed;
[0097] Calculate the optimal assembly position according to the following formula:
[0098]
[0099] where, is the optimal assembly position, is the assembly motion speed, is the assembly motion time, is the expected assembly force on the is the workpiece mass, is the initial assembly position, is the assembly motion acceleration;
[0100] Calculate the optimal assembly force through the following formula:
[0101]
[0102] where, is the optimal assembly force, is the position control gain, is the force control gain, is the optimal assembly position, is the initial assembly position, is the expected assembly force on the is the planned assembly force.
[0103] It should be noted that the dimensions of the shaft hole to be assembled reflect the tightness of the fit between the assembled parts. The path planning parameter corresponding to the optimal assembly path can be understood as a coefficient related to the path shape, used to adjust the force distribution, and obtained by calculating the path curvature. The distance between the axis of the initial position point of the workpiece and the axis of the position point to be assembled is accurately measured using a laser tracker. The dimensions of the shaft hole to be assembled are directly provided by the design drawing. The position control gain is used to adjust the influence intensity of the position error on the output force. The force control gain is used to adjust the difference between the actual assembly force and the planned assembly force. The workpiece mass is obtained through a weighing device.
[0104] In step S16, install the shaft part according to the optimal assembly path, the optimal assembly position, and the optimal assembly force.
[0105] In one implementation, along the order of the optimal assembly path of the workpiece, for each optimal assembly position, use the optimal assembly force to complete the installation of the shaft part.
[0106] It should be noted that, first of all, the workpiece needs to be gradually moved to the specified position along the optimal assembly path. This can minimize the energy consumption during the assembly process and avoid potential obstacles. For shaft parts, this path should ensure that the parts can smoothly enter the predetermined position without unnecessary friction or collision. When the workpiece moves along the optimal assembly path, it will reach the so-called "optimal assembly position" at specific time points. These positions are key nodes determined during the path planning stage, representing the important stopping points of the workpiece throughout the assembly process. At each such position, a specific assembly operation needs to be performed - that is, using appropriate tools and techniques to fix the shaft part in place. To ensure that the shaft part is installed correctly, a proper force of appropriate magnitude and correct direction must be applied, which is the so-called "optimal assembly force".
[0107] In summary, the present invention discloses a positioning method for shaft parts in high-precision shaft-hole assembly based on machine learning, aiming to solve the assembly problems of complex hole-shaft products in modern industry. The present invention proposes a solution combining machine learning algorithms. Specifically, this method first obtains the shaft part image through an industrial vision system, preprocesses it into a grayscale image, performs edge detection to obtain contour information, and then uses techniques such as the Hough transform to extract key geometric feature points such as the shaft center position and the center of the round hole. These key points are then fed as inputs into a pre-trained assembly position positioning model, which is constructed based on historical data and can predict the initial assembly position. To ensure accuracy, after the initial assembly position is output, it is compared with the predetermined planned assembly position. If the deviation between the two exceeds the set threshold, the planned assembly position is used to replace it. After obtaining the initial assembly position, the next is the path planning stage. This method introduces a set of innovative path optimization algorithms to determine the optimal assembly path. This process starts with randomly generating an initial search path according to the initial assembly position, and then defines an energy function to evaluate the quality of the search path after each iteration. This energy function comprehensively considers factors such as the initial energy value, the iteration coefficient, and the path lengths obtained in each iteration, and quantifies the quality of the path through a mathematical formula. The gradient descent method is used to iteratively adjust the search path until the state that makes the energy function reach the minimum value is found, that is, the optimal assembly path is found. This method applies the optimization idea in machine learning to the field of mechanical assembly, especially for the specific problem of shaft-hole assembly, and realizes the purpose of automatically selecting the optimal solution from numerous possible paths. Finally, this method deepens the application of the optimal assembly path, and calculates the optimal assembly position and the optimal assembly force by combining the force-position hybrid control algorithm. Here, the calculation formula of the expected assembly force is defined, considering the influence of multiple parameters such as the distance between the axis of the initial position point of the workpiece and the axis of the position to be assembled, and the dimensions of the shaft hole to be assembled. At the same time, variables such as the assembly movement time and speed are also introduced, and the kinematic equation is used to determine the optimal assembly position. For the calculation of the optimal assembly force, a formula including the position control gain and the force control gain is adopted, reflecting the core idea of the force-position hybrid control, that is, adjusting the force magnitude according to the deviation between the actual reached position and the expected position, and making fine adjustments according to the difference between the current expected assembly force and the planned assembly force, thus ensuring the accuracy and adaptability during the assembly process.
[0108] In summary, the present invention provides a complete positioning method for shaft parts in high-precision shaft-hole assembly based on machine learning, covering all aspects from image acquisition, feature extraction, initial assembly position prediction, path optimization to final assembly implementation. It not only solves the problems of difficult control of force information and difficult guarantee of assembly accuracy existing in traditional assembly methods, but also makes the entire assembly process more intelligent and adaptive through the application of the optimal assembly path and the combination of the force-position hybrid control algorithm, improving the assembly accuracy and efficiency.
[0109] Reference Figure 2 , the second embodiment of the present invention provides a high-precision shaft-hole assembly shaft part positioning device based on machine learning, including:
[0110] A data acquisition module for acquiring shaft part images;
[0111] A feature extraction module for extracting features from the shaft part image to obtain the positions of key points;
[0112] An initial positioning module for inputting the positions of the key points into a pre-trained assembly position positioning model and outputting an initial assembly position;
[0113] A path optimization module for performing path planning based on the initial assembly position to obtain an optimal assembly path;
[0114] A force-position optimization module for calculating an optimal assembly position and an optimal assembly force according to the optimal assembly path in combination with a force-position hybrid control algorithm;
[0115] A workpiece installation module for completing the installation of the shaft part according to the optimal assembly path, the optimal assembly position, and the optimal assembly force.
[0116] Preferably, the data acquisition module is used for:
[0117] Acquiring shaft part images.
[0118] Preferably, the feature extraction module is used for:
[0119] Extracting features from the shaft part image to obtain the positions of key points, including:
[0120] Preprocessing the shaft part image to obtain a grayscale shaft part image;
[0121] Performing edge detection on the grayscale shaft part image to obtain a shaft part contour image;
[0122] Performing shaft point detection on the shaft part contour image to obtain the positions of key points;
[0123] Wherein the positions of the key points include the shaft center position, the center of the round hole at the shaft end, the center contact point, and the center point of the contact surface.
[0124] Preferably, the initial positioning module is used for:
[0125] Inputting the positions of the key points into a pre-trained assembly position positioning model and outputting an initial assembly position.
[0126] Preferably, after inputting the key point positions into a pre-trained assembly position positioning model and obtaining an initial assembly position, the method further includes:
[0127] Calculating a distance based on the initial assembly position and a pre-obtained planned assembly position to obtain a position deviation;
[0128] When the position deviation is greater than a preset position threshold, replacing the initial assembly position with the planned assembly position;
[0129] When the position deviation is less than the position threshold, continue with the subsequent steps.
[0130] Preferably, the training process of the assembly position positioning model includes:
[0131] Constructing an assembly position positioning model based on historical key point positions and historical assembly positions, training the model, and determining that the training is completed after detecting that the loss function of the model meets the conditions, to obtain a trained assembly position positioning model;
[0132] Inputting the key point positions into the trained assembly position positioning model to obtain an initial assembly position.
[0133] Preferably, the path optimization module is configured to:
[0134] Perform path planning based on the initial assembly position to obtain an optimal assembly path, including:
[0135] Randomly generating an initial search path according to the initial assembly position;
[0136] Calculating an energy function according to the initial search path through the following formula:
[0137]
[0138] Wherein, is the energy function, is the initial energy value of the search path planning, is the iteration coefficient, is the n th search path length obtained by the th iteration, n is the total search path length,
[0139] Iteratively searching for the path by the gradient descent method formula:
[0140]
[0141] Wherein, is the search path of the th iteration, is the search path for the th iteration, is the learning rate, is the gradient of the energy function;
[0142] When the energy function reaches the minimum value, the corresponding search path is used as the optimal assembly path.
[0143] Preferably, the force-position optimization module is used for:
[0144] According to the optimal assembly path, combined with the force-position hybrid control algorithm, calculate the optimal assembly position and the optimal assembly force, including:
[0145] Calculate the expected assembly force through the following formula:
[0146]
[0147] where, is the expected assembly force on the coordinate, is the distance between the axis of the initial position point of the workpiece and the axis of the position to be assembled, is the size of the shaft hole to be assembled, is the path planning parameter corresponding to the optimal assembly path, is the initial assembly position;
[0148] Obtain the assembly movement time and the assembly movement speed;
[0149] Calculate the optimal assembly position according to the following formula:
[0150]
[0151] where, is the optimal assembly position, is the assembly movement speed, is the assembly movement time, is the expected assembly force on the coordinate, is the workpiece mass, is the initial assembly position,
[0152] Calculate the optimal assembly force through the following formula:
[0153]
[0154] where, is the optimal assembly force, is the position control gain, is the force control gain, is the optimal assembly position, is the initial assembly position, is the expected assembly force on the coordinate, is the planned assembly force.
[0155] Preferably, the workpiece mounting module is configured to:
[0156] Install the shaft part according to the optimal assembly path, the optimal assembly position, and the optimal assembly force, including: along the order of the optimal assembly path for the workpiece, for each of the optimal assembly positions, use the optimal assembly force to complete the installation of the shaft part.
[0157] It should be noted that a high-precision shaft-hole assembly shaft part positioning device based on machine learning provided by an embodiment of the present invention is used to execute all the process steps of a high-precision shaft-hole assembly shaft part positioning method based on machine learning in the above embodiment. The working principles and beneficial effects of the two correspond one by one, and thus will not be elaborated here.
[0158] An embodiment of the present invention also provides an electronic device. The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a data acquisition program. When the processor executes the computer program, it implements the steps in each of the above embodiments of the high-precision shaft-hole assembly shaft part positioning method based on machine learning, such as Figure 1 the step S11 shown. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in each of the above device embodiments, such as the data acquisition module.
[0159] Exemplarily, the computer program can be divided into one or more modules / units. The one or more modules / units are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the computer program in the electronic device.
[0160] The electronic device can be a computing device such as a desktop computer, a notebook, a palm computer, and a smart tablet. The electronic device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the above components are only examples of the electronic device and do not constitute a limitation on the electronic device. It may include more or fewer components than the above, or combine some components, or different components. For example, the electronic device may further include input / output devices, network access devices, a bus, etc.
[0161] The so-called processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The processor is the control center of the electronic device and connects all parts of the entire electronic device through various interfaces and circuits.
[0162] The memory can be used to store the computer programs and / or modules. The processor realizes various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and by calling the data stored in the memory. The memory mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, at least one disk storage device, flash device, or other volatile solid-state storage devices.
[0163] Among them, if the modules / units integrated in the electronic device are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, to implement all or part of the processes in the above-described embodiment methods of the present invention, it can also be completed by a computer program instructing relevant hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-described various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0164] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the attached drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that they have a communication connection, which can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0165] The specific embodiments described above have further elaborated on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only the specific embodiments of the present invention and is not used to limit the protection scope of the present invention. It is particularly pointed out that for those skilled in the art, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A high-precision shaft part positioning method for shaft-hole assembly based on machine learning, characterized in that, Including: Obtain the shaft part image; Extract features from the shaft part image to obtain the key point positions; Input the key point positions into a pre-trained assembly position positioning model and output the initial assembly position; Perform path planning according to the initial assembly position to obtain the optimal assembly path, including: Randomly generate an initial search path according to the initial assembly position; Calculate the energy function according to the initial search path through the following formula: Among them, is the energy function, is the initial energy value of the search path planning, is the iteration coefficient, is the n search path length obtained in the total search path length, n is the number of iterations; Iteratively search for the path through the gradient descent method formula: Among them, is the search path for the -th iteration, is the search path for the -th iteration, is the learning rate, is the gradient of the energy function; When the energy function reaches the minimum value, use the corresponding search path as the optimal assembly path; According to the optimal assembly path, combined with the force-position hybrid control algorithm, calculate the optimal assembly position and the optimal assembly force, including: Calculate the expected assembly force through the following formula: Among them, is the expected assembly force on the coordinate, is the distance between the axis of the initial position point of the workpiece and the axis of the to-be-assembled position point, is the to-be-assembled shaft hole size, is the planned assembly force, is the path planning parameter corresponding to the optimal assembly path, is the initial assembly position; Obtain the assembly movement time and the assembly movement speed; Calculate the optimal assembly position according to the following formula: Among them, is the optimal assembly position, is the assembly movement speed, is the assembly movement time, is the expected assembly force on the coordinate, is the workpiece mass, is the initial assembly position, is the assembly movement acceleration; Calculate the optimal assembly force through the following formula: Among them, is the optimal assembly force, is the position control gain, is the force control gain, is the optimal assembly position, is the initial assembly position, is the expected assembly force on the coordinate, is the planned assembly force; Complete the installation of the shaft part according to the optimal assembly path, the optimal assembly position, and the optimal assembly force.
2. The high-precision shaft part positioning method for shaft-hole assembly based on machine learning according to claim 1, wherein, The extracting features from the shaft part image to obtain the key point positions includes: Preprocess the shaft part image to obtain a grayscale shaft part image; Perform edge detection on the grayscale shaft part image to obtain a shaft part contour image; Perform shaft point detection on the shaft part contour image to obtain the key point positions; Wherein the key point positions include the shaft center position, the center of the circular hole at the shaft end, the center contact point, and the center point of the contact surface.
3. The high-precision shaft part positioning method for shaft-hole assembly based on machine learning according to claim 1, wherein The training process of the assembly position positioning model includes: Construct an assembly position positioning model based on historical key point positions and historical assembly positions, train the model, and determine that the training is completed after detecting that the loss function of the model meets the conditions, and obtain the trained assembly position positioning model; Input the key point positions into the trained assembly position positioning model to obtain the initial assembly position.
4. The method for positioning a shaft part in high-precision shaft-hole assembly based on machine learning according to claim 1, wherein The completing the installation of the shaft part according to the optimal assembly path, the optimal assembly position, and the optimal assembly force includes: Install the shaft part along the order of the optimal assembly path, and use the optimal assembly force for each optimal assembly position.
5. The method for positioning the shaft part in the high-precision shaft-hole assembly based on machine learning according to claim 1, wherein After the step of inputting the key point positions into a pre-trained assembly position positioning model and outputting the initial assembly position, it further includes: Calculate the distance according to the initial assembly position and the pre-acquired planned assembly position to obtain the position deviation; When the position deviation is greater than a preset position threshold, replace the initial assembly position with the planned assembly position; When the position deviation is less than the position threshold, continue with the subsequent steps.
6. A high-precision shaft part positioning device for shaft-hole assembly based on machine learning, characterized in that For implementing the high-precision shaft hole assembly shaft part positioning method based on machine learning according to any one of claims 1 to 5, including: A data acquisition module for obtaining the shaft part image; A feature extraction module for extracting features from the shaft part image to obtain the key point positions; An initial positioning module for inputting the key point positions into a pre-trained assembly position positioning model and outputting the initial assembly position; A path optimization module, configured to perform path planning based on the initial assembly position to obtain an optimal assembly path; A force-position optimization module, configured to calculate an optimal assembly position and an optimal assembly force according to the optimal assembly path in combination with a force-position hybrid control algorithm; A workpiece installation module, configured to complete the installation of the shaft part according to the optimal assembly path, the optimal assembly position, and the optimal assembly force.
7. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the method for positioning shaft parts in high-precision shaft-hole assembly based on machine learning as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the method for positioning shaft parts in high-precision shaft-hole assembly based on machine learning as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Robot slender shaft precise assembly system and method based on force sense and visual sense
CN106272416A
Shaft hole assembly equipment and method based on deep reinforcement learning
CN118832593A