Development of an Intra-Layer Adaptive Toolpath Generation Control Procedure in the Laser Metal Wire Deposition Process

Recently developed concentric laser metal wire deposition (LMWD) heads allow metal addition processes which are independent of the deposition direction, thus enabling complex paths to be generated. The sensitivity of the process to height deviations has experimentally been observed to be greater with this type of head than with powder ones, therefore requiring more precise and local process control algorithms to be implemented. This work developed a methodology for measuring the part, layer by layer, using a 3D scanner based on structured laser light. Height corrections were applied to the mean and intra-layer height deviations by recalculating the deposition trajectories of the next layer to be deposited. Local height deviations were adjusted by varying the scanning speed, thus increasing the feed rate in the lower areas and decreasing it in the higher ones. Defects generated in the purpose, with height differences within the layer, were successfully corrected. A flat layer was re-established through the application of the control strategy. The internal integrity of the parts due to the scanning speed variation was analyzed, resulting in fully dense parts. The structured light measurement and height correction systems are found to be an affordable and time-efficient solution that can be integrated into an LMWD environment, thereby improving the process robustness.


Introduction
Laser metal deposition (LMD) is an additive manufacturing (AM) technique in which a high-power laser melts a filler material in the form of powder or wire, resulting in layer-by-layer manufacturing along a predefined robot or machine path [1].
AM allows near net-shape components to be produced for specific sectors in a process which is costly. In contrast to subtractive techniques, the amount of raw material required for manufacturing is close to the volume of the final part, requiring only subsequent finish machining to reach the final shape. This characteristic arouses the interest of sectors such as aeronautics or aerospace, in which expensive materials such as titanium and nickel-base alloys are often used. These geometries require either heavy machining operations with high amounts of wasted material [2,3] or costly forging operations prior to machining. The addition of material in wire form means that 100% of the material introduced is melted, resulting in a more efficient, safe, and clean process than in the case of powder LMD. As wire is cheaper than powder, the laser metal wire deposition (LMWD) process is also more cost-efficient [4].
However, there are process robustness barriers that need to be overcome before AM systems are suitable for use in industrial environments. Due to the large number of variables that are handled in the process, it is often difficult to detect the cause of a process failure that may compromise the internal quality of a part and even more so if the failure is the result of a combination of causes. Therefore, new developments in the field of process monitoring and control are still necessary before it is appropriate to incorporate AM technologies into industrial settings [5].
Reviews of different LMD monitoring and control methods have been presented [6,7]. Some authors attempt to maintain process stability by employing vision cameras [8][9][10][11][12][13]. By placing a coaxial camera on the deposition head, it is possible to obtain a measurement independent of the deposition direction. In this way, it is possible to monitor the size of the molten pool and control it by varying input parameters such as power or scanning speed. The correct choices for the measurement wavelength range of the camera and filters arranged in the optical path are critical aspects to obtain a suitable measurement.
LMWD introduces some differences with respect to powder LMD that require a better understanding of the process and new developments regarding in-process control. Some laser welding and repairing heads insert the wire laterally at a defined angle to the processing laser, although this same configuration has also been used to grow parts of simple geometry layer by layer [14]. However, generating geometries with direction changes requires independence in the deposition direction. Wu et al. [15] presented an approach for achieving deposition direction independence in which the welding torch rotated according to the deposition direction in a process of wire arc additive manufacturing (WAAM). Some recently developed LMWD heads [16][17][18][19][20] solve the direction dependence issue by inserting the wire perpendicular to the substrate, so the laser beam is divided within the head and then refocused on the working plane. This introduces the additional complexity of accurately reconstructing the laser beam. Due to the angle of the divided beams with respect to the vertical, the shape of the laser spot changes significantly when varying the working distance. Furthermore, while the defocusing effect is important in powder deposition [21], it is critical in the case of LMWD. Motta and Demir [17] described the issues concerning height deviation using a high-speed vision camera. Defects were observed such as stubbing when the working distance was too small and dripping when it was too large. For this reason, control of the distance between head and part is essential to maintain constant laser power distribution in the working plane and avoid process failures.
By placing a camera off-axis, it is possible to obtain geometric information such as the height of the bead, or the relative position of the robot with respect to the part [22][23][24]. In this way, online corrections of the deposition parameters or the position of the head can be made. However, the cases in which this type of control have been applied are simple geometries, such as single-track walls, and the measurement can give rise to great differences in the case of solid parts with overlapping filling patterns. Donadello et al. [25] developed a novel system of coaxial camera and laser projection which estimated the height of the piece by triangulation. This allowed a measurement of the height during deposition, although the accuracy for more complex geometries was not verified.
In other cases, metrological systems based on triangulation have been investigated. Buhr et al. [26] studied the influence of thermal radiation on the accuracy of the measurements in a line scanner placed on the head and reached the conclusion that, due to the high light emissions of the process, current measurement systems cannot perform accurate measurements during continuous deposition. Interruption of the process makes the precision of the scanner measurement higher than in the case of vision cameras and it is applicable to any geometry. Heralić et al. [27] also introduced a laser line scanner to obtain the height profile of the deposited piece and calculated the wire input for the next layer.
In this work, a structured light-based scanning technology was employed. A sequence of laser light patterns was projected onto the part and a camera calculated the distance to each point by triangulation. The advantage over a laser line scanning system is that the measurement can be made from an external fixed position without the need to introduce an extra movement, which adds Materials 2019, 12, 352 3 of 13 complexity to the system and decreases its accuracy. The developed control strategy complements the work in [28], where a height control strategy based on the recalculation of the deposition trajectories according to the mean height of the previously deposited layer was presented. This paper presents a novel methodology to apply local corrections within the layer, based on the dynamic variation of the scanning speed as a function of the height of each region. The effectiveness of the system was evidenced by the successful correction of induced local defects.

