Part measurement method and device, electronic equipment and storage medium

By establishing a multi-layer grid and using Dijkstra's algorithm to calculate the shortest path, the problem of redundancy and inefficiency in measurement path planning in three-coordinate measuring equipment is solved, and efficient part measurement is achieved.

CN118734944APending Publication Date: 2024-10-01CHONGQING JINKANG NEW ENERGY VEHICLE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410901414.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing three-dimensional coordinate measuring equipment has redundancy and low efficiency problems in measurement path planning. Dijkstra's algorithm has low computational efficiency and difficulty in finding the optimal path when planning large-scale or complex paths.

Method used

By establishing a multi-layer grid, using Dijkstra's algorithm to calculate the shortest path, and determining the target path when the path change rate is less than the threshold, the measurement closest to the real path is achieved.

Benefits of technology

The calculation amount is reduced, the measurement efficiency is improved, and the part size is measured using the closest true path.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734944A_ABST
    Figure CN118734944A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a part measurement method, which comprises the following steps of: establishing a part space coordinate system for a to-be-measured part, determining a first layer of grids in the part space coordinate system, calculating a first shortest path of a starting node and a target node on the first layer of grids, and on the basis of the first layer of grids, calculating a second shortest path of the starting node and the target node on the first layer of grids; expanding each path node on the first shortest path to obtain a second-layer grid, adding a preset number of nodes on the second-layer grid to obtain a third-layer grid, calculating a second shortest path of the starting node and the target node on the third-layer grid, calculating a path change rate, and when the path change rate is smaller than a preset path change rate threshold value, executing the step of executing the step of executing the step of executing the step of executing the step of executing the step of executing the step of executing the step of executing the step of executing the step of executing the step of executing the step. And determining the second shortest path as the target path, and measuring the part size of the to-be-measured part from the starting node to the target node according to the target path, so that the calculation amount is reduced, and the measurement of the part size by using the target path closest to the real path is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of measurement, and in particular to a method, a device, an electronic device and a storage medium for measuring a part. Background Art

[0002] The measurement principle of the three-coordinate measuring device is to construct a part coordinate system on the equipment workbench, and obtain the dimensional information of the part by moving the measuring needle of the measuring device and contacting the measuring position on the part surface. In the operation of the three-coordinate measuring device, the planning of the measurement path is crucial to improving the measurement efficiency. At present, the measurement path is usually set manually, which often leads to redundancy of the measurement path and low measurement efficiency of the equipment. In order to optimize the measurement path, the researchers explored a variety of algorithms, including the depth-first search algorithm, the A* algorithm, the rapid exploration random tree algorithm, and the Dijkstra algorithm.

[0003] However, the depth-first search algorithm may fall into an infinite loop in some cases, resulting in the inability to find an effective measurement path. Although the A* algorithm can find a path from the starting point to the end point, it sometimes falls into a local optimal solution instead of a global optimal solution. The fast exploration random tree algorithm explores the space through random sampling, but it cannot guarantee that the path found is the optimal one.

[0004] In contrast, Dijkstra's algorithm can find the shortest path from the starting point to all other points. However, Dijkstra's algorithm faces computational efficiency issues when dealing with large-scale or complex path planning problems. At the same time, the number of node access directions on the grid map of Dijkstra's algorithm is 8 in two-dimensional space and 26 in three-dimensional space. If the actual optimal path is not in the node direction, the optimal path obtained will be different from the actual optimal path. These reasons make it difficult to expand the optimal path planning of all component measurement paths. Summary of the invention

[0005] In view of the above problems, a method, device, electronic device and storage medium for measuring parts are proposed to overcome the above problems or at least partially solve the above problems. The specific technical solutions are as follows:

[0006] In a first aspect of the present invention, a method for measuring a part is provided, wherein the method comprises:

[0007] Establishing a part space coordinate system for the part to be measured, and determining a first layer of grids in the part space coordinate system;

[0008] In the first grid layer, determining a start node and a target node, and calculating a first shortest path between the start node and the target node on the first grid layer;

[0009] On the basis of the first layer of grids, each path node on the first shortest path is expanded to obtain a second layer of grids;

[0010] Adding a preset number of second nodes to the second grid layer to obtain a third grid layer, and calculating a second shortest path between the start node and the target node in the third grid layer;

[0011] calculating a path change rate according to the second shortest path and the first shortest path, and determining the second shortest path as a target path when the path change rate is less than a preset path change rate threshold;

[0012] The part size of the part to be measured is measured according to the target path from the starting node to the target node.

[0013] Optionally, the calculating a first shortest path between the start node and the target node on the first grid layer includes:

[0014] The first shortest path between the start node and the target node on the first grid layer is calculated using the Dijkstra algorithm.

[0015] Optionally, on the basis of the first layer of grids, each path node on the first shortest path is expanded to obtain a second layer of grids, including:

[0016] Determine a projection path of the first shortest path on a preset projection plane; wherein the preset projection plane includes: a first horizontal projection plane, a first vertical projection plane, and a second vertical projection plane; the projection path includes a projection node of each path node on the first shortest path on the preset projection plane;

[0017] Determine projection path information of the projection path, wherein the projection path information includes a first coordinate and a second coordinate of each of the projection nodes on the preset projection surface;

[0018] Determine, based on the projection path information, the expansion direction of each path node on the first shortest path on the preset projection surface;

[0019] A preset extension length is obtained, and each path node on the first shortest path is extended according to the extension direction and the extension length to obtain a second layer of grids.

[0020] Optionally, the expansion direction includes a first expansion direction, and determining, based on the projection path information, the expansion direction of each path node on the first shortest path on a preset projection plane includes:

