Galvanometer laser marking control method, device, computer equipment and storage medium
By performing position decomposition and time calculation on the vector diagram of galvanomic laser marking, accurate marking control instructions are generated, which solves the problem that traditional technology cannot perform extremely short-line segment switches under high speed conditions, and improves the application range and accuracy of laser marking.
Patent Information
- Application Number
- CN202510129038.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-05
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-02-05
AI Technical Summary
Traditional galvanometer laser marking cannot perform extremely short-line switching at high speeds, which limits its application range and usage scenarios.
By obtaining the vector diagram to be marked, a set of marking line segments is constructed, and position decomposed according to the marking parameters is calculated, the laser light output time and light off time are stored in a preset array, and the marking control instructions are generated to perform laser galvanometer marking operation.
It improves the application range and accuracy of laser marking, and can effectively perform extremely short-line segment switches at high speed to meet the usage needs of more scenarios.
Smart Images

Figure CN119549897B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial laser marking, and in particular to a galvanometer laser marking control method, device, computer equipment and storage medium. Background Art
[0002] Laser scanner is also called laser galvanometer, which is composed of XY optical scanning head, electronic drive amplifier and optical reflective lens. The signal provided by computer controller drives the optical scanning head through driving amplifier circuit, so as to control the deflection of laser beam in XY plane. Galvanometer laser adopts galvanometer scanning marking head, which is mainly composed of XY scanning mirror, field mirror, galvanometer and computer controlled marking software. In galvanometer scanning system, vector graphics and text marking can be adopted. This method adopts the processing method of graphics by computer graphics software, which has the characteristics of high drawing efficiency, good graphics accuracy and no distortion, and greatly improves the quality and speed of laser marking. At the same time, galvanometer marking can also adopt dot matrix marking method, which is very suitable for online marking. According to the production line of different speeds, one scanning galvanometer or two scanning galvanometers can be used. Compared with the array marking mentioned above, this method can mark more dot matrix information and has greater advantages for marking Chinese characters. Galvanometer scanning marking has become a mainstream product due to its wide range of applications. It can perform vector marking and dot matrix marking, has an adjustable marking range, and has the advantages of fast response speed, high marking speed (hundreds of characters can be marked per second), high marking quality, good optical path sealing performance, and strong environmental adaptability. It is considered to represent the future development direction of laser marking and has broad application prospects.
[0003] In traditional galvanometer and laser control, control is performed according to a cycle of 10us, that is, the position command and laser switch command are sent every 10us. In this case, the minimum switch light length = speed * 10us. For example, when the speed is 1000mm / s, the minimum switch length is 0.01mm. In this regard, at low speeds, a spacing of 0.01mm is sufficient, but it is not applicable at high speeds. For example, in the BC battery (full back electrode contact crystalline silicon photovoltaic cell) scribing application, the speed can reach 80000mm / s, and the minimum switch length is 0.8mm at this time. In actual applications, there will be many line segments less than 0.1mm, so the traditional 10us control mode can no longer meet the actual marking requirements. Therefore, how to improve the application scope of laser marking and meet the use requirements of more scenarios is a problem that technicians in this field need to solve. Summary of the invention
[0004] The embodiments of the present invention provide a galvanometer laser marking control method, device, computer equipment and storage medium, aiming to increase the application scope of laser marking and meet the use requirements of more scenarios.
[0005] In a first aspect, an embodiment of the present invention provides a galvanometer laser marking control method, comprising:
[0006] Obtain a vector map to be marked, and construct a marking line segment set based on the vector map;
[0007] Obtaining marking parameters, and performing position decomposition on the marking line segment set according to the marking parameters to obtain a position decomposition result;
[0008] According to the result of the position decomposition, the light-on time and the light-off time of the laser are calculated, and the light-on time and the light-off time are stored in a preset first array, and the result of the position decomposition is stored in a preset second array;
[0009] A marking control instruction is generated based on the first array and the second array, and a laser galvanometer marking operation is performed through the marking control instruction.
[0010] In a second aspect, an embodiment of the present invention provides a galvanometer laser marking control device, comprising:
[0011] A vector map acquisition unit, used to acquire a vector map to be marked, and construct a marking line segment set based on the vector map;
[0012] A position decomposition unit, used for acquiring marking parameters, and performing position decomposition on the marking line segment set according to the marking parameters to obtain a position decomposition result;
[0013] An array storage unit, used to calculate the light-on time and the light-off time of the laser according to the result of the position decomposition, and use a preset first array to store the light-on time and the light-off time, and use a preset second array to store the result of the position decomposition;
[0014] The marking control unit is used to generate a marking control instruction based on the first array and the second array, and perform a laser galvanometer marking operation according to the marking control instruction.
[0015] In a third aspect, an embodiment of the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the galvanometer laser marking control method as described in the first aspect is implemented.
[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the galvanometer laser marking control method as described in the first aspect is implemented.
[0017] The embodiment of the present invention provides a galvanometer laser marking control method, device, computer equipment and storage medium, the method comprising: obtaining a vector diagram to be marked, and constructing a marking line segment set based on the vector diagram; obtaining marking parameters, and performing position decomposition on the marking line segment set according to the marking parameters to obtain the result of the position decomposition; calculating the light-on time and light-off time of the laser according to the result of the position decomposition, and storing the light-on time and light-off time using a preset first array, and storing the result of the position decomposition using a preset second array; generating a marking control instruction based on the first array and the second array, and performing a laser galvanometer marking operation through the marking control instruction. The embodiment of the present invention sets a more accurate laser switch time by decomposing the marking line segment, and generates a marking control instruction in combination with the result of the position decomposition of the marking line segment, so as to solve the problem that the traditional marking scheme cannot switch extremely short line segments under high-speed conditions, thereby increasing the application scope of laser marking and meeting the use requirements of more scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are 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 any creative work.
[0019] Figure 1 A schematic flow chart of a galvanometer laser marking control method provided in an embodiment of the present invention;
[0020] Figure 2 A schematic diagram of a sub-process of a galvanometer laser marking control method provided by an embodiment of the present invention;
[0021] Figure 3 A schematic diagram of another sub-process of a galvanometer laser marking control method provided by an embodiment of the present invention;
[0022] Figure 4 An example diagram of a marking line segment set in a galvanometer laser marking control method provided in an embodiment of the present invention;
[0023] Figure 5 An example diagram of line segment position decomposition in a galvanometer laser marking control method provided by an embodiment of the present invention;
[0024] Figure 6 A schematic block diagram of a galvanometer laser marking control device provided in an embodiment of the present invention;
[0025] Figure 7 A schematic block diagram of a galvanometer laser marking control device provided in an embodiment of the present invention;
[0026] Figure 8 Another sub-schematic block diagram of a galvanometer laser marking control device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of 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.
[0028] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0029] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0030] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0031] See below Figure 1 , a galvanometer laser marking control method provided by an embodiment of the present invention specifically includes: steps S101~S104.
[0032] Step S101, obtaining a vector map to be marked, and constructing a marking line segment set based on the vector map;
[0033] Step S102, obtaining marking parameters, and performing position decomposition on the marking line segment set according to the marking parameters to obtain a position decomposition result;
[0034] Step S103, according to the result of the position decomposition, calculate the light-on time and the light-off time of the laser, and use a preset first array to store the light-on time and the light-off time, and use a preset second array to store the result of the position decomposition;
[0035] Step S104: generating a marking control instruction based on the first array and the second array, and performing a laser galvanometer marking operation according to the marking control instruction.
[0036] In this embodiment, a marking vector graph is first obtained, and a marking line segment set is constructed based on the vector graph, and then marking parameters, such as packaging speed, are obtained, and then the marking line segments in the marking line segment set are positionally decomposed using the marking parameters, and the switching time of the laser during marking is further determined based on the result of the position decomposition. The calculated switching time of the laser and the position decomposition results are stored in different arrays, and then a marking control instruction is generated based on the two arrays, that is, a marking control instruction is generated based on the switching time of the laser and the position decomposition results, and the laser galvanometer marking operation is performed accordingly.
[0037] This embodiment sets a more precise laser switch time by decomposing the marking line segments, and generates marking control instructions based on the results of the position decomposition of the marking line segments. This can solve the problem that traditional marking solutions cannot perform extremely short line segment switches under high-speed conditions, thereby increasing the application scope of laser marking and meeting the usage requirements of more scenarios.
[0038] It should also be noted that the galvanometer laser marking control method provided in this embodiment is particularly suitable for the fields of new energy, photovoltaics, etc., and is beneficial to the scribing application of BC batteries, etc.
[0039] In one embodiment, the step S101 includes:
[0040] Setting marking points based on the vector diagram and obtaining coordinate information of the marking points;
[0041] Combining two adjacent marking points into a line segment to obtain a line segment set including a plurality of line segments;
[0042] The marking line segment set is constructed by combining the coordinate information of the marking points and the line segment set.
[0043] When constructing a marking line segment set based on a vector diagram, this embodiment first defines a Point type to represent a marking point (x, y). The marking point (x, y) contains two pieces of information, namely, x representing the X-axis coordinate and y representing the Y-axis coordinate. Then two adjacent marking points are combined into a line segment. For example, the starting point pStart and the end point pEnd of the line segment are set. Multiple line segments can be represented as (pStart0, pEnd0), (pStart1, pEnd1), ..., (pStartN, pEndN). Then, all the marking point coordinates are combined into a series of line segments in the above manner, and the following can be obtained: Figure 4 The dotted line diagram shown is used to construct the marked line segment set.
[0044] In one embodiment, if Figure 2 As shown, the step S102 includes: steps S201~S204.
[0045] Step S201, calculating the length of the line segment according to the coordinate information of the marking point;
[0046] Step S202, obtaining marking parameters, and calculating the marking time of each line segment by combining the marking parameters and the length of the line segment; wherein the marking parameters include a marking speed and a preset first control period;
[0047] Step S203, determining the number of first control cycles required for the corresponding line segment according to the marking time;
[0048] Step S204: decompose the line segment based on the number of the first control cycles.
[0049] In this embodiment, when the line segments in the marked line segment set are positionally decomposed, the starting point coordinates and the ending point coordinates of each line segment can be determined first, and then the length of the line segment can be calculated according to the starting point coordinates and the ending point coordinates. The specific calculation formula is as follows:
[0050] len i =sqrt((pStarti.x–pEndi.x) *(pStarti.x–pEndi.x) + (pStarti.y–pEndi.y) *(pStarti.y–pEndi.y));
[0051] Among them, len i Indicates the length of the i-th line segment, pStarti.x indicates the horizontal coordinate of the starting point of the i-th line segment, pEndi.x indicates the horizontal coordinate of the ending point of the i-th line segment, pStarti.y indicates the vertical coordinate of the starting point of the i-th line segment, and pEndi.y indicates the vertical coordinate of the starting point of the i-th line segment;
[0052] After calculating the length of the line segment, combined with the marking speed, the marking time required for the line segment can be calculated. The specific calculation formula is as follows:
[0053] t = len / speed;
[0054] Among them, t represents the marking time, len represents the length of the line segment, and speed represents the marking speed;
[0055] Then, combined with the preset first control cycle a, the number of control cycles required for the line segment can be calculated, that is, the number of first control cycles step = t*a. In actual application scenarios, the first control cycle a can be set to 10ns, and the unit of marking time is s, then the number of first control cycles is step = t*100000000.
[0056] Then, the line segments can be decomposed according to the number of the first control cycles, as follows: Figure 5 As shown, the line segment is decomposed into small line segments of the first control period. Accordingly, the coordinate information of all line segments and small line segments is recorded and stored in a second array set later. Figure 5 In the figure, the line segment is the original straight line, and the black dots are the position coordinates of the small line segment after being decomposed according to the number of 10ns of the first control period.
[0057] In one embodiment, if Figure 3 As shown, the step S103 includes: steps S301~S304.
[0058] Step S301, setting the marking time as the light emission time;
[0059] Step S302: obtaining the coordinates of the starting point of the line segment and the coordinates of the ending point of the adjacent line segment, or the coordinates of the ending point of the line segment and the coordinates of the starting point of the adjacent line segment, so as to calculate the distance between the line segment and the adjacent line segment;
[0060] Step S303, calculating the light-off time in combination with the marking speed and the distance between the line segment and the adjacent line segment;
[0061] Step S304: storing the light-on time and the light-off time of the laser in the first array.
[0062] When calculating the laser's light-on time, the marking time of the line segment can be directly used as the laser's light-on time, that is, the laser is turned on from the starting point coordinates of the line segment, and the laser is turned off when marking to the ending point coordinates of the line segment. When calculating the laser's light-off time, since there is a blank segment between adjacent line segments, the blank segment does not need to be marked, and the time corresponding to the blank segment can be used as the light-off time. The length of the blank segment can be calculated from the coordinates of the points where the adjacent line segments are close to each other, that is, the starting point coordinates of one line segment and the ending point coordinates of another line segment, or the ending point coordinates of one line segment and the starting point coordinates of another line segment, and then the laser's light-off time is calculated in combination with the marking speed.
[0063] After obtaining the laser light on time and light off time, they are stored in the preset first array timeStepArray, and at the same time, the point coordinates obtained after position decomposition can be stored in the preset second array posArray. However, it should be noted that for each line segment, the first array only records one time, that is, the marking time or light on time, while the second array records multiple point coordinates decomposed according to the first control cycle number step.
[0064] In one embodiment, the step S104 includes:
[0065] Generate a first marking control instruction for laser switch control based on the first array, and generate a second marking control instruction for galvanometer position control based on the second array;
[0066] A first marking control instruction is executed using a preset first control thread, and a second marking control instruction is executed using a preset second control thread; wherein the first control thread and the second control thread run in parallel.
[0067] When generating a marking control instruction according to the first array and the second array, the embodiment generates a first marking control instruction for controlling the laser switch according to the time data stored in the first array, and generates a second marking control instruction for controlling the galvanometer position according to the point coordinates stored in the second array. Subsequently, the first marking control instruction and the second marking control instruction are respectively executed by using the pre-set first control thread and the second control thread, and the first control thread and the second control thread are made to run in parallel.
[0068] In a specific embodiment, the generating of a first marking control instruction for laser switch control based on the first array, and the generating of a second marking control instruction for galvanometer position control based on the second array, include:
[0069] Reading the light-on time and the light-off time in the first array, and controlling the laser to turn on during the light-on time and turn off during the light-off time according to the read sequence, thereby generating the first marking control instruction;
[0070] The result of the position decomposition in the second array is read, and the position of the galvanometer is adjusted according to the result of the position decomposition, so as to generate the second marking control instruction.
[0071] Specifically, the reading of the position decomposition result in the second array and regulating the galvanometer position according to the position decomposition result to generate the second marking control instruction includes:
[0072] Setting a second control period for the second marking control instruction; wherein the second control period is greater than the first control period;
[0073] Acquire a multiple relationship between the second control period and the first control period;
[0074] Based on the multiple relationship, the result of the position decomposition in the second array is read at intervals to generate the second marking control instruction.
[0075] When generating the first marking control instruction according to the first array, it is only necessary to control the laser to turn on or off according to the sequence of the light-on time and the light-off time in the first array. When generating the second marking control instruction according to the second array, firstly, a second control period is set for the second marking control instruction, and the second control period is greater than the first control period, and then the point coordinates stored in the second array are read at intervals according to the multiple relationship between the second control period and the first control period, thereby generating the second marking control instruction.
[0076] In the actual application scenario, the first control cycle is set to 10ns and the second control cycle is set to 10μm, that is, the second control cycle is 1000 times the first control cycle. When the first control thread is running, the time in the first array timeStepArray is read. This time is a value in units of 10ns. For example, if the element in the array is 100, it represents 100 10ns, that is, the total light emission time is 1000ns. The odd elements in timeStepArray represent the laser on, and the even elements represent the laser off. When the second control thread is running, unlike the first control thread that controls the switch laser, the switch laser is controlled according to a 10ns cycle, while the galvanometer position control instruction executed by the second control thread requires a 10us cycle to control. Therefore, when reading data from the second array posArray, the position instruction needs to be read every 1000. In other words, the point coordinates in the posArray array are obtained according to 10ns, but only one thousandth of the data is read to change the control cycle from 10ns to 10us, which is a thousand times different. In this way, the command to control the laser switch can be executed in 10ns, and the command to control the galvanometer position can be executed in 10us. In this way, the control period can be increased from 10us to 10ns, that is, the time control accuracy is increased by 1000 times, which can solve the problem that the existing technology cannot mark extremely short line segments when the high-speed galvanometer is marked due to the use of the 10us control mode.
[0077] In addition, the galvanometer laser marking control method provided in this embodiment has the advantage that only the software algorithm needs to be optimized and adjusted, without any update or upgrade of the existing hardware products. In this way, the performance and function of laser marking can be effectively expanded and improved without increasing any hardware costs. This enables the control method to adapt to and meet the marking needs of more different fields, thereby adding more application scenarios and bringing users a more flexible and extensive use experience.
[0078] In some optional embodiments, when the first control thread and the second control thread are run in parallel to perform a laser galvanometer marking operation, the laser is detected for offset. Of course, before detecting whether an offset occurs, the galvanometer laser marking system is first calibrated, such as adjusting the collimation of the optical system, so that the laser beam propagates along the predetermined optical path as much as possible in the initial state. In addition, a suitable marking sample can be selected, and a standard marking pattern or marking position can be pre-set on the sample. These standard marks can be made by high-precision machining or other precise marking equipment as a reference for subsequent detection of whether the laser is offset.
[0079] Then the offset detection is started, which can be implemented by energy detection method, that is,
[0080] Energy sensor arrays are placed around the marking area. These sensors can be detectors based on the photoelectric effect, such as photodiodes. Before marking, the sensor array is calibrated using a laser beam with a known energy distribution to determine the theoretical energy value corresponding to each sensor position. When the laser is marking, the energy sensor array detects the energy distribution of the laser in real time. If the laser is offset, the energy of the sensor position that should have received high energy will be reduced, while the energy of the sensor that is deviated from the direction will be abnormally increased. By analyzing the changes in energy data collected by the sensor array, it can be determined whether the laser is offset and the direction and approximate degree of the offset. Energy threshold detection can also be used, that is, setting an energy threshold for effective marking. The threshold is determined based on the characteristics of the marking material and the requirements for the marking effect. For example, for a certain plastic material, the laser energy density threshold that can produce a clear mark is 1 joule per square centimeter. During the marking process, the actual energy density of the laser at each position in the marking area is detected. If the laser energy density is lower than the threshold at some positions and higher than the threshold at other positions, and the distribution does not meet the expectations of the normal marking pattern, then it can be determined that the laser is offset.
[0081] In addition, laser offset detection can also be performed based on image processing. Specifically, first of all, a suitable image acquisition device is required, such as a high-resolution industrial camera. The resolution of the camera should be selected according to the accuracy requirements of the laser marking. For example, for micron-level precision marking detection, a camera with a resolution of one million pixels or even higher may be required. The frame rate of the camera is also very important, especially in the dynamic marking process, a higher frame rate (such as hundreds of frames per second) can capture the state of the laser marking moment more clearly. Secondly, determine the installation position of the image acquisition device, that is, the installation position of the camera should be able to fully capture the marking area. Generally, the camera is installed near the laser marking head, and the shooting angle is perpendicular to the marking plane to reduce image distortion. At the same time, care should be taken to avoid direct exposure of the laser to the camera and damage. The camera can be protected by installing a hood or using a filter. It is also necessary to ensure that the lighting conditions meet the acquisition requirements. Good lighting conditions are essential for image acquisition. A uniform backlight or a ring light source can be used to illuminate the marking area. The backlight can highlight the outline of the marking pattern, and the ring light source can reduce shadows and make the details of the marking area clearer. For example, when detecting laser marking on metal surfaces, using a white LED ring light source can effectively enhance the contrast of the image. After completing the pre-acquisition settings, image acquisition begins, and the acquired images are preprocessed, such as grayscale processing, filtering and denoising, and image enhancement. Here, the acquired color images are grayscaled because color information is usually not a key factor when detecting laser offset, and grayscale images can reduce the amount of data and improve the efficiency of subsequent processing. Filtering and denoising is to reduce the interference of environmental factors and the equipment itself on the acquired images. Commonly used filtering methods include median filtering and Gaussian filtering. Image enhancement is to better highlight the marking pattern and detect laser offset. Specifically, histogram equalization can be used to enhance the contrast of the image. Histogram equalization is to adjust the histogram of the image to make the grayscale distribution of pixels more uniform, thereby enhancing the overall contrast of the image. For example, for a marking image with low contrast, after histogram equalization, the edges and details of the marking pattern will be clearer, which is convenient for subsequent feature extraction and offset detection.
[0082] After completing the image preprocessing, the image is subjected to feature extraction. For the marking pattern, the edge is an important feature for detecting the laser offset, so the edge feature extraction can be performed on the captured image, which can be implemented by the Sobel operator or the Canny operator. Among them, the Sobel operator detects the edge by calculating the gradient of the image in the horizontal and vertical directions. It is an edge detection method based on the first-order derivative, and the calculation speed is relatively fast. The Canny operator is a more complex and accurate edge detection method, which includes Gaussian filtering, calculation of gradient amplitude and direction, non-maximum suppression and dual threshold detection and other steps, which can obtain finer and more accurate edges. For example, for marking patterns with clear geometric shapes (such as rectangles and circles), after extracting the edges through the Canny operator, the contour information of the pattern can be accurately obtained.
[0083] In addition to the edge, the geometric features of the marking pattern, such as shape, size, center position, etc., are also important detection features, so the image is further subjected to geometric feature extraction. For simple geometric shapes, their geometric features can be calculated by mathematical formulas. For example, for a circular marking pattern, the radius and center position of the circle can be detected by Hough transform. Hough transform is a parameter space transformation method that converts the circle detection problem in the image space into the parameter space and finds the parameters of the circle through a voting mechanism. For complex shapes, moment features can be used to describe them, such as calculating the zero-order moment and first-order moment of the image to obtain information such as the center position and area of the shape.
[0084] After the feature extraction is completed, it can be determined whether an offset has occurred. Specifically, the template matching method can be used for judgment. That is, a standard marking pattern template is made in advance, which can be an image collected and processed under an ideal marking state. During the detection, the features extracted from the collected marking image are matched with the marking pattern template. For example, the normalized cross correlation (NCC) method is used for matching, and the NCC value is between -1 and 1, that is, the closer the NCC value is to 1, the higher the degree of matching. In this way, by calculating the NCC values of the actual image and the marking pattern template at different positions, the best matching position can be found. If there is a deviation between the best matching position and the preset standard position, then this deviation is the offset of the laser.
[0085] Furthermore, once the offset is detected, the offset needs to be accurately calculated. For marking on a two-dimensional plane, the offset can be determined by calculating the change in the center position of the pattern (obtained through geometric feature extraction) or the position of the feature point. The offset is evaluated based on the marking accuracy requirements. For example, if the marking accuracy requirement is ±0.1mm, and the detected offset exceeds this range, the laser marking equipment needs to be adjusted. At the same time, the distribution of the offset can also be statistically analyzed to analyze whether the laser offset is random or has a certain regularity, so that appropriate measures can be taken to correct the offset.
[0086] Furthermore, after the laser offset is detected, the laser continues to be corrected to ensure the subsequent marking accuracy. First, the offset is quantified, that is, the offset distance, angle offset and other parameters of the laser in the horizontal and vertical directions are determined. For example, by comparing the center position of the actual marking pattern with the center position of the marking pattern template, the pixel offset in the horizontal and vertical directions is calculated, and then converted into the offset in actual length units (such as millimeters) according to the calibration parameters of the camera (the conversion relationship between pixels and actual length). Then the offset pattern is analyzed, that is, it is determined whether the offset is an offset in a fixed direction (such as a certain distance to the upper left each time), a random offset, or an offset that gradually changes over time or the marking process (such as a slow change in the optical path due to equipment heating). This can be achieved by performing statistical analysis on a series of offset data, such as calculating the mean, variance and change trend of the offset.
[0087] After the offset is quantified and the offset mode is determined, the laser marking correction begins. Specifically, the correction can be performed through the optical path reverse compensation algorithm, that is, the angle or displacement that needs to be adjusted is calculated based on the characteristics of the optical system (such as the parameters of the reflector and the lens), and then a command is sent to the motor that controls the laser optical path (such as the motor that controls the angle of the reflector) to adjust the laser optical path in the opposite direction. For example, if the laser adjusts the optical path through a rotatable reflector, then the angle that the reflector needs to rotate can be calculated based on the principle of geometric optics, and the reflector can be driven to rotate by the motor to return the laser to the correct position.
[0088] Alternatively, a model-based prediction and correction algorithm can be used for correction. For example, when the laser offset shows a certain regularity (such as periodic changes or changes related to certain factors), a mathematical model can be established to predict the offset and make corrections. For example, if it is found that the laser offset is related to the device temperature (the laser deflects downward when the temperature rises), a temperature-offset mathematical model can be established. By monitoring the device temperature in real time, the model can be used to predict the laser offset and make corrections in advance. This model can be a linear regression model, a polynomial model, or a more complex neural network model, depending on the actual relationship between the offset and the relevant factors. Correction can also be made by dynamic adjustment, that is, during the continuous marking process, the laser offset may change in real time, and the dynamic adjustment algorithm can be used to update the correction strategy in time according to the offset detected each time. For example, an adaptive filtering algorithm is used to continuously adjust the filter parameters according to the new offset data to make the correction more accurate. At the same time, in order to avoid oscillation problems caused by overcorrection, the software can set the correction step size and threshold. When the offset is small, a smaller correction step size is used; when the offset exceeds a certain threshold, a larger correction is performed.
[0089] After the offset correction is completed, the corresponding correction instructions can be sent to the hardware device to drive the hardware device to perform the correction operation. The format and communication protocol of the instructions must match the control system of the laser marking device. For example, if the reflector adjustment motor of the laser marking device is controlled by serial communication, the software must generate instructions containing information such as the motor rotation angle or displacement according to the serial communication protocol and send it to the corresponding serial port. After sending the correction instruction, wait for feedback from the hardware device to confirm whether the correction operation is completed and whether the expected effect is achieved. If the hardware device feedback correction fails or the corrected offset still does not meet the requirements, it is necessary to re-analyze the offset data, adjust the correction strategy, and send instructions again for correction. For example, if the motor fails when executing the instruction to adjust the reflector angle, after receiving the fault feedback, the user is prompted to check the motor or take other alternative correction measures.
[0090] Specifically, when the adaptive filtering algorithm is used for correction, the basic parameters of the adaptive filtering algorithm are first set, such as the order of the filter, the initial weight vector of the filter, and the step size parameter.
[0091] The order of the filter determines the length of historical data considered by the filter. For example, for a simple linear adaptive filter, the order means that the filter will consider the five most recent offset data points. For the initial weight vector of the filter, it is usually initialized to a small random value or an all-zero vector. This weight vector will be continuously updated in the subsequent filtering process to adapt to the changes in the laser offset. The step size parameter controls the speed at which the filter weights are updated. If the step size is too large, the filter may not converge or may become unstable; if the step size is too small, the filter will converge very slowly. Therefore, the appropriate value can be determined through experiments based on the actual situation, such as trying it first in the test phase.
[0092] After setting the basic parameters, start acquiring laser offset data. In order to ensure the accuracy and consistency of the data, the acquisition frequency of the laser offset data can be increased so that the dynamic changes of the laser offset can be reflected in a timely manner. For example, in the process of high-speed laser marking, the data acquisition frequency may need to reach dozens of times per second. Then enter the filtering calculation stage, set the acquired laser offset data x(n) as the input vector X(n), if the filter order N=3, assuming that three consecutive offset data x(n-2), x(n-1) and x(n) have been collected, then the input vector X(n)=[x(n-2),x(n-1),x(n)] T , T represents the transpose of the vector.
[0093] Next, the filtered output y(n) is calculated based on the current filter weight vector w(n) and the input vector X(n). For a linear adaptive filter, the calculation formula for the filtered output is y(n)=w(n) T X(n). This output y(n) can be seen as an estimate of the laser offset, which is calculated based on the historical offset data and the current weight vector. Therefore, the error e(n) between the estimated value y(n) and the actual desired corrected offset (usually the corrected offset is expected to be zero) is calculated. The error calculation formula is e(n)=d(n)-y(n), where d(n) is the desired output. Here, because we want to correct the laser offset, we set d(n)=0.
[0094] Then, the weight vector W(n+1) of the filter is updated according to the error e(n) and the input vector X(n). The update formula is W(n+1)=W(n)+μe(n)X(n), where W(n) represents the initial weight vector and μ represents the step size. The formula indicates that: according to the current error, the weight vector is adjusted according to the step size so that the next filtering output can be closer to the desired output (i.e., the laser offset is corrected more accurately). Preferably, in the process of updating the weight vector, the weight is constrained to prevent the weight from being too large or too small, resulting in poor filtering effect or unstable algorithm. For example, the upper and lower limits of the weight can be set. At the same time, the stability of the filter can also be checked regularly by observing the changing trend of the weight vector and whether the error sequence converges. If it is found that the weight vector fluctuates violently or the error does not converge, it may be necessary to adjust the step size or the filter order.
[0095] After completing the laser marking offset correction, record the offset, including the horizontal and vertical offset distance, angle offset, etc., as well as the frequency of the offset. And by analyzing the recorded data, it can be determined whether the laser offset is caused by short-term fluctuations in the equipment (such as unstable power supply) or long-term looseness of the mechanical structure. Then adjust the laser marking equipment according to the recorded offset and analysis results. For example, if it is a slight offset, you only need to use the fine-tuning device of the equipment (such as adjusting the angle of the reflector) to correct the laser light path. For more serious offsets or offsets caused by wear of equipment components, it may be necessary to replace related components (such as damaged focusing lenses) and then re-calibrate the entire equipment to ensure that the laser marking quality meets the requirements.
[0096] Figure 6 A galvanometer laser marking control device 600 provided in an embodiment of the present invention includes:
[0097] A vector map acquisition unit 601 is used to acquire a vector map to be marked and construct a marking line segment set based on the vector map;
[0098] A position decomposition unit 602 is used to obtain marking parameters, and perform position decomposition on the marking line segment set according to the marking parameters to obtain a position decomposition result;
[0099] An array storage unit 603 is used to calculate the light-on time and the light-off time of the laser according to the result of the position decomposition, and use a preset first array to store the light-on time and the light-off time, and use a preset second array to store the result of the position decomposition;
[0100] The marking control unit 604 is used to generate a marking control instruction based on the first array and the second array, and perform a laser galvanometer marking operation according to the marking control instruction.
[0101] In one embodiment, the vector graph acquisition unit 601 includes:
[0102] A coordinate acquisition unit, used for setting marking points based on the vector diagram and acquiring coordinate information of the marking points;
[0103] A line segment forming unit, used for forming a line segment by forming two adjacent marking points into a line segment, so as to obtain a line segment set including a plurality of line segments;
[0104] A set construction unit is used to combine the coordinate information of the marking points and the line segment set to construct the marking line segment set.
[0105] In one embodiment, if Figure 7 As shown, the position decomposition unit 602 includes:
[0106] A length calculation unit 701, used to calculate the length of the line segment according to the coordinate information of the marking point;
[0107] The time calculation unit 702 is used to obtain marking parameters, and calculate the marking time of each line segment in combination with the marking parameters and the length of the line segment; wherein the marking parameters include the marking speed and a preset first control period;
[0108] A number confirmation unit 703, used to confirm the number of first control cycles required for the corresponding line segment according to the marking time;
[0109] The line segment decomposition unit 704 is used to decompose the line segment based on the number of the first control cycles.
[0110] In one embodiment, if Figure 8 As shown, the array storage unit 603 includes:
[0111] A light emitting setting unit 801, used to set the marking time to the light emitting time;
[0112] A distance calculation unit 802 is used to obtain the coordinates of the starting point of the line segment and the coordinates of the ending point of the adjacent line segment, or the coordinates of the ending point of the line segment and the coordinates of the starting point of the adjacent line segment, so as to calculate the distance between the line segment and the adjacent line segment;
[0113] A light-off calculation unit 803, configured to calculate the light-off time by combining the marking speed and the distance between the line segment and an adjacent line segment;
[0114] The time storage unit 804 is used to store the light-on time and the light-off time of the laser in the first array.
[0115] In one embodiment, the marking control unit 604 includes:
[0116] An instruction generating unit, configured to generate a first marking control instruction for laser switch control based on the first array, and to generate a second marking control instruction for galvanometer position control based on the second array;
[0117] The instruction execution unit is used to execute a first marking control instruction using a preset first control thread, and to execute a second marking control instruction using a preset second control thread; wherein the first control thread and the second control thread run in parallel.
[0118] In one embodiment, the instruction generation unit includes:
[0119] A first reading unit is used to read the light-on time and the light-off time in the first array, and control the laser to turn on during the light-on time and turn off during the light-off time according to the reading sequence, so as to generate the first marking control instruction;
[0120] The second reading unit is used to read the result of the position decomposition in the second array, and adjust the position of the galvanometer according to the result of the position decomposition, so as to generate the second marking control instruction.
[0121] In one embodiment, the second reading unit includes:
[0122] A cycle setting unit, used to set a second control cycle for the second marking control instruction; wherein the second control cycle is greater than the first control cycle;
[0123] A relationship acquisition unit, used to acquire a multiple relationship between the second control period and the first control period;
[0124] The interval reading unit is used to perform interval reading on the result of the position decomposition in the second array based on the multiple relationship, so as to generate the second marking control instruction.
[0125] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0126] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0127] The embodiment of the present invention also provides a computer device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the computer device may also include various network interfaces, power supplies and other components.
[0128] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
[0129] It should also be noted that, in this specification, 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 "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or 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 device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A galvanometer laser marking control method, characterized in that: include: Obtain a vector map to be marked, and construct a marking line segment set based on the vector map; Obtaining marking parameters, and performing position decomposition on the marking line segment set according to the marking parameters to obtain a position decomposition result; wherein the marking parameters include a marking speed and a preset first control period; According to the result of the position decomposition, the light-on time and the light-off time of the laser are calculated, and the light-on time and the light-off time are stored in a preset first array, and the result of the position decomposition is stored in a preset second array; Generate a marking control instruction based on the first array and the second array, and perform a laser galvanometer marking operation through the marking control instruction; The generating of a marking control instruction based on the first array and the second array, and performing a laser galvanometer marking operation through the marking control instruction, includes: Generate a first marking control instruction for laser switch control based on the first array, and generate a second marking control instruction for galvanometer position control based on the second array; Executing a first marking control instruction using a preset first control thread, and executing a second marking control instruction using a preset second control thread; wherein the first control thread and the second control thread run in parallel; The generating of a first marking control instruction for laser switch control based on the first array, and the generating of a second marking control instruction for galvanometer position control based on the second array, include: Reading the light-on time and the light-off time in the first array, and controlling the laser to turn on during the light-on time and turn off during the light-off time according to the read sequence, thereby generating the first marking control instruction; Reading the result of the position decomposition in the second array, and regulating the position of the galvanometer according to the result of the position decomposition, so as to generate the second marking control instruction; The step of reading the result of the position decomposition in the second array and adjusting the position of the galvanometer according to the result of the position decomposition to generate the second marking control instruction includes: Setting a second control period for the second marking control instruction; wherein the second control period is greater than the first control period; Acquire a multiple relationship between the second control period and the first control period; Based on the multiple relationship, the result of the position decomposition in the second array is read at intervals to generate the second marking control instruction.
2. The galvanometer laser marking control method according to claim 1, characterized in that: The step of obtaining a vector diagram to be marked and constructing a marking line segment set based on the vector diagram includes: Setting marking points based on the vector diagram and obtaining coordinate information of the marking points; Combining two adjacent marking points into a line segment to obtain a line segment set including a plurality of line segments; The marking line segment set is constructed by combining the coordinate information of the marking points and the line segment set.
3. The galvanometer laser marking control method according to claim 2, characterized in that: The obtaining of marking parameters and performing position decomposition on the marking line segment set according to the marking parameters to obtain a position decomposition result includes: Calculating the length of the line segment according to the coordinate information of the marking point; Obtaining marking parameters, and calculating the marking time of each line segment by combining the marking parameters and the length of the line segment; Determine the number of first control cycles required for the corresponding line segment according to the marking time; The line segment is decomposed based on the first number of control cycles.
4. The galvanometer laser marking control method according to claim 3, characterized in that: The step of calculating the laser light-on time and the laser light-off time according to the result of the position decomposition, storing the laser light-on time and the laser light-off time in a preset first array, and storing the result of the position decomposition in a preset second array includes: Setting the marking time to the light emission time; Obtaining the coordinates of the starting point of the line segment and the coordinates of the ending point of the adjacent line segment, or the coordinates of the ending point of the line segment and the coordinates of the starting point of the adjacent line segment, thereby calculating the distance between the line segment and the adjacent line segment; The light-off time is calculated by combining the marking speed and the distance between the line segment and an adjacent line segment; The light-on time and light-off time of the laser are stored in the first array.
5. A galvanometer laser marking control device, characterized in that: include: A vector map acquisition unit, used to acquire a vector map to be marked, and construct a marking line segment set based on the vector map; A position decomposition unit, used to obtain marking parameters, and perform position decomposition on the marking line segment set according to the marking parameters to obtain a position decomposition result; wherein the marking parameters include a marking speed and a preset first control period; An array storage unit, used to calculate the light-on time and the light-off time of the laser according to the result of the position decomposition, and use a preset first array to store the light-on time and the light-off time, and use a preset second array to store the result of the position decomposition; A marking control unit, used for generating a marking control instruction based on the first array and the second array, and performing a laser galvanometer marking operation according to the marking control instruction; The marking control unit comprises: An instruction generating unit, configured to generate a first marking control instruction for laser switch control based on the first array, and to generate a second marking control instruction for galvanometer position control based on the second array; An instruction execution unit, configured to execute a first marking control instruction using a preset first control thread, and execute a second marking control instruction using a preset second control thread; wherein the first control thread and the second control thread run in parallel; The instruction generation unit comprises: A first reading unit is used to read the light-on time and the light-off time in the first array, and control the laser to turn on during the light-on time and turn off during the light-off time according to the reading sequence, so as to generate the first marking control instruction; A second reading unit is used to read the result of the position decomposition in the second array, and adjust the position of the galvanometer according to the result of the position decomposition, so as to generate the second marking control instruction; The second reading unit comprises: A cycle setting unit, used to set a second control cycle for the second marking control instruction; wherein the second control cycle is greater than the first control cycle; A relationship acquisition unit, used to acquire a multiple relationship between the second control period and the first control period; The interval reading unit is used to perform interval reading on the result of the position decomposition in the second array based on the multiple relationship, so as to generate the second marking control instruction.
6. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the galvanometer laser marking control method as claimed in any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the galvanometer laser marking control method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Marking method and device of laser marking machine
CN105855719A
High-speed laser processing discontinuity line closed-loop control method and device
CN108098138A
Laser marking machine control method and device and readable storage medium
CN108161241A
Laser marking method, device and equipment and storage medium
CN116262303A