Description of the laser metal wire deposition (LMWD) Equipment
The LMWD cell of Figure 1 was used for the implementation of this work. The processing laser was a 4 kW Ytterbium Laser System YLS4000 (IPG Photonics, Oxford, MA, USA) and the deposition movement was achieved by an IRB4400 robot (ABB, Zurich, Switzerland). 316LSi stainless steel filler material (Lincoln Electric, Cleveland, OH, USA) in the form of 0.8 mm diameter wire was introduced by means of a wire feeder (DINSE G.m.b.H., Hamburg, Germany). The deposition head was a COAXwire (Fraunhofer IWS, Dresden, Germany), which divides the main laser beam into three beams and then focuses them again on the working plane [16]. The result is a direction-independent deposition. The 3D measurement was acquired by means of a Phoxi 3D structured light scanner (Photoneo, Bratislava, Slovakia). The distance between the scanner and the robot positioner was set at 1239 mm as the optimum value recommended by the manufacturer. The point-to-point spacing at this distance was 0.524 mm, considered as adequate for the size of the deviations in the LMWD process. The angle of the scanner with respect to the vertical was fixed at 30 • in order to obtain the correct scanning of the upper part of the piece and to avoid collisions with elements of the head. the work in [28], where a height control strategy based on the recalculation of the deposition trajectories according to the mean height of the previously deposited layer was presented. This paper presents a novel methodology to apply local corrections within the layer, based on the dynamic variation of the scanning speed as a function of the height of each region. The effectiveness of the system was evidenced by the successful correction of induced local defects.

Description of the laser metal wire deposition (LMWD) Equipment
The LMWD cell of Figure 1 was used for the implementation of this work. The processing laser was a 4 kW Ytterbium Laser System YLS4000 (IPG Photonics, Oxford, MA, USA) and the deposition movement was achieved by an IRB4400 robot (ABB, Zurich, Switzerland). 316LSi stainless steel filler material (Lincoln Electric, Cleveland, OH, USA) in the form of 0.8 mm diameter wire was introduced by means of a wire feeder (DINSE G.m.b.H., Hamburg, Germany). The deposition head was a COAXwire (Fraunhofer IWS, Dresden, Germany), which divides the main laser beam into three beams and then focuses them again on the working plane [16]. The result is a direction-independent deposition. The 3D measurement was acquired by means of a Phoxi 3D structured light scanner (Photoneo, Bratislava, Slovakia). The distance between the scanner and the robot positioner was set at 1239 mm as the optimum value recommended by the manufacturer. The point-to-point spacing at this distance was 0.524 mm, considered as adequate for the size of the deviations in the LMWD process. The angle of the scanner with respect to the vertical was fixed at 30° in order to obtain the correct scanning of the upper part of the piece and to avoid collisions with elements of the head. Prior to deposition, the measuring system must be calibrated to align the scanner coordinate system with the robot's coordinate system. In this procedure, the points of the target pattern are detected both by vision by the scanner and by touching the points with the robot. With the points referred to in the robot coordinate system, P Robot , and scanner, P Scanner , the transformation matrix T is calculated (Equation 1). This matrix is applied to all the points of the subsequent scans, also referring the scan points to the robot coordinate system. Prior to deposition, the measuring system must be calibrated to align the scanner coordinate system with the robot's coordinate system. In this procedure, the points of the target pattern are detected both by vision by the scanner and by touching the points with the robot. With the points referred to in the robot coordinate system, P Robot , and scanner, P Scanner , the transformation matrix T is calculated (Equation (1)). This matrix is applied to all the points of the subsequent scans, also referring the scan points to the robot coordinate system. The wire feeding was also monitored continuously by means of a Genie Nano C1940 CMOS vision camera (Teledyne DALSA, Waterloo, ON, Canada) placed laterally and equipped with a visible bandpass filter, a neutral filter, and LED illumination of the work area.