[0021] Determining, from the projection path, a plurality of first line segments connecting adjacent projection nodes;

[0022] Determine a first angle between each of the first line segments and the horizontal axis;

[0023] According to the first angle, a first extension direction of each path node on the first shortest path on a preset projection plane is determined, and the first extension direction is a horizontal direction or a vertical direction.

[0024] Optionally, the expansion direction further includes a second expansion direction, and after the expansion direction is determined according to the first angle and the expansion direction is a horizontal direction or a vertical direction, the method further includes:

[0025] Based on the positional relationship between two adjacent first line segments, the second extension direction of each path node on the first shortest path on the preset projection plane is determined, and the second extension direction is a horizontal positive direction, a horizontal negative direction, a vertical positive direction, or a vertical negative direction.

[0026] Optionally, adding a preset number of second nodes to the second grid layer to obtain a third grid layer, and calculating a second shortest path between the start node and the target node in the third grid layer includes:

[0027] Adding a preset number of second nodes on each edge of the second layer of mesh to obtain a third layer of mesh;

[0028] Each path from the start node to the target node in the third-layer grid is traversed to obtain the second shortest path.

[0029] Optionally, establishing a part space coordinate system for the part to be measured and determining a first layer of grids in the part space coordinate system includes:

[0030] Get the preset space division length;

[0031] The part space coordinate system is divided according to the preset space division length to obtain a first layer of grids; the first layer of grids is a cube grid.

[0032] In a second aspect of the present invention, there is also provided a device for measuring parts, characterized in that it comprises:

[0033] A meshing module, used to establish a part space coordinate system for the part to be measured, and determine a first layer of meshes in the part space coordinate system;

[0034] A path determination module, used to determine a start node and a target node in the first layer of grids, and calculate a first shortest path between the start node and the target node on the first layer of grids;

[0035] A path expansion module, configured to expand each path node on the first shortest path based on the first layer of grids to obtain a second layer of grids;

[0036] A path calculation module, used for adding a preset number of second nodes to the second layer grid to obtain a third layer grid, and calculating a second shortest path between the start node and the target node in the third layer grid;

[0037] a target path determination module, configured to calculate a path change rate according to the second shortest path and the first shortest path, and determine that the second shortest path is a target path when the path change rate is less than a preset path change rate threshold;

[0038] The part measurement module is used to measure the part size of the part to be measured from the starting node to the target node according to the target path.

[0039] In the third aspect of the implementation of the present invention, there is also provided an electronic device, comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, any of the above-mentioned methods for measuring parts is implemented.

[0040] In a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer program is executed by a processor to implement any of the above-mentioned methods for measuring parts.

[0041] The embodiment of the present invention has the following advantages: by establishing a part space coordinate system for the part to be measured, and determining a first layer of grids in the part space coordinate system, in the first layer of grids, determining a starting node and a target node, and calculating a first shortest path between the starting node and the target node on the first layer of grids, on the basis of the first layer of grids, expanding each path node on the first shortest path to obtain a second layer of grids, adding a preset number of second nodes to the second layer of grids to obtain a third layer of grids, and calculating a second shortest path between the starting node and the target node on the third layer of grids, calculating a path change rate based on the second shortest path and the first shortest path, determining the second shortest path as the target path when the path change rate is less than a preset path change rate threshold, and measuring the part size of the part to be measured from the starting node to the target node based on the target path, thereby reducing the amount of calculation and realizing the measurement of the part size using the target path that is closest to the real path. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0043] Figure 1 is a schematic diagram of a two-dimensional grid map and node access directions;

[0044] Figure 2 is a flowchart of steps of a method for measuring a part provided by some embodiments of the present invention;

[0045] Figure 3 is a first schematic diagram of an expansion process provided by some embodiments of the present invention;

[0046] FIG4 is a schematic diagram of a projection of a first shortest path on a projection plane provided by some embodiments of the present invention;

[0047] Figure 5 A schematic diagram of a second layer grid provided for some embodiments of the present invention;

[0048] Figure 6 A schematic diagram of a third-layer grid provided for some embodiments of the present invention;

[0049] FIG7 is a schematic diagram of a third-layer grid node access direction provided by some embodiments of the present invention;

[0050] Figure 8 A schematic structural diagram of a device for measuring parts provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0051] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] Dijkstra's algorithm is an algorithm for finding the shortest path from a single starting point in a weighted graph. The algorithm first creates two sets, one for storing nodes with determined shortest paths and the other for storing nodes with undetermined shortest paths. The shortest path of the starting node is set to 0, and the shortest paths of all other nodes are set to infinity. A node with the shortest known path is selected from the unvisited nodes (set as the current node). For each adjacent node of the current node, if the path to the adjacent node through the current node is shorter than the known shortest path, the shortest path and predecessor node of the adjacent node are updated, and the current node is marked as visited and removed from the unvisited node set. This process is repeated until all nodes have been visited, or until the target node has been visited. After the algorithm ends, the shortest path length of each node is stored in its path length field, and the shortest path from the starting node to all other nodes can be reconstructed by backtracking the predecessor nodes.

[0053] Figure 1 shows a two-dimensional grid map and a schematic diagram of node access directions. Figure 1a Divide the entire space into equally spaced grids with a grid step size of dA and the origin as an accessible node; Figure 1b It can be seen that there are eight directions to choose from for the same node to the next step. It is understandable that there will be 26 directions in three-dimensional space. In the Dijkstra algorithm, each node must contain information about the parent node (p_node) and the distance (d) from the node to the starting point, and the node edge represents that the two are reachable, and the edge length is the distance (dc).

