Special-shaped workpiece discharging optimization algorithm of automatic feeder of punch press and tolerance algorithm thereof
The invention relates to the field of computer software algorithms, in particular to a special-shaped workpiece discharging optimization algorithm of an automatic feeder of a punch press and a tolerance algorithm thereof.
With the development of technology and economy, the application of the punching machine is more and more extensive, so that the modern industry can not leave advanced punching machines, such as the processing of automobile sheet metal, the processing of hardware parts, the processing of machine case shells and the like.
Traditional metal stamping parts fall into two broad categories: large-size metal products and small hardware workpieces. The large-size metal product is mainly used for large-size equipment, such as automobile sheet metal, chassis sheet metal, large-size mechanical equipment, electrical equipment, large-size consumer appliances and the like; the small hardware workpiece is mainly a large batch of small-size parts, such as gaskets, locks, bearing pads, small metal products and the like. For large-size metal products, a large-tonnage punch press and a large-platform numerical control feeder are needed for processing, and the used raw materials are regular large-size metal plates, so that the raw materials are expensive; for small hardware workpieces, a small and medium-tonnage punch press is mainly used for processing, the used raw materials are mainly leftover materials left after processing large-size metal products, and the processing process basically depends on manual operation. Therefore, the processing of the huge number of small hardware workpieces is completed by manual operation of manpower at present, so that the danger is high, the efficiency, the quality, the material utilization rate and the like are difficult to guarantee, and for raw materials with large weight or size, the materials are difficult to be fed to a punch press by single manpower, and the feeding work is not completed by a proper feeding mechanism, so that the utilization of the materials is greatly limited. The industrial automatic production is greatly promoted since the reform and the opening of China, and the economic structure transformation is promoted after the twenty-first century; on the other hand, the information technology is rapidly developed, and the computing performance of the computer is greatly enhanced. Under such big environment, the emergence of punch press autoloader has changed the comparatively abominable current situation of punch press production to a certain extent. The automatic feeder of the punch press is electromechanical integrated equipment for assisting the punch press to realize automatic production, generally speaking, the automatic feeder of the punch press can replace manual operation, and the operation modes of manual feeding and human eye nesting are improved into a production mode that a motor drives feeding and a machine vision system is responsible for nesting.
At present, a nesting algorithm process based on machine vision is that after a computer completes an image processing link, a nesting algorithm system identifies according to a shot picture, analyzes the outline and the shape of a stamped plate, then obtains the shape of a stamped workpiece through image identification or reading of a CAD file, converts two groups of image data into pixel value arrays which can be processed by the computer, and performs nesting through high-speed computer calculation and optimization combination. But each photo reflects the local condition of the plate to be punched, and a greedy algorithm is used for obtaining a global optimal solution through the local optimal solution.
Research is carried out on the nesting algorithm of the existing automatic feeder of the punch press, and the existing algorithm is low in operation efficiency, and under the conditions of complex workpiece shapes and complex plate profiles, a large amount of errors are accumulated on local information obtained through a single picture, so that the final nesting effect is not ideal. Meanwhile, the existing nesting algorithm is suitable for the single shape of a workpiece, if only nesting can be performed on a round gasket workpiece with a regular appearance, and for complex hardware workpieces such as a lockset, a wrench, a snap spring and the like, the nesting efficiency and the material utilization rate cannot reach higher standards. In addition, the stability of the nesting result is poor, and the situations of discharge leakage, punching leakage, even pulling open of the front and rear punching workpiece positions and the like exist in the nesting process.
Aiming at the problems, the invention provides a novel jacking algorithm, which maximally reduces the difference between the local optimal solution and the global optimal solution by performing global modeling on the local plate information acquired by each photo. Meanwhile, under the condition that the plate boundaries are irregular, the problem that the algorithm is mistakenly judged to cause leakage and discharge due to the loss of image pixels is solved through algorithm optimization, the problems of leakage and discharge and pulling open in the conventional nesting algorithm are reduced, and the utilization rate of the plate is improved.
Disclosure of Invention
The invention aims to overcome the problems in the nesting algorithm in the prior art, and provides a special-shaped workpiece discharging optimization algorithm and a tolerance algorithm thereof for an automatic punch feeder based on template nesting. The jacking support for the special-shaped hardware workpieces such as the chevron-shaped buckles, the hardware wrench, the snap spring and the like is added, and the problems of leakage and pull-open in the conventional jacking are solved, so that the stability of the jacking and the utilization rate of the plate are improved.
The technical scheme adopted by the invention for solving the problems is as follows: the utility model provides a special-shaped workpiece of punch press autoloader arranges optimization algorithm which characterized in that: the method sequentially comprises the following steps:
1) carrying out global modeling: extracting a first sheet material picture, wherein the first sheet material picture is a picture of a part of a sheet material, and then generating a nesting template according to the shape of the workpiece to be punched and the distance and the angle between each two workpieces, wherein the distance and the angle between each two workpieces are determined by software parameters read by an automatic feeder of a punch press;
2) searching local optimization combination in the nesting process: moving the generated jacking template by taking a single pixel point as a unit, and finding out a local optimal solution in a first sheet picture by recording and comparing the number of workpieces contained in the jacking template after each movement, wherein the local optimal solution is the maximum number of the workpieces which can be sleeved in the jacking template;
3) after finishing one nesting process, recording generated nesting coordinates and preparing to enter the next nesting process;
4) and matching the global modeling and the local optimization combination to ensure that the local optimal solutions in all the plate photos are combined into the global optimal solution of the plate.
The first sheet material picture can be a photo of the head of the sheet material. When the size of the extracted first sheet metal picture is larger and is closer to the size of the whole sheet metal, the local optimal solution in the first sheet metal picture approaches to the global optimal solution within an acceptable error range.
And 4) calculating to obtain the nesting position in each sheet material picture through the topological relation from the second sheet material picture. In the subsequent acquired plate images, the arrangement of the special-shaped workpieces has a special topological relation, and the hardware workpieces arranged subsequently are often limited by the positions of the workpieces arranged in the front, so that the nesting position in each plate image can be quickly calculated and acquired through the topological relation from the second image, and the nesting is not required to be performed through a template matching algorithm.
In the step 2), the nesting template moves one pixel along the left-right direction or the front-back direction each time until the distance of the left-right direction movement is larger than or equal to the length of one workpiece, or until the distance of the front-back direction movement is larger than or equal to the length of one workpiece.
When a plurality of local optimal solutions exist in the step 3), selecting the position closest to the head of the plate material in the jacking template.
The size of the jacking template is larger than that of the first sheet material picture.
The utility model provides a tolerance algorithm of special-shaped workpiece discharging optimization algorithm of punch press autoloader which characterized in that: the method comprises the following steps:
(1) scanning the profile of the workpiece;
(2) step (1) judging whether each pixel point in the outline of the workpiece has sheet material information loss or not, wherein the information loss point is a loss point;
(3) after the scanning is finished, counting missing points;
(4) and making a tolerance judgment.
Because the processing of the image needs to convert the pixel points into the binarization pixel data points which can be identified and processed by the computer, precision loss and errors exist to a certain extent, especially at the edges of the plate materials in the identification picture. At present, the universal pixel precision is 1mm and is equal to 2 pixels, namely, the error of 0.5mm can be caused by the loss of 1 pixel, and considering that the precision requirement of the existing jacking space reaches about 1mm, the error at the edge of a plate material easily causes the leakage discharge near the edge. The invention designs a tolerance algorithm, and the contour pixels of the workpiece are scanned to be matched with the pixel information of the plate, so that the condition that the workpiece exists at a certain pixel point in a picture if the plate does not exist at the pixel point is defined as 'pixel missing'.
The number of the missing points is less than 10, namely the pixel error is considered to exist. If the number of "pixel missing" is below 10, then it is assumed that the accuracy loss may be caused by a photographing error, in which case the nesting algorithm ignores the error and still succeeds in nesting.
Compared with the existing trepanning algorithm, the method has the following remarkable advantages:
the abnormal-shaped workpiece discharging optimization algorithm of the automatic punch feeder based on the template nesting, which is designed by the invention, can be compatible with nesting of most of abnormal-shaped hardware workpieces on the market, such as wrench workpieces, snap springs, chevron buckles and the like. Independent special design is not needed for a certain hardware tool, and once an ideal template is generated, the template can be immediately used for jacking according to a visual template generation algorithm attached to a jacking algorithm. Meanwhile, by global modeling of the special-shaped hardware workpiece, except that the algorithm calculation amount of the first local photo is large, coordinates of nesting points of the residual plate part can be directly generated through the topological relation of the hardware workpiece, the problems of missing discharge and nesting pulling are avoided, the efficiency of the nesting algorithm is greatly improved, the dependence on the performance of a computer is reduced, and the method can be used in industrial occasions of high-precision cameras and low-performance computers. Meanwhile, the method makes the algorithm transplantation on an embedded computer with low cost and simplified performance feasible in the future. Through the tolerance algorithm disclosed by the invention, the problem of leaking nesting at the edge caused by a photographing error is greatly reduced, and the stability of the nesting algorithm is improved.
FIG. 1 is a comparison graph of the algorithm effect of the chevron button workpiece according to the embodiment of the present invention.
FIG. 2 is a main flow chart of the template generation algorithm of the embodiment of the present invention.
Fig. 3 is a main flow chart of the nesting algorithm according to the embodiment of the present invention.
FIG. 4 is a main flow chart of the tolerance algorithm according to the embodiment of the present invention.
In fig. 1, the upper part is a plate material after jacking under the condition of the prior art, and the lower part is a plate material after jacking under the condition of the embodiment of the invention.
The present invention will be described in further detail below by way of examples with reference to the accompanying drawings, which are illustrative of the present invention and are not to be construed as limiting the present invention.
See fig. 1-4.
The difference between the present embodiment and the existing nesting algorithm is that the existing nesting algorithm performs independent nesting calculation based on each local picture, and the present embodiment provides a special-shaped workpiece layout optimization algorithm of the punch automatic feeder, which approximates global optimal nesting through an algorithm of matching a local optimal solution and a template.
The embodiment aims at demonstration of a nesting algorithm of a hardware workpiece of a chevron buckle. The embodiment applies the existing visualization template generation algorithm, and the visualization template generation algorithm automatically generates 20X20 or a nesting template with larger and smaller size according to the set workpiece distance and workpiece angle. The template generation algorithm of the embodiment can automatically generate corresponding templates according to the set workpiece distance and the workpiece angle for different special-shaped hardware workpieces or regular-shape workpieces.
Fig. 1 is a comparison of nesting results of a special-shaped workpiece discharging optimization algorithm for a punch autoloader, which is disclosed in this embodiment, with respect to a chevron button in a conventional nesting algorithm. It can be obviously seen that the special-shaped workpiece discharging optimization algorithm of the automatic feeder of the punching machine disclosed by the embodiment is more stable, and the utilization rate of a plate material is higher.
According to the abnormal-shaped workpiece discharging optimization algorithm of the automatic feeder of the punching machine, a template matching idea is adopted for extracted nesting of a first sheet material picture, a generated nesting template is placed in the center of the first sheet material picture, and then the nesting template moves by one pixel in the left-right direction or the front-back direction each time until the distance of the movement in the left-right direction or the front-back direction is larger than or equal to the length of one workpiece.
In each movement, the number of workpieces which can be put down at the current position of the nesting template is recorded and compared, when the nesting template has the condition that the number of the workpieces which can be put down is the same at different positions, the position coordinate of the nesting template is selected to be closer to the head of the plate, so that the utilization rate of the plate is potentially highest, and finally, the optimal placement position of the nesting template is found, namely the global optimal solution of the current plate picture and the local optimal solution of the whole plate.
Meanwhile, the information obtained by the first sheet material picture is expanded as much as possible, namely the information is continuously close to all the information of the whole sheet material, so that the position of the template placed in the first local nesting template matching is as close as possible to the position of the template placed in the assumed global nesting template matching, and the global optimal solution can be maximally approached through the local optimal solution obtained by the picture.
In a traditional nesting algorithm, each sheet material picture is subjected to the nesting template matching algorithm of the first sheet material picture independently, and the optimal situation of nesting of each picture is a local optimal solution.
After the template matching of the first chevron-shaped buckle workpiece is completed, the embodiment can splice the subsequently acquired pictures, retain the tail information of the previous picture, and calculate the position coordinates of the workpiece to be punched by the current sheet material picture according to the tail information of the previous picture and the topological relation of the chevron-shaped buckle.
The nesting of the current sheet material picture completely inherits the tail information of the previous sheet material picture, is at the same position as each nesting template used previously, and has the same shape as each nesting template used previously. Under the condition that the first nesting is as close to the global optimal solution as possible, each subsequent nesting maintains the nesting distribution close to the global optimal solution. Except that the calculation performance requirement of the first nesting is higher, the time consumption is longer, the performance requirement of the subsequent nesting on a computer is not high, and the calculation result is quick, simple and reliable.
In the embodiment, a set of tolerance algorithm is designed for the problem of nesting omission caused by possible pixel point errors in the processing of the sheet edge information in the sheet picture.
And (3) by scanning the profile of the chevron-shaped buckling workpiece, when the position of the nesting template in the sheet picture is close to the edge of the sheet, judging whether a possible error exists at the point by comparing the condition whether the sheet of the workpiece at the pixel point exists in the picture.
When the sheet information of a certain pixel point in the picture does not exist and workpiece information exists, the pixel is a pixel missing point in the embodiment. And counting the missing points of the pixels by scanning all pixel points of the overall workpiece outline, and if the number of the missing points of the pixels is less than 10, determining that a certain pixel error possibly exists.
In summary, when a tolerance algorithm determines that the number of missing pixel points is less than 10 if a workpiece is trepanned at a certain pixel point in a picture, the trepanning algorithm disclosed by the invention ignores the error and can still successfully perform trepanning at the position of the picture.
In addition, it should be noted that the specific embodiments described in the present specification may be different in the components, the shapes of the components, the names of the components, and the like, and the above description is only an illustration of the structure of the present invention. Equivalent or simple changes in the structure, characteristics and principles of the invention are included in the protection scope of the patent. Various modifications, additions and substitutions for the specific embodiments described may be made by those skilled in the art without departing from the scope of the invention as defined in the accompanying claims.