Height Control Methodology
The correction strategy developed calculated the deposition trajectories layer by layer based on the height profile measured in the previously deposited layer. After the deposition of the layer, the process was stopped and the upper surface of the part was scanned. Due to the calibration procedure, the coordinates of the obtained point cloud referred to the same working coordinate system as that of the robot, so height corrections could be applied at their precise location.
In order to reduce the size of the acquired point clouds, in a first step, the points outside the work volume were removed. This reduced point processing time and therefore the stop time between layers.
Based on this scan the trajectories of the next layer were defined. In this case, the procedure of stopping the process, scanning the part, and calculating trajectories was applied for each individual layer.
A representation of the height deviation of a layer is illustrated in Figure 2a. When a layer is to be deposited, the approximate growth of the layer is known, hence the height that the part should reach after deposition is referred to as theoretical height, h t . However, the growth of the part will not necessarily match the theoretical height, so there is an error between the scanned layer height profile, h s , and the theoretical height (Equation (2)).
Materials 2018, 11, x FOR PEER REVIEW 4 of 12 The wire feeding was also monitored continuously by means of a Genie Nano C1940 CMOS vision camera (Teledyne DALSA, Waterloo, ON, Canada) placed laterally and equipped with a visible bandpass filter, a neutral filter, and LED illumination of the work area.

Height Control Methodology
The correction strategy developed calculated the deposition trajectories layer by layer based on the height profile measured in the previously deposited layer. After the deposition of the layer, the process was stopped and the upper surface of the part was scanned. Due to the calibration procedure, the coordinates of the obtained point cloud referred to the same working coordinate system as that of the robot, so height corrections could be applied at their precise location.
In order to reduce the size of the acquired point clouds, in a first step, the points outside the work volume were removed. This reduced point processing time and therefore the stop time between layers.
Based on this scan the trajectories of the next layer were defined. In this case, the procedure of stopping the process, scanning the part, and calculating trajectories was applied for each individual layer.
A representation of the height deviation of a layer is illustrated in Figure 2a. When a layer is to be deposited, the approximate growth of the layer is known, hence the height that the part should reach after deposition is referred to as theoretical height, h t . However, the growth of the part will not necessarily match the theoretical height, so there is an error between the scanned layer height profile, h s , and the theoretical height (Equation 2). In order to avoid excessive corrections on the part that could lead to faults, the error is divided into a mean, e m , and intra-layer, e l , height error. The mean error is the difference between the mean height of the scanned layer, h m , and the theoretical height, whereas the local error represents the deviation of the scanned height profile with respect to the mean height: The control strategy is therefore applied to the height deviation in two steps: Local intra-layer height correction Each correction strategy will be explained in the following sections.