[0054] Before starting the calculation, the parent nodes of all nodes are set to 0; the distance from the node to the starting point (d) is set to infinity, where the starting point is set to 0, and the distance between the nodes is set.

[0055] Each time the node is traversed, the distance information between the parent node of the node and the starting point is updated. The node that has not been traversed and has the smallest d is selected as the current node (c_node). The adjacent nodes n_node in the eight directions are judged according to the following formula:

[0056]

[0057] When the formula dc+d is satisfied c_node <d n_node When , the parent node of n_node is updated to c_node; the d of n_node is updated to the sum of the d of c_node and dc.

[0058] When the formula dc+d is satisfied c_node ≥d n_node No update is required.

[0059] After traversing all reachable nodes, the shortest path can be obtained by backtracking through the p_node of the target node, including the nodes on the path and the shortest path length.

[0060] The measurement principle of the three-dimensional coordinate measuring equipment is to build a part coordinate system on the equipment workbench, move the measuring device's stylus, and contact the measurement position on the part surface to obtain the part's dimensional information. Three-dimensional coordinate measurement is a high-precision and contact measurement, and the measurement path planning grid map needs to be precise. From the above content, it can be seen that the Dijkstra algorithm has a huge amount of calculation and low efficiency. At the same time, the node access directions on the Dijkstra algorithm grid map are 8 in two-dimensional space and 26 in three-dimensional space. If the actual optimal path is not in the node direction, the optimal path obtained is different from the actual optimal path. These reasons make it difficult to expand the optimal path planning of all parts measurement paths.

[0061] In the embodiment of the present invention, multiple grids are used, and the grids are arranged from coarse to fine, which improves the calculation efficiency and improves the path planning of traditional part measurement.

[0062] Reference Figure 2 , shows a flowchart of a method for measuring a part provided by an embodiment of the present invention, which may specifically include the following steps:

[0063] Step 201: Establish a part space coordinate system for the part to be measured, and determine a first layer of grids in the part space coordinate system.

[0064] Among them, the part space coordinate system is a coordinate system established based on the measurement requirements of the part to be measured. It usually corresponds to the design coordinate system or manufacturing coordinate system of the part to ensure that the measurement results are consistent with the design specifications; the part space coordinate system consists of three mutually perpendicular axes (X, Y, Z). In the part space coordinate system, in order to perform accurate measurements, the measurement area of ​​the part needs to be divided into a grid. This grid consists of a series of points, and the grid division can be uniform or non-uniform according to the geometric characteristics of the part and the measurement requirements.

[0065] In some embodiments of the present invention, a part to be measured is first placed on a workbench of a measuring device, then a part space coordinate system for the part to be measured is established, and a first layer of grid is determined in the part space coordinate system.

[0066] Specifically, the parts to be measured may include body-in-white, welded assemblies, stamped single parts, machined parts, etc.; the measuring equipment may be a gantry-type three-coordinate measuring machine or a double-cantilever three-coordinate measuring machine; for example, the body-in-white is placed on the measuring workbench of the gantry-type three-coordinate measuring machine, the spatial coordinates for the body-in-white are established, and the first layer of grid is determined in the spatial coordinate system of the body-in-white.

[0067] In some embodiments of the present invention, step 201 may include sub-steps:

[0068] Sub-step 11: Obtain a preset space division length.

[0069] Among them, the preset space division length refers to the pre-set unit length used to divide the space when performing space division or grid division. This length is usually used to define the density or resolution of the grid, which determines the number and distribution of grid points in the space.

[0070] Sub-step 12: Divide the part space coordinate system according to the preset space division length to obtain a first layer of grids; the first layer of grids is a cube grid.

[0071] In some embodiments of the present invention, the part space coordinate system is divided by a preset space division length. In this case, the grid unit is a cube shape, which means that the side length of each grid unit is equal. For example, if the preset space division length is 1 mm, then the side length of each cube unit in the grid will be 1 mm. This uniform grid division provides a regular, easy-to-handle structure, which helps to simplify the calculation and analysis process.

[0072] Specifically, when the preset space division length is dA, the measurement space is divided into square grids, and i, j, and k can be used to represent the position of a node on the grid in the space coordinate system. The coordinates can be expressed as:

[0073]

[0074] Where i, j, and k are the grid numbers of a node on the x, y, and z axes respectively.

[0075] Step 202: In the first grid layer, determine a start node and a target node, and calculate a first shortest path between the start node and the target node on the first grid layer.

[0076] The starting node refers to the starting point when measuring a part. The starting node can be a checkpoint for a specific function or performance of the part. The target node refers to the ending point when measuring a part.

[0077] In some embodiments of the present invention, after the first layer of grids is determined, the starting node and the target node can be determined in the first layer of grids, wherein the starting node and the target node can be manually set by the measurement personnel, or can be two special points on the part to be measured. After the starting node and the target node are determined, the shortest path between the starting node and the target node on the first layer of grids is calculated.

[0078] In some embodiments of the present invention, step 202 may include the following sub-steps:

[0079] Sub-step 21: Calculate the first shortest path between the start node and the target node on the first grid layer using the Dijkstra algorithm.

[0080] In some embodiments of the present invention, the Dijkstra algorithm is used to calculate the shortest path between the start node and the target node. When it is determined that the target node is marked as visited, the first shortest path between the start node and the target node on the first layer grid is calculated.

[0081] Specifically, all path nodes Node on the first shortest path can be determined I (I = 1, 2, ..., N), the coordinates of each node on the grid can be obtained by the above formula (1), and the coordinates of two adjacent nodes can be calculated by formula (2). I With Node I+1 The distance d between:

[0082]

[0083] Where I and I+1 are two adjacent nodes on the first shortest path;

[0084] By successively calculating the distances between two adjacent nodes on the first path, the length of the first shortest path between the start node and the target node on the first layer of the grid can be obtained, and the length of the first shortest path is recorded as l.

[0085] Step 203: Based on the first layer of grids, each path node on the first shortest path is expanded to obtain a second layer of grids.

[0086] In order to improve the measurement accuracy, after the first layer of grids forms the initial path grid, on the basis of the first layer of grids, the expansion strategy is first determined to decide how to expand outward from the nodes of the first layer of grids. For all path nodes on the first shortest path in the first layer of grids, new nodes are generated according to predetermined rules. These new nodes may be located in the vicinity of the original nodes. The newly generated nodes are connected to the path nodes in the first layer of grids to form a new path or grid. The newly generated path or grid is evaluated to determine whether it meets the measurement requirements.

[0087] In some embodiments of the present invention, on the basis of the first layer grid, each path node on the first shortest path is expanded according to a predetermined rule to generate a new node, and the newly generated node is connected to the nodes in the first layer grid to obtain a second layer grid.

[0088] In some embodiments of the present invention, step 203 includes the following sub-steps:

[0089] Sub-step 31: Determine the projection path of the first shortest path on a preset projection plane; wherein the preset projection plane includes: a first horizontal projection plane, a first vertical projection plane, and a second vertical projection plane; the projection path includes a projection node of each path node on the first shortest path on the preset projection plane.

[0090] Among them, the projection plane is a reference plane used to project a three-dimensional object or geometric elements in space onto a two-dimensional plane. The preset projection planes usually include horizontal projection planes and vertical projection planes, which are used to create orthogonal projections or perspective projections of objects. The first horizontal projection plane usually refers to a plane parallel to the ground, which is used to create a top view or top view of an object. On this projection plane, the vertical size of the object will not be displayed, but the horizontal size will be accurately represented. The first vertical projection plane usually refers to a vertical plane aligned with the front of the observer, which is used to create a front view or front view of the object. On this projection plane, the horizontal and vertical sizes of the object will be accurately represented, but the depth size will not be displayed. The second vertical projection plane usually refers to a vertical plane aligned with the side of the observer (usually the left or right side), which is used to create a side view of the object. On this projection plane, the horizontal and vertical sizes of the object will be accurately represented, but the width size will not be displayed.

[0091] Specifically, the first horizontal projection plane, the first vertical projection plane, and the second vertical projection plane are XY, XZ, and YZ planes, respectively.

[0092] In some embodiments of the present invention, a projection path of the first shortest path on a preset projection plane is determined; that is, the first shortest path is projected on the XY, XZ, and YZ planes respectively, and the projection path on each projection plane includes the projection nodes of each path node on the first shortest path on the preset projection plane.

[0093] Sub-step 32: Determine projection path information of the projection path, wherein the projection path information includes a first coordinate and a second coordinate of each of the projection nodes on the preset projection plane.

[0094] The first coordinate refers to the horizontal coordinate, and the second coordinate refers to the vertical coordinate.

[0095] In some embodiments of the present invention, a projection path can be obtained after each node on the first shortest path is projected onto the projection plane. At the same time, relevant information of the projection path can also be obtained. It can be understood that the projection path information includes the horizontal coordinates and vertical coordinates of each projection node on the projection plane.

[0096] Sub-step 33: Determine the extension direction of each path node on the first shortest path on the preset projection surface according to the projection path information.

[0097] According to the projection path information on the preset projection surface, the expansion direction of each path node on the first shortest path on the preset projection surface can be determined.

[0098] In some embodiments of the present invention, the expansion direction includes a first expansion direction, and sub-step 33 further includes the following sub-steps:

[0099] Sub-step 111: determining a plurality of first line segments connecting adjacent projection nodes from the projection path.

[0100] Specifically, the projection path is divided into MA (MA>=1) segments by the slope of the line between nodes, and the starting point S and the end point E of each segment can be determined. A_I-1 With Node A_I The slope k between A_I-1 、Node A_I With Node A_I+1 The slope k between A_I Calculate using formula (3):

[0101]

[0102] In the formula, k A_I-1 With k A_I Node is the projection path node A_I-1 With Node A_I and Node A_I With Node A_I+1 The slope of the projection node is , the subscript A is the XY or YZ or XZ plane, I is the projection node, and v and h are the horizontal and vertical coordinates of the projection node in the A plane respectively.

[0103] If k A_I =k A_I-1 , then Node A_I+1 With Node A_I-1 、Node A_I Located on the same line segment;

[0104] If k A_I ≠k A_I-1 , then Node A_I+1 With Node A_I-1 、Node A_I Located on different line segments.

[0105] Through the above steps, the projection nodes are calculated cyclically to obtain the slope k of each segment of the projection path. A , starting point S A With the end point EA , thereby obtaining multiple first line segments.

[0106] Sub-step 112: Determine a first angle between each of the first line segments and the horizontal axis.

[0107] First, determine the angle between the first line segment and the horizontal axis, such as Figure 3 FIG. 1 is a first schematic diagram of an expansion process provided by some embodiments of the present invention. Figure 3 The figure shows a partial view of the first shortest path projected on plane A. Plane A represents the XY, XZ, and YZ planes. V and H represent the horizontal and vertical axes of the planes. The black solid line is the m segment of the first shortest path projected on plane A, and its slope is K. A_m The dotted line is the boundary after horizontal expansion, the double-dotted line is the boundary after vertical expansion, the dotted line is the expansion distance N·dA, and αA is the angle between the projection path segment m and the axis V.

