Method for cutting PVC (polyvinyl chloride) plate based on Mark point positioning function
Technical Field
The invention belongs to the technical field of automation of high-precision numerical control equipment, and relates to a method for combining machine vision and Mark point auxiliary positioning in a engraving and milling machine, which can effectively improve the cutting accuracy when a PVC plate is cut.
Background
The engraving and milling machine is one of numerical control machines widely applied to various factory enterprises in China at present, has the advantages of small cutter, high power, high speed of a main shaft and capability of processing materials with larger hardness, and makes up for the defects of a cutting machine and an engraving machine. The production cost for processing high-hardness materials is greatly reduced due to the appearance of the high-hardness material processing machine, the automation level of the engraving and milling industry is improved, and the links of manual work are reduced. The user can also adapt to different production requirements through parameter adjustment, and the quality of finished products is improved.
At present, various models of engraving and milling machines in China cut PVC materials to obtain finished products through fixing positions in advance. Each time the position is corrected, a person working on site is required to align the PVC material with the cutting origin set in advance and to plan the path. However, due to different levels of workers and different thicknesses of PVC materials, finished products cut from the same cutting program file are not good and economical, and the practicability and yield of the engraving and milling machine are affected finally.
Disclosure of Invention
In order to overcome the defects of low efficiency, long time consumption, large error and excessive manual intervention of the positioning mode of the traditional engraving and milling machine, the invention provides a method for cutting a PVC plate based on a Mark point positioning function.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method for cutting a PVC plate based on a Mark point positioning function comprises the following steps:
1) firstly, an industrial camera is arranged at a position near a main shaft of the engraving and milling machine, and the relative offset X between the camera and the main shaft is calculated through the function of offset tool setting of the camerasAnd Ys(ii) a Ratio P of coordinates of known cut file program to actual working coordinate system 11, calculating the conversion ratio of a camera coordinate system to a file cutting program to be P through Mark point imaging of a camera at the current height 21, wherein the maximum range of the camera coordinate system is (X)c,Yc);
2) Secondly, the engraving and milling machine formulates a strategy for searching Mark points according to the cutting program file;
3) respectively obtaining 4 pairs of Mark point central coordinates (X) by an industrial camera according to the strategy of searching the Mark points in the step 2)i,Yi) And the current spindle coordinate fed back by the control board when finding the Mark point is (X)Ci,YCi) Wherein i is 1,2,3, 4; converting the coordinates of the current camera coordinate system into the coordinate system of the cutting program file according to the parameters in the step 1), and the steps are as follows:
Xi2f=XCi×P1-(Xi-0.5×Xc)×P2+Xswhich isWherein i is 1,2,3, 4;
Yi2f=YCi×P1-(Yi-0.5×Yc)×P2+Yswherein i is 1,2,3, 4;
4) comparing the coordinates of the 4 Mark points converted in the step 3) with the central coordinates of the Mark points in the cutting program file coordinate system, if no deviation occurs, the position of the PVC material is normal, and if the deviation exists, correcting the position of the PVC material, wherein a correction algorithm is as follows: is provided with
①Xi': cutting an x-axis coordinate of the center of the ith Mark point in a program file coordinate system, wherein i is 1,2,3 and 4;
Yi': cutting a y-axis coordinate of the center of the ith Mark point in a program file coordinate system, wherein i is 1,2,3 and 4;
angle θ: the angle of rotation between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
θiangle: the angle of rotation between the pattern in the ith cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system, wherein i is 1,2,3, 4;
③Xoffset: an offset of the x-axis between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
Yoffset: an offset in the y-axis between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
the offset of the pattern in the ith group of cutting program files and the x axis between the pattern rotation converted from the working coordinate system to the cutting file coordinate system, wherein i is 1,2,3 and 4;
transferring the pattern in the ith group of cutting program files from the working coordinate systemChanging to the offset of the y axis between the pattern rotations in the cutting document coordinate system, wherein i is 1,2,3, 4;
④Xpi: cutting the x-axis coordinate of the pattern in the program file coordinate system, wherein i ═ 1.., n; y ispi: cutting the y-axis coordinate of the pattern in the program file coordinate system, wherein i is 1.
Xcorrecti: converting the corrected pattern x-axis coordinates back to a working coordinate system, wherein i is 1. Y iscorrecti: converting the corrected pattern y-axis coordinates back to the pattern y-axis coordinates of a working coordinate system, wherein i is 1.
A: a rotation matrix between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
b: a translation matrix between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
establishing a model of a rotation matrix:
establishing a model of a translation matrix:
establishing the relation between the working coordinate system in the program and the Mark points converted into the program:
establishing an equation set by using the corresponding relation (at most 4 solutions) of any three groups of 3 Mark points:
wherein, alpha, beta and gamma are respectively different from one of i-1, 2,3 and 4A value of (d);
angle of rotation θ to the PVC plate calculated using the above equation set:
and fifthly, calculating the offset distance of the x axis and the y axis of the position of the PVC plate by using the theta angle obtained in the step (iv):
sixthly, in order to enhance the robustness of the algorithm and reduce the precision loss caused by accidental errors, the rotation angle theta and the offset distance X are calculated by taking the mean value of the solution values of the multiple pairs of corresponding relation groupsoffset,Yoffset:
And seventhly, calculating the coordinates of the PVC board pattern converted into the working coordinate system by correction according to the result obtained in the step (c):
(Xcorrecti,Ycorrexti) I.e. the corrected position of the cutting pattern on the table, where i is 1.
The technical conception of the invention is as follows: the method comprises the following steps of firstly, installing an industrial camera at a position near a main shaft of the engraving and milling machine, and calculating the relative offset of the camera and the main shaft through the function of the offset tool setting of the camera. Calculating the conversion ratio between the camera coordinate system and the cut file program through the Mark point imaging of the camera with the current height according to the ratio between the coordinate of the known cut file program and the actual working coordinate system; secondly, the engraving and milling machine formulates a strategy for searching Mark points according to the cutting program file; thirdly, respectively obtaining 4 pairs of Mark point center coordinates and the current spindle coordinate fed back when the Mark point is found by the control board through the Mark point searching strategy in the second step by the industrial camera, and converting the coordinate of the current camera coordinate system into the coordinate system of the cutting program file according to the Buddha rolling stone; and fourthly, comparing the coordinates of the 4 converted Mark points with the central coordinates of the Mark points in a cutting program file coordinate system, if no deviation occurs, indicating that the position of the PVC material is normal, and if the deviation exists, correcting the position of the PVC material.
The beneficial effects of the invention are as follows: the running efficiency of the machine is improved, and the condition of human intervention is reduced. 2. The cutting precision and quality can not be influenced by the factors such as the size, the thickness, the deviation and the like of the PVC plate. 3. Compared with the traditional solution for positioning the Mark point, the solution has strong robustness, and the precision loss caused by errors can be reduced to the minimum under the accidental condition.
Drawings
Fig. 1 is a schematic view of the installation of an industrial camera on the spindle side of an engraving and milling machine.
Fig. 2 is a schematic view of the table top of the router.
FIG. 3 is a diagram of an industrial camera coordinate system.
Fig. 4 is a diagram of a finding strategy of Mark points.
FIG. 5 is a graphical representation comparing the offset PVC sheet pattern of the working coordinate system converted to the cutting program file coordinate system and the original file.
FIG. 6 is a flow chart of the algorithm of the present invention.
101-an industrial camera assembly; 102-engraving and milling machine main shaft;
201-a table coordinate system; 202-industrial camera coordinate system; 203-industrial camera x-axis offset; 204-industrial camera y-axis offset;
301-Mark point circle center coordinates; 302-center coordinates of industrial camera coordinate system; 303-industrial camera coordinate system.
Detailed Description
The present invention will be described in detail below with reference to the accompanying drawings.
Referring to fig. 1 to 6, a method for cutting a PVC plate based on Mark point positioning function includes the steps of:
1) firstly, an industrial camera is arranged at a position near a main shaft of the engraving and milling machine as shown in FIG. 1, and the relative offset X of the camera and the main shaft is calculated through the function of the offset tool setting of the camera as shown in FIG. 2sAnd Ys. Ratio P of coordinates of known cut file program to actual working coordinate system 11, calculating the conversion ratio of a camera coordinate system to a file cutting program to be P through Mark point imaging of a camera at the current height 21, wherein the maximum range of the camera coordinate system is (X) as shown in FIG. 3c,Yc)。
2) Secondly, the engraving and milling machine makes a strategy for finding Mark points according to the cutting program file as shown in fig. 4.
3) Respectively obtaining 4 pairs of Mark point central coordinates (X) by an industrial camera according to the strategy of searching the Mark points in the step 2)i,Yi) And the current spindle coordinate fed back by the control board when finding the Mark point is (X)Ci,YCi) Wherein i is 1,2,3, 4. Converting the coordinates of the current camera coordinate system into the coordinate system of the cutting program file as shown in fig. 5 according to the parameters in step 1), the steps are as follows:
Xi2f=XCi×P1-(Xi-0.5×Xc)×P2+Xswherein i is 1,2,3, 4;
Yi2f=YCi×P1-(Yi-0.5×Yc)×P2+Yswherein i is 1,2,3, 4;
4) comparing the coordinates of the 4 converted Mark points obtained in the step 3) with the central coordinates of the Mark points in the cutting program file coordinate system, if no deviation occurs, the position of the PVC material is normal, and if the deviation exists, correcting the position of the PVC material, wherein a correction algorithm is as follows: is provided with
Xi': cutting an x-axis coordinate of the center of the ith Mark point in a program file coordinate system, wherein i is 1,2,3 and 4;
Yi': cutting a y-axis coordinate of the center of the ith Mark point in a program file coordinate system, wherein i is 1,2,3 and 4;
angle θ: the angle of rotation between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
θiangle: the angle of rotation between the pattern in the ith cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system, wherein i is 1,2,3, 4;
Xoffset: an offset of the x-axis between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
Yoffset: an offset in the y-axis between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
the offset of the pattern in the ith group of cutting program files and the x axis between the pattern rotation converted from the working coordinate system to the cutting file coordinate system, wherein i is 1,2,3 and 4;
the offset of the pattern in the ith cutting program file and the y-axis between the pattern rotation converted from the working coordinate system to the cutting file coordinate system, wherein i is 1,2,3 and 4;
Xpi: cutting the x-axis coordinate of the pattern in the program file coordinate system, where i ═ 1,...,n;Ypi: cutting the y-axis coordinate of the pattern in the program file coordinate system, wherein i is 1.
Xcorrecti: converting the corrected pattern x-axis coordinates back to a working coordinate system, wherein i is 1. Y iscorrecti: converting the corrected pattern y-axis coordinates back to the pattern y-axis coordinates of a working coordinate system, wherein i is 1.
A: a rotation matrix between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
b: a translation matrix between the pattern in the cutting program file and the rotation of the pattern converted from the working coordinate system to the cutting file coordinate system;
establishing a model of a rotation matrix:
establishing a model of a translation matrix:
establishing the relation between the working coordinate system in the program and the Mark points converted into the program:
establishing an equation set by using the corresponding relation (at most 4 solutions) of any three groups of 3 Mark points:
wherein α, β, γ are each a different value of i ═ 1,2,3, 4;
angle of rotation θ to the PVC plate calculated using the above equation set:
and fifthly, calculating the offset distance of the x axis and the y axis of the position of the PVC plate by using the theta angle obtained in the step (iv):
sixthly, in order to enhance the robustness of the algorithm and reduce the precision loss caused by accidental errors, the rotation angle theta and the offset distance X are calculated by taking the mean value of the solution values of the multiple pairs of corresponding relation groupsoffset,Yoffset:
And seventhly, calculating the coordinates of the PVC board pattern converted into the working coordinate system by correction according to the result obtained in the step (c):
(Xcorrecti,Ycorrexti) I.e. the corrected position of the cutting pattern on the table, where i is 1.