Mean Height Correction
The mean height correction based on the robot position adjustment without considering the CAD of the part results in large differences between the theoretical and built geometries, especially In order to avoid excessive corrections on the part that could lead to faults, the error is divided into a mean, e m , and intra-layer, e l , height error. The mean error is the difference between the mean height of the scanned layer, h m , and the theoretical height, whereas the local error represents the deviation of the scanned height profile with respect to the mean height: The control strategy is therefore applied to the height deviation in two steps: • Mean height correction • Local intra-layer height correction Each correction strategy will be explained in the following sections. The mean height correction based on the robot position adjustment without considering the CAD of the part results in large differences between the theoretical and built geometries, especially in parts with complex shape [29]. Therefore, a control strategy based on the recalculation of the deposition trajectories applied in this work results in a more accurate reproduction of the theoretical geometry (CAD model).
In order to perform the mean height correction considering the geometry of the part and the scanned data, the same procedure was used as in Reference [28], where the CAD model, in STL format, of the complete part was sliced from the mean measured height to the next height to be reached after deposition of the following layer ( Figure 2b). As in this work, only one layer was deposited between scans and the height of the volume to be deposited corresponded to the theoretical layer height. Then, the deposition trajectories of this STL slice were generated using a tool developed in-house [30]. Figure 3a shows the deposition path of a layer together with the scanned point cloud. The deposition pattern consisted of a zig-zag that rotated 90 degrees each layer and one external perimeter. in parts with complex shape [29]. Therefore, a control strategy based on the recalculation of the deposition trajectories applied in this work results in a more accurate reproduction of the theoretical geometry (CAD model).
In order to perform the mean height correction considering the geometry of the part and the scanned data, the same procedure was used as in Reference [28], where the CAD model, in STL format, of the complete part was sliced from the mean measured height to the next height to be reached after deposition of the following layer ( Figure 2b). As in this work, only one layer was deposited between scans and the height of the volume to be deposited corresponded to the theoretical layer height. Then, the deposition trajectories of this STL slice were generated using a tool developed in-house [30]. Figure 3a shows the deposition path of a layer together with the scanned point cloud. The deposition pattern consisted of a zig-zag that rotated 90 degrees each layer and one external perimeter.

Local Intra-Layer Height Correction
During experimental work it was found that the mean height correction applied to the whole layer was not sufficient to guarantee the homogeneous and robust growth of the piece. Besides the process parameters commonly referred to, such as power, scanning speed, or wire feed rate, part growth can be affected by other factors such as part heating and cooling rate in different zones, part geometry, or the dynamic precision of the robot in its movements. The importance of each of these factors is often mixed and it is difficult to distinguish their effect on the final result. This paper does not attempt to study the cause of height deviations but rather presents a methodology to control local deviations within the layer regardless of their origin.
The purpose of intra-layer height correction is to introduce more material into areas where the height is insufficient and less material where height is excessive. The principal alternatives for varying the material feed rate in different areas in LMWD are to vary the wire feeding speed or the machine (or robot) scanning speed. In this case, the choice made by the authors was to change the scanning speed, exploiting the ability to modify the deposition trajectories of the subsequent layers to be deposited. As a combined correction of the mean and local height of the layer was applied, the local intra-layer correction was based on deviations with respect to the mean height, giving rise to smoother corrections.
The deposition paths consist of linear point-to-point movements, which constitute the matrix of M coordinates with the consecutive points of the robot movement: To introduce local corrections, the linear movements are discretized by the insertion of intermediate points. The discretization of the trajectory is illustrated in Figure 3b, with the representation of two consecutive points, m i and m i+1 , before and after the insertion of the intermediate points. The distance between points is calculated according to a value, d, entered by the