[0108] The angle αA between the projection path segment and the horizontal axis V is:

[0109] α A =arctanK A_m (4)

[0110] Among them, K A_m is the slope of segment m of the projected path.

[0111] Sub-step 113: determining a first extension direction of each path node on the first shortest path on a preset projection plane according to the first angle, wherein the first extension direction is a horizontal direction or a vertical direction.

[0112] When the first line segment is extended in the horizontal direction or the vertical direction, the relationship between the area S corresponding to the two extension methods and the angle αA between the path line segment and the horizontal axis V is as shown in formula (5):

[0113]

[0114] Among them, S V With S H are the areas formed by the projection line of the first line segment and the expansion boundary after expansion in the horizontal and vertical directions respectively; N is the number of nodes of the grid expansion; dA is the grid step size, that is, the aforementioned space division length; L is the length of the first line segment.

[0115] The size of the area corresponding to the two expansion directions can be expressed as:

[0116]

[0117] Combining (5)-(6), we can get the node expansion direction coefficient L A_V_m With L A_H_mfor:

[0118]

[0119] Where, L A_V_m With L A_H_m They are the effective coefficients of the horizontal and vertical expansion directions of the m line segment on the A plane, respectively. A value of 1 is valid, and a value of 0 is invalid. N is the number of nodes in the grid expansion.

[0120] In some embodiments of the present invention, the expansion direction further includes a second expansion direction, and after sub-step 113, the following steps are further included:

[0121] Sub-step 114: Determine the second extension direction of each path node on the first shortest path on a preset projection plane based on the positional relationship between two adjacent first line segments, wherein the second extension direction is a horizontal positive direction, a horizontal negative direction, a vertical positive direction, or a vertical negative direction.

[0122] Specifically, according to the positional relationship between two adjacent line segments, the specific steps of determining the second expansion direction are:

[0123] Determine the node expansion direction of each node in the first shortest path in the XY, XZ, and YZ planes, where the expansion direction is determined by the inner side of the projection line segment. There are mainly three forms of two line segments, as shown in Figure 4, which is a schematic diagram of the projection of the first shortest path on the projection plane provided by some embodiments of the present invention, and plane A represents the XY, XZ, and YZ planes. The solid lines are the projection path m-1 and m segments; S A_m-1 is the starting point of segment m-1; E A_m-1 (or S A_m ) is the turning point of the two line segments; E A_m is the end point of segment m, and the arrows point to the inside of the node in the horizontal and vertical directions. Figure 4a The turning point is between the starting point and the end point, T1 and T2 are turning points E A_m-1 In the horizontal and vertical directions with the line segment S A_m-1 E A_m Intersection. Figure 4b The turning point is on the right side of the starting point and the end point (the same is true for the turning point on the left side of the starting point and the end point). Figure 4c The turning point is above the starting point and the end point (the same applies if the turning point is below the starting point and the end point).

[0124] from Figure 4a In the case of , determine the expansion direction vectors of the horizontal and vertical axes of the node in plane A as:

[0125]

[0126] In the formula, and are the expansion direction vectors of the horizontal and vertical axes of the node in plane A respectively; T1 and T2 are the turning points E A_m-1 In the horizontal and vertical directions with the line segment S A_m-1 E A_m Intersection point; E A_m-1 T1 and E A_m-1 T2 is the turning point E A_m-1 Connect with T1 and T2.

[0127] Figure 4b and Figure 4c According to the turning point position, the expansion direction vectors of the node on the horizontal and vertical axes of plane A are determined as:

[0128]

[0129] In the formula, K v With K h are the expansion direction vector coefficients of the horizontal axis and the vertical axis of the node in plane A, respectively, and their values ​​are determined by Table 1.

[0130] Table 1 Kv, Kh parameters

[0131]

[0132] Unifying equations (8) and (9), we can obtain the unit vector of the node expansion direction as:

[0133]

[0134] In the formula, K V1_m With K H1_m They are respectively the expansion direction vector coefficients of the horizontal and vertical axes of the node in plane A, and the expansion direction vector coefficient is also the second expansion direction.

[0135] Sub-step 34: obtaining a preset extension length, and extending each path node on the first shortest path according to the extension direction and the extension length to obtain a second layer of grids.

[0136] After determining the expansion direction according to the first expansion direction and the second expansion direction, each path node on the first shortest path is expanded along the expansion direction according to the expansion length to obtain an expansion node corresponding to each path node, thereby obtaining a second layer of grids. The preset expansion length is usually the space division length, that is, dA mentioned above.

[0137] Specifically, for each path node Node on the first shortest path I Expand on plane A and get the i-th expanded node Node A_I_i The V and H axis coordinates are as follows:

[0138]

[0139] In formula (11), v A_I_i With h A_I_i They are respectively extended nodes Node A_I_i V and H coordinates on plane A, subscripts I and i represent the sequence number of the optimal path and the i-th (i=1,2...Ns) node expanded respectively; i is the i-th (i=1,2...Ns) node expanded; K V1_m With K H1_m are the expansion direction vector coefficients of the horizontal and vertical axes of the node in plane A respectively; L A_V_m With L A_V_m are the effective coefficients of the horizontal expansion method and the vertical expansion method on the A plane for the optimal path node of the m segment; dA is the expansion length; v I With h I Node is the optimal path node I V and H axis coordinates, it can be understood that Node A_I_i The third axis coordinate value and path node Node I The coordinates are the same.

