About the development of applied software for mechatronic systems of SLM technology

. The article describes the structure of the created software package for mechatronic systems that implements the technology of selective laser melting (SLM). One of the part of this software package is a software platform for solving machine vision tasks. Examples of several problems solved using the software platform are given. The solution to deﬁne the geometry and location of a metal sheet is considered in detail. The developed algorithm is used to solve the task of determining the geometry of the melted layer, the results of which will later be used for layer-by-layer reconstruction of the geometry of the manufactured part. The presented software platform was developed to implement analysis and control functions within the application software for implementing in SLM technology, however, as a result, the created software platform has received a wider range of applications.


Introduction
SLM (Selective Laser Melting) is an innovative technology to manufacture of products of complex shapes and structures from metal and ceramic powders using mathematical models of automated design systems.This process consists in sequential layer-by-layer melting of a powder material using powerful laser radiation and is used, for example, in medicine [1], aircraft construction [2], and mechanical engineering.
The mechatronic system for high-precision control of industrial equipment of the ML6 series, created by the group of companies "Lasers and Apparatus TM" for the implementation of selective laser melting process, combines mechanical elements, electrical parts, electronics, microprocessors and software.During development of software for mechatronic systems of SLM technology, the following program blocks have been created to date: 1. Calculation of the temperature distribution during the manufacturing process.
3. Calculation of the stress-strain state of the part and minimization of the resulting stresses.
4. Automation of the process of selecting the parameters of the technological process.
5. Creation of a control program for an installation with numerical control (CNC-Computer Numeric Control).
6. Analysis of visual data and control of the manufacturing process using machine vision algorithms.
In this work, we will make point in details on the consideration of the software platform that implements machine vision algorithms in the development of SLM technology.
Usage of software for CNC machines shows that it is often required to solve control and analysis problems using machine vision methods.Moreover, these are often problems, the solution of which allows the use of explicit linear algorithms.Examples of such tasks are following: finding a QR code or barcode, determining the position, number and quality of holes after perforation of material, determining the geometry of the working blade, controlling the quality of the seam, determining the geometry of flat products or products made by selective laser fusion SLM.
To reduce labor costs for solving a class of similar problems, we set a goal to create a software platform that would collect previously implemented image filters, and image analysis tools, allowing them to combine into solving specific problems.Such a platform should enable process engineers to solve machine vision problems without requiring programming skills, as well as provide a wide range of tools for software developers.Such software tools are well in use for today, many foreign companies provide their solutions, such as Microsoft with the Azure Computer Vision product, Google with the Google Cloud Vision API, IBM with Watson Visual Recognition.Most of these solutions provide a programming interface such as the OpenCV libraries [4][5][6] for use in third-party software solutions.This makes it very difficult to use such tools for specialists without the necessary programming skills.A slightly different approach is taken by Cognex Corporation, a US manufacturer of machine vision systems, software and sensors used in automated manufacturing to inspect and identify parts, detect defects, verify product assembly, and guide assembly robots.This company offers not only separate solutions for machine vision, but also a visual development environment (figure 1) for using these tools in their own solution.We set ourselves the goal of implementing a similar environment with an emphasis on accessibility and ease of use.

Software platform and common approach
The software platform we are developing has already been partially implemented (figure 2).

Figure 2. User interface of developed machine vision platform
Using this software platform user can collect data from various sources and perform processing sequence using various image-processing filters (figure 3), conduct analysis using prepared software tools.The images contain a lot of debugging information, but the general principle of operation is already visible.Using the function of establishing a connection, a connected directed graph is formed, along which the system subsequently transmit data from sources to filters and further along the sequence specified by the user.The absence of cycles in the decision graph is only requirement for this construction to work.

Examples of platform operation. Videorecording
One of the capabilities implemented by the platform is interaction with various camera models.In particular, the use of Basler matrix cameras (figure 4) was tested, which are mainly used in industrial automation, traffic monitoring, retail, as well as medicine and biological sciences.
Further, the data from the camera used for subsequent analysis or video recording of the studied processes (figure 5).The use of machine vision cameras allows you to monitor processes in environments inaccessible to the observer.One of the most common task in machine vision is object recognition.One of the common case of such task in industry is finding a sheet in the working field of the machine.Let's consider one of the options for solving a similar problem using the capabilities of the platform under consideration.We use a Basler matrix camera as a data source.Sheets can be located in different places of the working area, have different shapes and consist of different materials, so it is supposed to start by looking for abstract objects in the image.To do this, various image comparison filters are possible to use.The idea behind the approach is simple: get an image of an empty workspace, then get a new image of the same area with the sheet already positioned and identify its location by comparing it with the original image (figure 6).
Distortion is clearly visible in both photographs.Distortion caused by using a wide angle lens.It is often not possible to select lenses and position the aperture diaphragm in the optical scheme.In this case, mathematics comes to our aid and another distortion correction filter was implemented in the platform (figure 7).The filter is based on an expression of the form: where � R-coordinate vector after transformation; � r-coordinate vector before transformation; � b 0 -linear magnification factor; F 3 , F 5 , F 7 -distortion coefficients.
To maintain image dimensions, the linear magnification factor is calculated automatically, thus it is not necessary to define it manually.The distortion correction is seen on the straightened pallet blades (figure 7).
Next, using one of the filter options that determine the difference between the two images, compare the area with a sheet and the same area without a sheet and find the desired object in the image.For color images, there are several similar approaches, which are based on and the Minkowski metric Obviously, both metrics give the same distance for a grayscale image.The value of threshold for filtering pixels is selected using the materials of objects and lighting.
Further, we find the angles in the image using various implementations of the algorithms for determining the angles [7][8][9][10].The resulting angles will define the geometry of the de- Now we collect our corners into geometry contours; for this, the platform implements a clockwise and counterclockwise traversal algorithm.The idea of this algorithm is simple: we take the upper left unused corner from the list of defined ones.If the top pixel is dark, then we go counterclockwise, if it is light, then we go clockwise.Thus, we divide the contours into external and internal (figure 8).The traversal continues until we come back to begin, that means contour is closed.All pixels from the list of corners encountered along the way make up the found contour (figure 9).
The quality of the obtained result depends on the quality of the image, lighting and the accuracy of the selection of processing parameters.The same approach is in use to find the geometry of the melted layer in the SLM process.The preview image is a photo of the previous layer.The new image is a photo of the next melted layer (figure 10).
The further recognition process is identical to that described earlier.In fact captured images acquired using parsing of video stream.This recording was made using regular camera.Neither special lenses nor matched lighting were used.The camera was not fixed during shooting.Even under all the above conditions, it was possible to successfully recognize the contours of the product.

Conclusion
The basis of a new software platform to solve machine vision problems has been made.Using this software platform several tasks have been solved, for example, the tasks of recognizing a flat object, providing video recording of the production process, determining the holes on the workpiece have been solved.The task of recognizing the geometry of the product obtained using SLM process has been partially solved.The presented software platform created to implement the analysis and control functions within the application software for mechatronic systems of equipment that implements SLM technology, but as a result, the resulting platform found a wider range of applications.Our work continues on the development of a software platform and a software package to support SLM technology, in the process of solving tasks of tracking the layer and autofocusing of optical systems.

Figure 3 .
Figure 3. Sequence of image processing

Figure 6 .Figure 7 .
Figure 6.Images of working area: (a) without metal sheet; (b) with metal sheet

Figure 9 .
Figure 9.The desired contour highlighted in yellow from the list of all contours

Figure 10 .
Figure 10.Recognition of layers by image frame of a video stream: (a) initial image; (b) recognized image