Local Intra-Layer Height Correction
During experimental work it was found that the mean height correction applied to the whole layer was not sufficient to guarantee the homogeneous and robust growth of the piece. Besides the process parameters commonly referred to, such as power, scanning speed, or wire feed rate, part growth can be affected by other factors such as part heating and cooling rate in different zones, part geometry, or the dynamic precision of the robot in its movements. The importance of each of these factors is often mixed and it is difficult to distinguish their effect on the final result. This paper does not attempt to study the cause of height deviations but rather presents a methodology to control local deviations within the layer regardless of their origin.
The purpose of intra-layer height correction is to introduce more material into areas where the height is insufficient and less material where height is excessive. The principal alternatives for varying the material feed rate in different areas in LMWD are to vary the wire feeding speed or the machine (or robot) scanning speed. In this case, the choice made by the authors was to change the scanning speed, exploiting the ability to modify the deposition trajectories of the subsequent layers to be deposited. As a combined correction of the mean and local height of the layer was applied, the local intra-layer correction was based on deviations with respect to the mean height, giving rise to smoother corrections. The To introduce local corrections, the linear movements are discretized by the insertion of intermediate points. The discretization of the trajectory is illustrated in Figure 3b, with the representation of two consecutive points, m i and m i+1 , before and after the insertion of the intermediate points. The distance between points is calculated according to a value, d, entered by the user. If → h i is defined as the vector that connects m i and m i+1 , the number of points to introduce between them, n i , is calculated as follows: and the coordinates of the intermediate points, m k , are then computed: The M matrix is then redefined by inserting the intermediate points.
On the other hand, the scanning of the part originates a matrix, P, with the coordinates of the point cloud: P =[p 1 p 2 . . . p n . . . p N ], p n = p n x p ny p nz .
(7) Figure 3c shows a zoom view of the trajectory points together with the scanned point cloud and the intra-layer height control parameters. With this control methodology, the scanning speed between the newly defined m i and m i+1 is determined as a function of the height profile of the scan.
A certain point in the trajectory, m i , is not necessarily coincident with a point in the scan, p n , so the height deviation for each trajectory point, desv m i , is calculated based on the z component of the scan points that are placed at a distance less than a user-defined value, r: desv m i = mean(P), P ={p n,z |(p n,x −m xi ) 2 +(p n,y −m y i ) 2 −r 2 < 0}.
The speed of a movement connecting two points, v→ h i , is established by means of the diagram shown in Figure 4, taking the mean value of the deviations of the two points being connected: where v nom is set as the nominal speed from which the scan speed adjustments are made. The slope of the correction curve is also determined by the user-defined parameters desv max and v max , corresponding to the maximum deviation at which the maximum speed is to be applied. These values determine the severity and stability of the corrections. If the speed change for a certain deviation is excessive, the growth of the part may change more than is necessary to reach the target height, as well as leading to large accelerations during the process. On the other hand, if the speed change entered is insufficient, a local defect may continue increasing and remain uncorrected. Finally, speeds higher than v max and lower than v min are saturated: excessive, the growth of the part may change more than is necessary to reach the target height, as well as leading to large accelerations during the process. On the other hand, if the speed change entered is insufficient, a local defect may continue increasing and remain uncorrected. Finally, speeds higher than v max and lower than v min are saturated:  The setting of the nominal, maximum, and minimum speeds must also take into account the possible effect of the speed change on the final part quality, in order to guarantee homogeneous component properties and the absence of internal defects.
User-defined values d and r also influence performance of the control. Figure 5 shows the deposition trajectories calculated with various combinations of these parameters. In Figure 5a, small r and d values are chosen, resulting in a large number of points on the trajectory and the deviations being calculated with very close scan points. As a result, more localized height variations can be corrected, but the velocity changes are also more pronounced. On the other hand, in Figure 5b, a higher value of d which is also significantly higher than r is selected. This results in fewer points in the trajectories and very discrete and sudden speed changes. Finally, the parameters in Figure 5c were considered as adequate for this work, in which a relatively small value of d and a slightly larger value of r are used. In this way, moderately small deviations can corrected with progressively changing speeds. Although a lower value of d can introduced, the improvement may not be relevant and the calculation time of the trajectories may increase considerably. The setting of the nominal, maximum, and minimum speeds must also take into account the possible effect of the speed change on the final part quality, in order to guarantee homogeneous component properties and the absence of internal defects.
User-defined values d and r also influence performance of the control. Figure 5 shows the deposition trajectories calculated with various combinations of these parameters. In Figure 5a, small r and d values are chosen, resulting in a large number of points on the trajectory and the deviations being calculated with very close scan points. As a result, more localized height variations can be corrected, but the velocity changes are also more pronounced. On the other hand, in Figure 5b, a higher value of d which is also significantly higher than r is selected. This results in fewer points in the trajectories and very discrete and sudden speed changes. Finally, the parameters in Figure 5c were considered as adequate for this work, in which a relatively small value of d and a slightly larger value of r are used. In this way, moderately small deviations can corrected with progressively changing speeds. Although a lower value of d can introduced, the improvement may not be relevant and the calculation time of the trajectories may increase considerably. The precision with which the trajectory positions are reached is another aspect to consider. The robot programming allows this precision to be varied in order to allow a continuous movement without speed changes. On the other hand, this means that the real trajectory of the robot does not necessarily correspond with the programmed path. This is the case for the corners of the path in Figure 3a. Although the trajectories are programmed to reach the corner of the section, reaching this point would lead to a significant reduction in the robot's speed, resulting in excessive growth in the corners. For this reason, the precision of the movement is reduced, resulting in more rounded real trajectories. This is a limitation to consider when determining the point at which corrections are made. In this work, this problem was solved by means of the parameters d and r, which softened this effect to some extent by increasing the distance to the points used to calculate the deviations. In other cases, this aspect can be addressed, for example, by introducing more rounded corners in the trajectory that will enable an accurate movement with the programmed speed. The precision with which the trajectory positions are reached is another aspect to consider. The robot programming allows this precision to be varied in order to allow a continuous movement without speed changes. On the other hand, this means that the real trajectory of the robot does not necessarily correspond with the programmed path. This is the case for the corners of the path in Figure 3a. Although the trajectories are programmed to reach the corner of the section, reaching this point would lead to a significant reduction in the robot's speed, resulting in excessive growth in the corners. For this reason, the precision of the movement is reduced, resulting in more rounded real trajectories. This is a limitation to consider when determining the point at which corrections are made. In this work, this problem was solved by means of the parameters d and r, which softened this effect to some extent by increasing the distance to the points used to calculate the deviations. In other cases, this aspect can be addressed, for example, by introducing more rounded corners in the trajectory that will enable an accurate movement with the programmed speed.