[0140] like Figure 5 FIG. 1 is a schematic diagram of a second-layer grid provided by some embodiments of the present invention. The second-layer grid is composed of the path node Node of the first shortest path of the first-layer grid. A_I_i , Expand Node I In the figure, the circular nodes are the path nodes of the first shortest path; the dotted lines are the first shortest path; and the square nodes are the expansion nodes corresponding to each path node.

[0141] Step 204: Add a preset number of second nodes to the second grid layer to obtain a third grid layer, and calculate the second shortest path between the start node and the target node in the third grid layer.

[0142] Through the above steps, the first shortest path on the first layer of grid is expanded to obtain the second layer of grid. In order to achieve the goal of being closer to the real shortest path, it is necessary to add some nodes to the second layer of grid to encrypt the second layer of grid to obtain the third layer of grid, and then calculate the shortest path of the third layer of grid.

[0143] In some embodiments of the present invention, the first-layer grid and the extended nodes form a second-layer grid, and a preset number of nodes are added to the second-layer grid to form a third-layer grid.

[0144] In some embodiments of the present invention, step 204 may include the following sub-steps:

[0145] Sub-step 41: Add a preset number of second nodes to each edge of the second layer of mesh to obtain a third layer of mesh.

[0146] Sub-step 42: traverse each path from the start node to the target node in the third-layer grid to obtain the second shortest path.

[0147] Specifically, Figure 6 As shown in FIG. 1 , a schematic diagram of the third-layer grid provided by some embodiments of the present invention is shown. The preset number is a preset number of nodes to be added. It is understandable that nodes can also be added according to a multiple. Assuming the multiple is C, the number of nodes added is C-1, and the distance between each two adjacent added nodes can be determined to be dA / C. Figure 6 As shown in the figure, the circular nodes are the path nodes on the first shortest path of the first layer of grid; the square nodes are the expansion nodes corresponding to each path node; the triangular nodes are the second nodes added on the second layer of grid (also called encrypted nodes). I and i are the path node numbers of the first shortest path (I = 1, 2, ..., N) and the expansion node numbers corresponding to the path nodes (i = 1, 2, ..., Ns), respectively. hp and vp are the numbers of the second nodes (encrypted nodes) in the horizontal and vertical directions (values ​​1, 2, 3, ..., C-1).

[0148] The second node on the H axis A_I_i_hp and the second node on the V axis A_I_i_vp The V and H coordinates are as follows:

[0149]

[0150] In formula (12) and formula (13), and Represents the V and H coordinates of the second node on the H axis on the A plane of the path node on the first shortest path, and represents the V and H coordinates of the second node on the V axis on the A plane of the path node on the first shortest path, the subscript I is the first shortest path node (I = 1, 2, ..., N), and the subscript i is the sequence number of the extended node (i = 1, 2, ..., Ns); v A__ With h A__ For Node A_I_i (When i=0,Node A_I_i For Node I )'s V and H coordinates; it can be understood that the second node Node A_I_i_hp With Node A_I_i_vp The third axis coordinate value and path node Node I The coordinates are the same.

[0151] Specifically, the process of traversing each path from the start node to the target node in the third-layer grid to obtain the second shortest path is as follows:

[0152] The shortest path of the third-layer grid can be obtained by changing the node access direction.

[0153] As shown in FIG7 , a schematic diagram of the access direction of the third-layer grid nodes provided by some embodiments of the present invention is shown. As can be seen from FIG7 , the third-layer grid is the grid after the encrypted nodes are added to the second-layer grid. The circular nodes are the optimal path nodes of the previous layer of grids; the dotted lines are the local optimal paths obtained by the previous layer of grids; the square nodes are the expansion nodes; the triangular nodes are the encrypted nodes of the second layer of grids; and the arrows are the access nodes of the nodes. The access direction of the third-layer grid nodes in two-dimensional space is shown in FIG7 , and the distance between two points is calculated according to formula (2).

[0154] Figure 7a Arrows are path nodes I And expand the node Node A_I_i The access direction of the node and the arrow point to the accessible node. The relationship between the type and subscript of the visited node and the subscript of the current node is shown in Table 2.

[0155] Table 2. Types of visited nodes and subscript changes

[0156]