Influence of Velocity Change on Part Integrity
Initially, 25 mm × 25 mm section hexahedrons with 10 layers were manufactured. The distance between consecutive beads was specified as 1.3 mm. The deposition parameters used are given in Table 1. All parameters were kept constant except the scanning speed of the robot which was varied with respect to the nominal speed, set at 20 mm/min. The height at which each layer was deposited was adjusted based on the mean height of the previous layer. Figure 6a shows the hexahedron manufactured with the nominal speed, whereas in Figure 6a-f hexahedrons varying the speed above and below the nominal speed are presented. Note that as the scanning speed of the robot increased or decreased while maintaining the same deposition trajectories, the height of each layer and the height of the final part increased or decreased accordingly. On the other hand, although the overlap ratio was also changed as a consequence of the bead width change, the hexahedrons obtained showed an absence of pores or internal defects for every velocity. height of the final part increased or decreased accordingly. On the other hand, although the overlap ratio was also changed as a consequence of the bead width change, the hexahedrons obtained showed an absence of pores or internal defects for every velocity.  The results of the experiments have demonstrated the feasibility of adapting the scanning velocity on a part to vary the height of the deposition. Although different scanning speeds affect part heating and cooling rates, thus altering the microstructure of the final manufactured part, this aspect has not been considered in this article, considering as valid totally dense parts, with the absence of pores or cracks. In future research, the effect of these variations on the properties of the final part will be determined. The results of the experiments have demonstrated the feasibility of adapting the scanning velocity on a part to vary the height of the deposition. Although different scanning speeds affect part heating and cooling rates, thus altering the microstructure of the final manufactured part, this aspect has not been considered in this article, considering as valid totally dense parts, with the absence of pores or cracks. In future research, the effect of these variations on the properties of the final part will be determined.

Defect Correction
Two test specimen geometries were produced to validate the effectiveness of the height correction method. The deposition parameters were again those of Table 1 and the same zig-zag and external perimeter deposition pattern was applied. Although it was proven that parts could be built with a 20% speed change with no defects, the speed in these tests was limited to 10% to soften corrections and ensure internal quality, so the value of v max was set at 22 mm/s and v min at 18 mm/s. The maximum height deviation for these limit speeds, desv max , was set at 1 mm.
In the first test (Figure 7a), a step-type defect was simulated. After an initial complete layer deposition, only half of the section was deposited in the second layer. In Figure 7b, the part can be seen after the correction of the step defect, resulting again in a flat surface. Figure 7c shows the height profiles of the part calculated for each layer obtained from the scans, and the provoked step defect. Finally, in Figure 7d, the evolution of the height on both sides of the part is illustrated. The step defect induced in the second layer can be seen, which results in a difference in height between the two sides of the section. This difference in height decreases along the layers until it becomes negligible in the 12th layer.
Materials 2018, 11, x FOR PEER REVIEW 9 of 12 seen after the correction of the step defect, resulting again in a flat surface. Figure 7c shows the height profiles of the part calculated for each layer obtained from the scans, and the provoked step defect. Finally, in Figure 7d, the evolution of the height on both sides of the part is illustrated. The step defect induced in the second layer can be seen, which results in a difference in height between the two sides of the section. This difference in height decreases along the layers until it becomes negligible in the 12th layer. In the second demonstrator (Figure 8a), a pocket-shaped defect was generated. Again, the result of scanning speed control is shown in Figure 8b, in which after a certain number of layers a flat deposition was restored. The pocket defect, consisting of two layers of difference with respect to the top layer height, was produced deliberately (Figure 8c). The evolution of the height for the pocket and for the external zone is reflected in Figure 8d. In this case, the height difference in the third layer was larger, so it was not until the 19th layer that the height of the entire layer was almost levelled. In the second demonstrator (Figure 8a), a pocket-shaped defect was generated. Again, the result of scanning speed control is shown in Figure 8b, in which after a certain number of layers a flat deposition was restored. The pocket defect, consisting of two layers of difference with respect to the top layer height, was produced deliberately (Figure 8c). The evolution of the height for the pocket and for the external zone is reflected in Figure 8d. In this case, the height difference in the third layer was larger, so it was not until the 19th layer that the height of the entire layer was almost levelled.
In the second demonstrator (Figure 8a), a pocket-shaped defect was generated. Again, the result of scanning speed control is shown in Figure 8b, in which after a certain number of layers a flat deposition was restored. The pocket defect, consisting of two layers of difference with respect to the top layer height, was produced deliberately (Figure 8c). The evolution of the height for the pocket and for the external zone is reflected in Figure 8d. In this case, the height difference in the third layer was larger, so it was not until the 19th layer that the height of the entire layer was almost levelled. In order to verify that the correction had been applied without compromising the integrity of the part, the corrected samples were cut to analyze possible internal defects. Figure 9 shows a detailed In order to verify that the correction had been applied without compromising the integrity of the part, the corrected samples were cut to analyze possible internal defects. Figure 9 shows a detailed view of the defect correction, in which no interior defect can be seen either in the case of the step defect (Figure 9a) or in the pocket defect (Figure 9b).  By combining the mean layer height correction and local deviations, it was possible to reestablish a constant layer height. While the method presented in this paper was applied to provoked defects, the height correction method developed will be employed in future work on larger parts in order to maintain stability during manufacture. As further points to be developed, the measurement and control strategy will be applied to different geometries and materials, as well as analyzing their effect on the properties of the part. By combining the mean layer height correction and local deviations, it was possible to re-establish a constant layer height. While the method presented in this paper was applied to provoked defects, the height correction method developed will be employed in future work on larger parts in order to maintain stability during manufacture. As further points to be developed, the measurement and control strategy will be applied to different geometries and materials, as well as analyzing their effect on the properties of the part.

Conclusions
A novel in-process height control methodology was developed in the LMWD process based on the measurement of the part by means of a structured light scanner resulting in the correction of intra-layer defects.
The height correction was implemented in two steps. On the one hand, the average height of the deposited layer was corrected according to the scanned height profile of the workpiece and the reference CAD geometry. On the other hand, the control of the local deviations was based on the variation of the scanning speed of the robot. As a result, it was possible to adapt the deposition rate and therefore the bead height according to the height of each scanned zone.
In order to prove the effectiveness of the height control strategy, defects were provoked to simulate an irregular growth in different areas of the part. The performance of the control was tested, experimentally analyzing how planar layers were re-established after a certain number of deposited layers.
The methodology proved to be adequate to correct local intra-layer defects. The internal integrity of the part and the absence of defects was also verified in order to validate the process control methodology based on scanning speed variation.
The recalculation of layer-by-layer deposition paths and the combination of mean layer height error corrections and local corrections resulted in a reliable method for introducing the methodology into LMWD manufacturing environments. Although the calibration process, communications, or trajectory programming may be dependent on the manufacturing environment or scanner used, it is considered that the methodology presented is applicable to different machine configurations and measurement systems.
Future research will evaluate the degree to which the system is appropriate for other geometries and materials.

Funding:
The authors wish to acknowledge the financial support given by IHOBE and the ERDF through the Addieco project and by the Basque Government through the Addisend project which is part of the Elkartek 2018 programme.

Conflicts of Interest:
The authors declare no conflict of interest.