[0157] Figure 7b The arrow is the second node in the third layer of the grid. A_I_i_vp (Node A_I_i_hp Similarly, the access direction of the node and the arrow point to the accessible nodes. The relationship between the type and subscript of the visited node and the subscript of the current node is shown in Table 3.

[0158] According to the node access path of FIG. 7 , starting from the starting node of the first shortest path of the first layer of grid, all node paths in the three layers of grid are calculated and optimized to obtain the second shortest path.

[0159] Table 3. Types of visited nodes and subscript changes

[0160]

[0161] Step 205: Calculate a path change rate according to the second shortest path and the first shortest path, and when the path change rate is less than a preset path change rate threshold, determine the second shortest path as the target path.

[0162] In path planning, the path change rate is an important indicator, which is used to measure the degree of difference between two paths in the grid. Among them, the preset path change rate threshold refers to a reference value set to determine whether the path change rate meets the measurement requirements. If the path change rate between the second shortest path and the first shortest path is extremely small, or less than the preset path change rate threshold, it means that the adjustment between the first shortest path and the second shortest path is relatively small, then the second shortest path is likely to be close to the true shortest path, and the second shortest path can be determined as the target path.

[0163] In other embodiments of the present invention, if the path change rate between the second shortest path and the first shortest path is relatively large, it means that the adjustment between the first shortest path and the second shortest path is relatively large, and the possibility that the second shortest path is close to the real shortest path is low. At this time, it is necessary to further adjust the third grid, and repeat steps 203 to 205 until the path change rate is less than the preset path change rate threshold, and the determined shortest path is used as the target path.

[0164] Specifically, through multi-layer grid iterative calculation, the shortest path length l of each layer of grid can be obtained, and the path change rate of multi-grid iteration can be calculated by the following formula:

[0165]

[0166] Where ε is the path change rate; l k is the length of the kth optimal path;

[0167] When ε meets the requirements, the iteration is stopped and the optimal path, node, and path length l are output. For example, when the path change rate between the second shortest path of the third-layer grid obtained by the above method and the first shortest path is greater than the preset path change rate range, the third-layer grid is expanded to obtain the fourth-layer grid, and the second node is added to the fourth-layer grid to obtain the fifth-layer grid, and the third shortest path of the fifth grid is calculated. At this time, the path length of the first shortest path, the second shortest path of the second-layer grid, and the third shortest path can be substituted into formula (14) to calculate the path change rate of the third shortest path, so as to determine whether the third shortest path can be determined as the target path.

[0168] Step 206: measuring the part size of the part to be measured from the starting node to the target node according to the target path.

[0169] After the target path between the start node and the target node is determined, the target path can be used to control the measuring device to measure the size of the part to be measured.

[0170] The embodiment of the present invention has the following advantages: by establishing a part space coordinate system for the part to be measured, and determining a first layer of grids in the part space coordinate system, in the first layer of grids, determining a starting node and a target node, and calculating a first shortest path between the starting node and the target node on the first layer of grids, on the basis of the first layer of grids, expanding each path node on the first shortest path to obtain a second layer of grids, adding a preset number of second nodes to the second layer of grids to obtain a third layer of grids, and calculating a second shortest path between the starting node and the target node on the third layer of grids, calculating a path change rate based on the second shortest path and the first shortest path, determining the second shortest path as the target path when the path change rate is less than a preset path change rate threshold, and measuring the part size of the part to be measured from the starting node to the target node based on the target path, thereby reducing the amount of calculation and realizing the measurement of the part size using the target path that is closest to the real path.

[0171] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0172] Reference Figure 8 , shows a schematic diagram of the structure of a device for measuring parts provided by an embodiment of the present invention, which may specifically include the following modules:

[0173] A meshing module 801 is used to establish a part space coordinate system for the part to be measured and determine a first layer of meshes in the part space coordinate system;

[0174] A path determination module 802 is used to determine a start node and a target node in the first layer of grids, and calculate a first shortest path between the start node and the target node on the first layer of grids;

[0175] A path expansion module 803 is used to expand each path node on the first shortest path based on the first layer of grids to obtain a second layer of grids;

[0176] A path calculation module 804 is used to add a preset number of second nodes to the second layer grid to obtain a third layer grid, and calculate the second shortest path between the start node and the target node in the third layer grid;

[0177] a target path determination module 805, configured to calculate a path change rate according to the second shortest path and the first shortest path, and determine the second shortest path as a target path when the path change rate is less than a preset path change rate threshold;

[0178] The part measurement module 806 is used to measure the part size of the part to be measured from the starting node to the target node according to the target path.

[0179] In an optional embodiment of the present invention, the path determination module 802 includes:

[0180] The path calculation submodule is used to calculate the first shortest path between the start node and the target node on the first layer grid by using the Dijkstra algorithm.

[0181] In an optional embodiment of the present invention, the path expansion module 803 includes:

[0182] A first expansion submodule, configured to determine a projection path of the first shortest path on a preset projection plane; wherein the preset projection plane includes: a first horizontal projection plane, a first vertical projection plane, and a second vertical projection plane; the projection path includes a projection node of each path node on the first shortest path on the preset projection plane;

[0183] A second expansion submodule is used to determine projection path information of the projection path, wherein the projection path information includes a first coordinate and a second coordinate of each projection node on the preset projection plane;

[0184] A third expansion submodule, configured to determine, based on the projection path information, an expansion direction of each path node on the first shortest path on the preset projection surface;

[0185] The fourth expansion submodule is used to obtain a preset expansion length, and expand each path node on the first shortest path according to the expansion direction and the expansion length to obtain a second layer grid.

[0186] In an optional embodiment of the present invention, the third expansion submodule includes:

[0187] The first expansion subunit is used to determine a plurality of first line segments connecting adjacent projection nodes from the projection path.

[0188] The second expansion subunit is used to determine a first angle between each of the first line segments and the horizontal axis.

[0189] The third expansion subunit is used to determine a first expansion direction of each path node on the first shortest path on a preset projection plane according to the first angle, where the first expansion direction is a horizontal direction or a vertical direction.

[0190] In an optional embodiment of the present invention, the third expansion submodule further includes:

[0191] The fourth expansion subunit is used to determine the second expansion direction of each path node on the first shortest path on a preset projection plane based on the positional relationship between two adjacent first line segments, wherein the second expansion direction is a horizontal positive direction, a horizontal negative direction, a vertical positive direction, or a vertical negative direction.

[0192] In an optional embodiment of the present invention, the path calculation module 804 includes:

[0193] The node adding submodule is used to add a preset number of second nodes on each edge of the second layer grid to obtain a third layer grid.

[0194] The path calculation submodule is used to traverse each path from the starting node to the target node in the third layer grid to obtain the second shortest path.

[0195] In an optional embodiment of the present invention, the grid division module 801 includes:

[0196] The first division submodule is used to obtain a preset space division length.

[0197] The second division submodule is used to divide the part space coordinate system according to the preset space division length to obtain a first layer of grids; the first layer of grids is a cube grid.

[0198] The embodiment of the present invention has the following advantages: by establishing a part space coordinate system for the part to be measured, and determining a first layer of grids in the part space coordinate system, in the first layer of grids, determining a starting node and a target node, and calculating a first shortest path between the starting node and the target node on the first layer of grids, on the basis of the first layer of grids, expanding each path node on the first shortest path to obtain a second layer of grids, adding a preset number of second nodes to the second layer of grids to obtain a third layer of grids, and calculating a second shortest path between the starting node and the target node on the third layer of grids, calculating a path change rate based on the second shortest path and the first shortest path, determining the second shortest path as the target path when the path change rate is less than a preset path change rate threshold, and measuring the part size of the part to be measured from the starting node to the target node based on the target path, thereby reducing the amount of calculation and realizing the measurement of the part size using the target path that is closest to the real path.

[0199] An embodiment of the present invention further provides an electronic device, which may include a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and the computer program implements the above part measurement method when executed by the processor.

[0200] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned method for measuring parts is implemented.

[0201] Some embodiments of the present invention further provide a computer program product, including a computer program, which implements the above part measurement method when executed by a processor.

[0202] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0203] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0204] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0205] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0206] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate a device for implementing the functions specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0207] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0208] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0209] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0210] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.

[0211] The method, device, electronic device and storage medium for part measurement provided are introduced in detail above. 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 those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for measuring parts. It is characterized in that The method comprises: Establishing a part space coordinate system for the part to be measured, and determining a first layer of grids in the part space coordinate system; In the first grid layer, determining a start node and a target node, and calculating a first shortest path between the start node and the target node on the first grid layer; On the basis of the first layer of grids, each path node on the first shortest path is expanded to obtain a second layer of grids; Adding a preset number of second nodes to the second grid layer to obtain a third grid layer, and calculating a second shortest path between the start node and the target node in the third grid layer; calculating a path change rate according to the second shortest path and the first shortest path, and determining the second shortest path as a target path when the path change rate is less than a preset path change rate threshold; The part size of the part to be measured is measured according to the target path from the starting node to the target node.

2. The method according to claim 1, It is characterized in that The calculating a first shortest path between the starting node and the target node on the first layer of grid includes: The first shortest path between the start node and the target node on the first grid layer is calculated using the Dijkstra algorithm.

3. The method according to claim 1, It is characterized in that The step of expanding each path node on the first shortest path on the basis of the first layer of grids to obtain a second layer of grids includes: Determine a projection path of the first shortest path on a preset projection plane; wherein the preset projection plane includes: a first horizontal projection plane, a first vertical projection plane, and a second vertical projection plane; the projection path includes a projection node of each path node on the first shortest path on the preset projection plane; Determine projection path information of the projection path, wherein the projection path information includes a first coordinate and a second coordinate of each of the projection nodes on the preset projection surface; Determine, based on the projection path information, the expansion direction of each path node on the first shortest path on the preset projection surface; A preset extension length is obtained, and each path node on the first shortest path is extended according to the extension direction and the extension length to obtain a second layer of grids.

4. The method according to claim 3, It is characterized in that The expansion direction includes a first expansion direction, and determining the expansion direction of each path node on the first shortest path on a preset projection surface according to the projection path information includes: Determining, from the projection path, a plurality of first line segments connecting adjacent projection nodes; Determine a first angle between each of the first line segments and the horizontal axis; According to the first angle, a first extension direction of each path node on the first shortest path on a preset projection plane is determined, and the first extension direction is a horizontal direction or a vertical direction.

5. The method according to claim 4, It is characterized in that The expansion direction further includes a second expansion direction. After the expansion direction is determined according to the first angle and the expansion direction is a horizontal direction or a vertical direction, the method further includes: Based on the positional relationship between two adjacent first line segments, the second extension direction of each path node on the first shortest path on the preset projection plane is determined, and the second extension direction is a horizontal positive direction, a horizontal negative direction, a vertical positive direction, or a vertical negative direction.

6. The method according to any one of claims 1 to 5, wherein a preset number of second nodes are added to the second grid layer to obtain a third grid layer, and a second shortest path between the start node and the target node in the third grid layer is calculated. include: Adding a preset number of second nodes on each edge of the second layer of mesh to obtain a third layer of mesh; Each path from the start node to the target node in the third-layer grid is traversed to obtain the second shortest path.

7. The method according to any one of claims 1 to 5, It is characterized in that The step of establishing a part space coordinate system for the part to be measured and determining a first layer of grids in the part space coordinate system includes: Get the preset space division length; The part space coordinate system is divided according to the preset space division length to obtain a first layer of grids; the first layer of grids is a cube grid.

8. A device for measuring parts, It is characterized in that The device comprises: A meshing module, used to establish a part space coordinate system for the part to be measured, and determine a first layer of meshes in the part space coordinate system; A path determination module, used to determine a start node and a target node in the first layer of grids, and calculate a first shortest path between the start node and the target node on the first layer of grids; A path expansion module, configured to expand each path node on the first shortest path based on the first layer of grids to obtain a second layer of grids; A path calculation module, used for adding a preset number of second nodes to the second layer grid to obtain a third layer grid, and calculating a second shortest path between the start node and the target node in the third layer grid; a target path determination module, configured to calculate a path change rate according to the second shortest path and the first shortest path, and determine that the second shortest path is a target path when the path change rate is less than a preset path change rate threshold; The part measurement module is used to measure the part size of the part to be measured from the starting node to the target node according to the target path.

9. An electronic device, It is characterized in that The invention comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the part measurement method according to any one of claims 1 to 7 when executed by the processor.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for measuring a part according to any one of claims 1 to 7 is implemented.