## Abstract

Optical structure parameter design is of great importance to ensure the accuracy of asymmetry systems such as the laser triangulation ranging system. The result often depends on the experience of optical designers, and it is inevitable to introduce human errors. In this paper, an automatic optimization method of optical structure parameters applied to the laser triangulation ranging system was proposed to assist in improving the measurement accuracy. First, the optical sensitivity optimization model of the laser triangulation ranging system was constructed, and the boundary conditions were established from two aspects of laser clear imaging and sensor geometric dimension. The constraint relationship between optical structure parameters under the Scheimpflug rule was established to ensure clear laser imaging, and the transverse distance and axial distance of the sensor geometric dimension were constrained when the laser imaging length was taken into consideration. Secondly, mutation operator-based particle swarm optimization (M-PSO) algorithm was proposed to search the optimal optical sensitivity, and three typical working distances and ranges were taken as examples to design the optical parameters. In addition, the results were verified by ZEMAX simulation and also the experimental platform, the maximum optical sensitivity of the structure was 3.496 and its corresponding optimal nonlinearity was 0.039% F.S. The automatic optimization method proposed in this paper was compared with the traditional GA method and PSO method, and it was verified that the convergence efficiency of the proposed method was much higher than the traditional ones.

© 2022 Optica Publishing Group under the terms of the Optica Open Access Publishing Agreement

## 1. Introduction

Distance measurement is a key part of modern high-precision measurement technology. Laser triangulation ranging technology has been widely used in many scenes such as size measurement [1], profilometry reconstruction [2] and robot positioning [3] due to its advantages of high precision, quick respond speed and strong adaptability. The optical structure parameters have a significant impact on the measurement accuracy of laser triangulation system [4–6]. At present, optical designers need to carry out strict calculating and then determine the final optical structure parameters of laser triangulation ranging system with the help of optical simulation software. This largely depends on the knowledge and experience of optical designers, which will inevitably bring human errors. Therefore, it is necessary to establish an automatic structure parameters optimization model of the laser triangulation ranging system. On the one hand, it reduces the workload of optical designers, and on the other hand, it improves the accuracy of the optical system by calculating the theoretical optimal parameters.

With the rapid development of intelligent optimization theory and algorithm, automatic design methods have been widely used in optical system optimization [7,8]. Automatic optimization of optical system involves three key problems: 1) Selection of initial optical structure parameters, which is the premise of system optimization; 2) Aberration automatic correction model, which is important to ensure the imaging quality; 3) Optimal algorithm for solving local extremum problems, which is aimed to improve the reliability and efficiency of optical automatic optimization method.

The existing mature commercial optical design software (such as ZEMAX) usually takes damped least squares (DLS) method for optimization, but DLS is easy to fall into the local extremum and results in missing global optimal solution. Li [9,10] made it jump out of the local extremum by introducing the momentum factor, but this method was only suitable for simple optical structures which was approximately linear, and the final optimal solution depend on the starting position.

Therefore, researchers had been committed to studying the application of global optimization algorithm in optical system design. Ono [11] took the lens resolution and distortion into account, and used genetic algorithm(GA) to optimize the imaging quality of a small-scale lens system. Li [12] optimized the optical system in two steps via the combination of sequential coordinate-wise algorithm and evolutionary algorithm (EA). Braulio [13] adopted EA to optimize the rotationally symmetric optical structure composed of spherical singlet lens. Altameem [14] took the spot radius as the optimization constraint and optimized a single lens optical system by support vector machines (SVM) regression. Qin [15] adapted particle swarm optimization (PSO) algorithm to correct the spherical aberration of a single aspheric lens. Although the above methods solved the local minimum problem with the help of the global optimization algorithm, it was only suitable for simple and small-scale optical systems.

For large-scale optical systems, the automatic optimization method had also been applied. Guo [16] selected the lens material automatically by using combination method with PSO algorithm and least square (LS), and took cooker lens as an design example for aberration optimization. Yu [17] designed the paraxial first-order parameters of the infrared zoom system by the means of PSO algorithm. Fan [18] adapted PSO algorithm to optimize the initial structure of double-sided telecentric automatic zoom. The above research expanded the scale of optical system, while there still a lack that the optical systems were symmetrical structure.

The research on structure optimization of more complex free-form optical system had become a focus for optical engineers in recent years. Yang [19] proposed “point by point” design process to obtain the starting position of free-form imaging system. Menke [20] used PSO algorithm to optimize the wavefront error of free-form optical system. The above methods further improved the possibility of automatic optimization for a complex optical system, but the time of iteration became much longer due to complexity of the algorithm and the optical system.

Moreover, the structure of laser triangulation ranging system was asymmetric due to its obliquely incident laser beam on the imaging device, which increased the computational complexity in the convergence process of the optimization algorithm and resulted in local extremum. And the laser triangulation ranging system was a nonlinear system, which involved various parameters. All variables should be considered in the optimization process, and the existing methods were rarely considered comprehensively. Therefore, in order to realize the automatic optimization of laser triangulation ranging system, there are two main challenges. On the one hand, there was a lack of initial optical structure global optimization mathematical model for laser triangulation ranging system. On the other hand, the robustness and execution speed of the existing automatic optimization method still need to be improved.

Based on the above research shortcomings, this paper proposed an optimization mathematical model of laser triangulation ranging system based on Scheimpflug imaging rule, and realized automatic optimization with the help of mutation operator-based particle swarm optimization (M-PSO). First, a global optimal optical sensitivity mathematical model of laser triangulation ranging system within the full working range was taken as the optimization merit function, the optimal solutions were carried out under the constraints of Scheimpflug imaging rule and sensor geometric dimension with the consideration of laser imaging length. Secondly, the mutation operator was introduced into the PSO algorithm to avoiding the premature convergence caused by local extremum during the process of optical structure parameters optimization. Finally, the optimal optical structures were simulated in ZEMAX to further correct the aberrations and an experimental platform was built for verification. The nonlinearity of optimized optical structure can reach 0.039% FS, and our method was compared with different traditional optimization algorithms.

## 2. Laser triangulation ranging system optical sensitivity model and its boundary condition

#### 2.1 Laser triangulation optical structure and its imaging principle

The optical structure of laser triangulation ranging system was shown in Fig. 1. The collimated laser beam projected onto the surface of the measured object, and a diffused reflection laser beam was formed on the object surface. The diffused laser beam was captured by the receiver lens along the direction of observation angle *α* and then focused on the imaging device (such as CMOS), forming a laser spot with a certain energy distribution. When the object moved *s* within the working range, the laser spot moved *x* on the imaging device correspondingly. According to the triangulation similarity relationship, *s* could be calculated as [21]:

*β*was the imaging angle,

*l*was the object distance, and

_{o}*f*was the imaging distance. When the working range of the system was ± S / 2, we defined the working distance d (that was, the midpoint of the working range) of the sensor as the zero position. Assuming that the direction of the collimated laser was positive and the direction away from it was negative. Correspondingly, the proximal position was -S/2 and the distal position was + S/2.

_{p}#### 2.2 Optical sensitivity optimization merit function

Optical sensitivity was a key index to evaluate the accuracy of laser triangulation ranging system. For laser triangulation ranging system, its optical structure sensitivity was defined as the ratio of the output variation (the displacement of the laser spot on the imaging device) to the input variation (the displacement of the measured object) when the working state was stable.

According to Eq. (1), the displacement of imaging laser spot *x* could be written as:

Considering the definition of optical sensitivity of laser triangulation ranging system, the optical sensitivity *δ _{x}* can be obtained by calculating the partial derivative of Eq. (2).

Obviously, the sensitivity of laser triangulation ranging system was related to various optical structure parameters, and the sensitivity was different under each position within the full working range. In our previous research, we had made it clear that the sensitivity of laser triangulation ranging system was proportional to the working distance d, imaging angle *β* and object distance *l _{o}*, while it was inversely proportional to the observation angle

*α*and imaging distance

*f*[22]. In the process of laser triangulation optical structure optimization, we need to comprehensively consider the constraints of these structure parameters to find the optimal sensitivity.

_{p}Therefore, the optical optimization merit function was constructed. The optical sensitivity of ranging system changed with the position of the measured object within the full working range ± S/2. When the position of the measured object *s* was the maximum (*s*=+S/2), the sensitivity was the minimum, which resulted in the lowest measurement accuracy at the distal position within the range. Similarly, when *s* was the minimum (*s* =-S/2), the sensitivity was the maximum, and the measurement accuracy of the proximal position within the range would be the highest. This could be expressed by Eq. (4).

The optimization merit function max[*Min*(*δ _{x}*)] was adapted to finding and evaluating the optimal optical sensitivity within the full working range, which was determined by the resolution of photoelectric devices and finally influenced the nonlinear error of laser triangulation ranging system.

#### 2.3 Boundary condition

The boundary constraints were established from two aspects. First, we need to consider the imaging quality of laser spot on the imaging device to ensure the laser location accuracy. In addition, the geometric constraints of mechanical structures should also be taken into account.

### 2.3.1 Laser spot clear imaging condition

The optical structure of laser triangulation ranging system was asymmetric, and there was an inclination angle between imaging device and laser beam, which led to the skew distribution of laser spot energy and introduced system aberration. In order to ensure clear laser spot imaging, the object distance *l _{o}* and imaging distance

*f*should conform to Gaussian paraxial optical imaging rule when the position of the measured object was on the optical axis (zero position), as shown in Eq. (6):

_{p}*f*was the focal length of the receiver lens. When the measured object was not at the position of the optical axis, that was, the object was at any position within the working range, the optical structure parameters should conform to Eq. (7):

Equations (6) and (7) constituted the Scheimpflug rule [23], which meant the optical axis of collimated laser, the longitudinal axis of receiver lens and the extension line of imaging device intersected at one point (Point O in Fig. 1). Under the condition of Scheimpflug rule, the laser beam would form a clear image on the imaging device when the measured object was at any position within working range. Thus, Eq. (6) and Eq. (7) were taken as boundary conditions to ensure laser spot clear imaging.

### 2.3.2 Geometric dimension constraints

The geometric dimension of the sensor should also be considered in practical design and application. Although increasing the observation angle and imaging distance was conducive to improve the optical sensitivity of the measurement system, the dimension of the sensor was sometimes limited to mechanical installation space. Thus, the geometric dimension should be constrained when designing the optical parameters. The optical structure parameters that determine the dimension of laser triangulation ranging sensor mainly included observation angle *α*, object distance *l _{o}*, imaging angle

*β*and imaging distance

*f*. And these parameters all together influenced the imaging length

_{p}*L*.

The relationship between the imaging length *L* and other structure parameters was calculated. When the measured object moved from + S/2 to - S/2 within the working range, the positions of the corresponding imaging spots on the imaging device were *x*_{+S/2} and *x*_{-S/2} respectively. The distance between these two limit positions was the imaging length *L* of the spot on the imaging device, which could be deduced from Eq. (8):

According to Eq. (7), imaging distance *f _{p}* could be written as:

Substituting Eq. (9) into Eq. (8), the imaging length *L* could be expressed as:

*L*was taken into account, as shown in Fig. 2. The geometric dimension increment | AB | and | BC | caused by the imaging length

*L*were calculated according to the triangulation relationship, then:

Thus, the transverse distance W and the axial distance R could be determined according to Eq. (13) and Eq. (14).

To sum up, the optical sensitivity in the full working range (Eq. (5)) was taken as the merit function to find the optimal optical structure parameters, and the boundary conditions were constructed from two aspects of imaging quality and sensor geometric dimension. That was, the optical system should conform to the Scheimpflug imaging rule (Eq. (6) - Eq. (7)), and the geometric dimension should be constrained by the transverse distance W and axial distance R when taking imaging length *L* into consideration (Eq. (10), Eq. (13) and Eq. (14)). In the boundary condition space, we adapted the mutation operator-based particle swarm optimization (M-PSO) algorithm to find the optimal solutions.

## 3. Optical parameters automatic design method of mutation operator-based particle swarm optimization

#### 3.1 Mutation operator-based particle swarm optimization algorithm

### 3.1.1 Particle swarm optimization method

Particle swarm optimization (PSO) algorithm was proposed by Kennedy and Eberhart in 1995 which was a random search algorithm based on swarm intelligence [24]. Inspired by the regular activities of bird groups, the search space of the problem was compared to the flight space of birds. Each bird was abstracted into a particle to represent a candidate solution of the problem. The process of finding the optimal solution of the problem was compared to the process of finding food, so as to solve the complex optimization problem.

In PSO, particles were randomly distributed in the feasible solution space of the problem and flew with a certain speed. When each particle moved in space, both the individual optimal position and the population optimal position of other neighborhood particles should all be considered, and the optimal position was evaluated by merit function. The algorithm entered the next iteration when all particles in the group had moved. Finally, the whole group moved in the direction of optimal value of merit function just like birds looking for food.

Assuming the D-dimensional search space R^{D}, the total number of particles was *n*, the position of the *i*-th particle was defined as the vector *X _{i }*= (

*x*

_{i}_{1},

*x*

_{i}_{2},…,

*x*

_{i}_{D}), the current individual optimal position searched by the

*i*-th particle was

*P*= (

_{i }*p*

_{i}_{1},

*p*

_{i}_{2},…,

*p*

_{i}_{D}), the current population optimal position

*P*= (

_{g }*p*

_{g}_{1},

*p*

_{g}_{2},…,

*p*

_{g}_{D}) was the optimal value of all

*P*(

_{i}*i*= 1,2…,

*n*), and the position change velocity of the

*i*-th particle was the vector

*V*= (

_{i }*v*

_{i}_{1},

*v*

_{i}_{2},…,

*v*).The velocity and position of the

_{iD}*i*-th particle in

*t*+1-th iteration were updated according to Eq. (15) and Eq. (16).

_{1}and r

_{2}were uniformly distributed random numbers in the interval [0,1], which aimed to maintain the diversity of the population and suppressed the premature of the algorithm. c

_{1}and c

_{2}were learning factors to make particles have cognitive ability and were usually set to be positive constant numbers. The velocity

*V*affected the search ability of the algorithm, and it was generally limited to the interval [V

_{i}_{min},V

_{max}].

*w*was the inertia coefficient, which determined the particle search range. The higher the

*w*was, the larger the search range of particles was, which was conducive to jumping out of the local extreme value. On the contrary, the lower the

*w*was, the smaller the search range of particles was, which was conducive to the convergence of the algorithm. Therefore, an appropriate inertia coefficient can help to balance the global exploration ability and local exploitation ability of particles. Generally, a maximum inertia coefficient

*w*was set at the beginning stage of the algorithm to improve the global search ability, while a minimum inertia coefficient

_{max}*w*was replaced to speed up the convergence at the end stage. Therefore,

_{min}*w*can be updated according to the iteration

*t*, as shown in Eq. (17).

### 3.1.2 Mutation operator

Although PSO algorithm had the advantage of fast convergence, the problem of premature convergence and local extremum was inevitable. Taking the mutation idea of genetic algorithm (GA) as reference, the mutation operator was introduced to help the particles jumped out of the local extremum and searched in a larger space, so as to improve the possibility of finding an optimal solution. The steps were as follows:

**Step 1. Judgment**. If population optimal position*P*had no change for consecutive iterations of_{g}*m*times, or its variation Δ*P*(_{g}*m*) was less than the threshold T(Δ*P*), then the algorithm loop entered step 2 for mutation operation. Otherwise, no mutation operation was required._{g}**Step 2. Setting R**. The maximum radius threshold of adjacent subgroups R_{max}and*P*_{m}_{max}and mutation probability*P*were set according to the experience and testing results._{m}**Step 3. Calculating R**. The radius of the subgroup R_{swarm}_{swarm}was calculated, that was, the maximum Euclidean distance from all particles in the group to historical population optimal position*P*(_{g}*t*), as shown in Eq. (18):$${R_{swarm}} = \mathop {\max }\limits_{i = 1,2,3 \cdots j} \left[ {\sqrt {\sum\nolimits_{i = d}^D {{{({{P_{gd}} - {x_{id}}} )}^2}} } } \right]$$Where*j*was the number of adjacent subgroups.**Step 4. Mutation operator**. When R_{swarm}< R_{max}, all particles in the adjacent subgroups were reinitialized their position and velocity with the probability of*P*._{m}

#### 3.2 Automatic optimization process of optical structure parameters

Based on the M-PSO method, under the constraints of imaging quality and geometric structure dimension, the optical structure parameters of laser triangulation ranging system were automatically optimized with the goal of searching the optimal optical sensitivity. In the actual design of the laser triangulation ranging system, the distance between the receiver lens and the front surface of the sensor H, the working distance and range d ± S/2 were previously known. Thus, optical structure parameter variables contained observation angle *α*, object distance *l _{o}*, imaging angle

*β*, image distance

*f*and imaging length

_{p}*L*. The problem can be equivalent to the global optimization of optical structure parameters (

*α*,

*l*,

_{o}*β*,

*f*,

_{p}*L*) in the search space R

^{D}(D = 5) with Eq. (5) as the merit function. As shown in Fig. 3, the optimization process included 3 main modules, namely, parameter initialization module, PSO algorithm module and mutation operation module.

First, the parameters were initialized as shown in Table 1. We initialized the parameters of standard PSO algorithm, mutation operation parameters and constraints respectively. Where *α*∈[15°,45°], *β*∈[20°,55°], *l _{o}*,

*f*,

_{p}*L*were constrained by Eq. (6), Eq. (7) and Eq. (10) according to different working distance and range d ± S/2. We set the axial geometric dimension R ≤ 105mm and the transverse geometric dimension W ≤ 105mm.

Secondly, the loop entered the particle optimization iteration process of PSO algorithm after initialization. When the particles were in the optimization constraint space, calculating the merit function according to Eq. (5), and the individual optimal position *P _{i}* and population optimal position

*P*were obtained. Then, the mutation operation was required if the consecutive variations of population optimal position Δ

_{g}*P*(

_{g}*m*) were less than T(Δ

*P*). Further, the position and velocity of the particles were updated according to Eq. (15)–Eq. (16). The loop was repeated until iterations

_{g}*t*reached the maximum, and then finally output the optimal solution

*P*.

_{g}In addition, once the PSO algorithm fell into local extremum, the loop entered to mutation operation module. The subgroup radius R_{swarm} was calculated according to Eq. (18) and constrained to threshold R_{max}. Further, the position and velocity of all particles in the subgroup were initialized with the probability *P _{m}*= 0.2 to escape the local extremum.

## 4. Design examples and experiment results

#### 4.1 Design examples and ZEMAX simulation results

With the help of the proposed automatic optimization method of optical structure parameters, the optical designer can automatically find the candidate solutions of the optical structure parameters according to the working distance and range d ± S/2. The candidate solutions of optical structure were simulated and verified in ZEMAX optical software (Zemax OpticStudio. Professional 14.2. October, 2014. ZEMAX. Seattle, USA.) to determine the final design. We selected 3 typical working distances and ranges as examples for optical structure design and simulation, including small-scale range (d ± S/2 = 22.5 ± 2.5mm), medium-scale range (d ± S/2 = 50 ± 10mm) and large-scale range (d ± S/2 = 150 ± 40mm).

First, the initial optical structure parameters (*α*, *l _{o}*,

*β*,

*f*,

_{p}*L*) of the laser triangulation ranging system was obtained according to the M-PSO algorithm, and Eq. (5) was taken as the merit function to search for the optimal solutions. Constrained to different transverse distance W and axial distance R, different initial optical parameters were found, and 5 groups of candidate solutions were selected for each working distance and range, as shown in Table 2. The optical sensitivity of each group of candidate solutions was compared with the imaging length

*L*which determined the geometric dimension of the optical system, as shown in Fig. 4. The X-axis coordinate in Fig. 4 presented the sensitivity of the optical structure, and the Y-axis coordinate presented the imaging length

*L*. Obviously, the optical sensitivity of the laser triangulation ranging system was directly proportional to the imaging length

*L*and inversely proportional to the working distance and range d ± S/2. The smaller the working distance and the longer the imaging length

*L*was, the higher the sensitivity of the optical system would be. In our design examples, the maximum optimal sensitivity was 3.496 when d ± S/2 = 22.5 ± 2.5mm and the minimum optimal sensitivity was 0.169 when d ± S/2 = 150 ± 40mm. Our method could obtain multiple optimal candidate solutions corresponding to different sensitivity and imaging length to satisfy different working distance and geometrical dimension constraints. Compared with those method only gave a single optimization result, our method provided optical designers more choices and possibility for optical system design.

Furthermore, the candidate solutions bolded in Table 2 whose optimal sensitivity (maximum merit function value) were the maximum under different working distances and ranges were selected as design examples and simulated in ZEMAX. We chose aspheric lens (Material S-LAH64 glass) as the receiver lens, here the choice of lens material and type was not within the main scope of this paper. In the process of ZEMAX optical simulation, the centroid of laser beam was taken as the reference, and the Root Mean Square (RMS) method was adapted to evaluate imaging quality with the aim to further correct the lens aberrations, the imaging angle *β* and lens parameters were set to be variables to find the final optimal solutions as shown in Fig. 5. According to the spot diagram of ZEMAX simulation, when the object moved within the range on the object plane, the imaging spot moved on the image plane correspondingly, and its RMS radius would also change. In the 3 design examples, the RMS radius of the laser spot on the imaging plane was less than 200µm, of which the maximum RMS radius was 192.731µm (when d = 50mm, s=+10mm) and the minimum RMS radius was 13.608µm (when d = 22.5mm, s=+2.5mm), which satisfied the imaging quality requirements of the laser triangulation ranging system.

#### 4.2 Optical structure experimental verification

An optical structure experimental platform was built to verify the measurement accuracy of the examples we designed, as shown in Fig. 6. The direction of the collimated LD laser beam (waveform 635nm, power 3.5mW) was adjusted by the 2-dimensional optical adjusting frame, the measured object (white diffused ceramic reflector) was fixed on the 1-dimensional guide rail and moved within the working range, the receiver lens (AL-series, Thorlabs Corporation) was fixed on the 3-dimensional adjusting platform, and the CMOS (Resolution 6µm × 6µm, FA-S0-86M16, Teledyne Dalsa Corporation) was fixed on the turntable. By adjusting the guide rails and turntables, the optical structures of design examples were set up, and their structure parameters were as shown in Table 3. The dual-frequency laser interferometer (Resolution 0.001µm, XL-80, Renishaw Corporation) was taken as the reference. When the measured object moved with guide rail, the interferometer recorded the corresponding displacement, which was compared with the output of the laser triangulation ranging system.

Figure 7 showed the nonlinear error of the laser triangulation ranging system under different working distance and range d ± S/2 when the dual-frequency laser interferometer was taken as the measurement reference. The measurement error fluctuated within the full working range on different positions. The minimum nonlinear error was 0.039% F. S (d ± S/2 = 22.5 ± 2.5mm), and the maximum nonlinear error was 0.046% F.S(d ± S/2 = 150 ± 40mm). Compared with the non-automatic design from Ref. [23]. whose nonlinear error was 0.066%F.S (The maximum error of the example was 0.0131mm when the working range was 20mm), the nonlinear error of optical structure designed in this paper was improved without taking any error compensation algorithm than the traditional laser triangulation ranging design method by experience. It was suggested that the optical automatic optimization method we proposed can satisfied the requirements of designing laser triangulation ranging system.

#### 4.3 Comparison of different optimization algorithms

The optimal design results of optical structure parameters obtained via different algorithms were compared, including M-PSO, GA and PSO, and the details of each algorithms were provided in Table 4. The laser triangulation ranging system with working distance and range d ± S/2 = 22.5 ± 2.5mm was taken as an example, the convergence process of M-PSO, GA and PSO were compared under different geometric dimension constraint as shown in Fig. 8. Obviously, the value of merit function was proportional to the geometric dimension W × R. In the convergence process of merit function, M-PSO method had its advantages. M-PSO method had higher execution efficiency and could be converged within 40 times of iteration rather than that GA algorithm needed more than 4000 times of iteration. Moreover, compared with standard PSO algorithm, M-PSO method can always found the global optimal solution in the constraint space, avoiding the problem of local extremum.

In addition, the normalized iterative convergence times of different methods were further compared as shown in Fig. 9. The convergence time of GA method was nearly 2 orders of magnitude higher than that of PSO and M-PSO method because of the calculating complexity of GA method. The normalized convergence time of M-PSO was within 0.2×10^{−2}, while the maximum normalized convergence time of PSO was 0.54×10^{−2}. It was suggested that M-PSO method can reduce the time of iteration convergence and avoiding the local extremum by adding mutation operator.

## 5. Conclusion

In this paper, an optimization model of optical structure parameters was proposed for the laser triangulation ranging system in accordance with the Scheimpflug imaging rule, and the optimal parameters of optical structure were determined by M-PSO method. First, the optimal sensitivity mathematical model of optical structure was constructed under the conditions of geometric constraints and Scheimpflug imaging rule. Secondly, mutation operator was added to PSO algorithm with the aim to avoiding local extremum and increasing the convergence speed. Finally, 3 typical working distance and range of laser triangulation ranging systems were taken as design examples to optimize the optical structure parameters. ZEMAX simulation and experiments results suggested that the proposed method can help to find a global optimum solution of optical sensitivity which can be closed to 3.496, and improved the nonlinear error to 0.039% F.S. In addition, compared with the traditional GA and PSO methods, the M-PSO method can significantly accelerated the convergence speed with its normalized time 0.2×10^{−2}, which made up for the disadvantages of time consuming of GA and the local extremum of PSO. Multiple candidate solutions can be obtained by controlling geometric constraints, which provided optical designers with more choices and system design possibilities. In the next work, we will apply the optimization mathematical model to other more complex asymmetric optical systems, and take the surface parameters of optical lenses into consideration to reduce aberrations, so as to further improve the efficiency of the automatic optimization method.

## Funding

National Natural Science Foundation of China (51975374).

## Acknowledgments

This work was supported by the National Natural Science Foundation of China under Grant No.51975374.

## Disclosures

The authors declare no conflicts of interest.

## Data Availability

Data underlying the results presented in this paper are not publicly available at this time but may be obtained from the authors upon reasonable request.

## References

**1. **F. Cavedo, M. Norgia, A. Pesatori, and G. E. Solari, “Steel Pipe Measurement System Based on Laser Rangefinder,” IEEE Trans. Instrum. Meas. **65**(6), 1472–1477 (2016). [CrossRef]

**2. **B. Yao, Z. Cai, J. Lu, X. Ma, and B. Chen, “Novel laser triangulation measurement method for screw rotor profile under multi-factor constraints,” Measurement **152**, 107317 (2020). [CrossRef]

**3. **F. J. Brosed, J. Santolaria, J. J. Aguilar, and D. Guillomía, “Laser triangulation sensor and six axes anthropomorphic robot manipulator modelling for the measurement of complex geometry products,” Robot. Comput. Integr. Manuf. **28**(6), 660–671 (2012). [CrossRef]

**4. **N. Swojak, M. Wieczorowski, and M. Jakubowicz, “Assessment of selected metrological properties of laser triangulation sensors,” Measurement **176**, 109190 (2021). [CrossRef]

**5. **R. G. Dorsch, G. Häusler, and J. M. Herrmann, “Laser triangulation: fundamental uncertainty in distance measurement,” Appl. Opt. **33**(7), 1306–1314 (1994). [CrossRef]

**6. **D. Ding, Z. Zhao, R. Huang, C. Dai, X. Zhang, T. Xu, and Y. Fu, “Error Modeling and Path Planning for Freeform Surfaces by Laser Triangulation On-Machine Measurement,” IEEE Trans. Instrum. Meas. **70**, 1–11 (2021). [CrossRef]

**7. **S. D. Campbell, D. Sell, R. P. Jenkins, E. B. Whiting, J. A. Fan, and D. H. Werner, “Review of numerical optimization techniques for meta-device design [Invited],” Opt. Mater. Express **9**(4), 1842–1863 (2019). [CrossRef]

**8. **J. Jiang, M. Chen, and J. A. Fan, “Deep neural networks for the evaluation and design of photonic devices,” Nat. Rev. Mater. **6**(8), 679–700 (2021). [CrossRef]

**9. **L. Li, Q.-H. Wang, X.-Q. Xu, and D.-H. Li, “Mutation operators in lens system optimization to jump out of local minima,” Opt. Express **18**(20), 20876–20886 (2010). [CrossRef]

**10. **L. Li, X.-Q. Xu, and Q.-H. Wang, “Mutated and converged damping factors in lens system optimization to find new local minima,” Optik **124**(20), 4150–4154 (2013). [CrossRef]

**11. **I. Ono, S. Kobayashi, and K. Yoshida, “Optimal lens design by real-coded genetic algorithms using UNDX,” Comput. Methods Appl. Mech. Eng. **186**(2-4), 483–497 (2000). [CrossRef]

**12. **L. Li, Q.-H. Wang, X.-Q. Xu, and D.-H. Li, “Two-step method for lens system design,” Opt. Express **18**(12), 13285–13300 (2010). [CrossRef]

**13. **B. F. Carneiro de Albuquerque, F. Luis de Sousa, and A. S. Montes, “Multi-objective approach for the automatic design of optical systems,” Opt. Express **24**(6), 6619–6643 (2016). [CrossRef]

**14. **T. A. Altameem, V. Nikolić, S. Shamshirband, D. Petković, H. Javidnia, M. L. Mat Kiah, and A. Gani, “Potential of support vector regression for optimization of lens system,” Computer-Aided Design **62**, 57–63 (2015). [CrossRef]

**15. **H. Qin, “Aberration correction of a single aspheric lens with particle swarm algorithm,” Opt. Commun. **285**(13-14), 2996–3000 (2012). [CrossRef]

**16. **D. Guo, L. Yin, and G. Yuan, “New automatic optical design method based on combination of particle swarm optimization and least squares,” Opt. Express **27**(12), 17027–17040 (2019). [CrossRef]

**17. **X. Yu, H. Wang, Y. Yao, S. Tan, Y. Xu, and Y. Ding, “Automatic design of a mid-wavelength infrared dual-conjugate zoom system based on particle swarm optimization,” Opt. Express **29**(10), 14868–14882 (2021). [CrossRef]

**18. **Z. Fan, S. Wei, Z. Zhu, Y. Mo, Y. Yan, and D. Ma, “Automatically retrieving an initial design of a double-sided telecentric zoom lens based on a particle swarm optimization,” Appl. Opt. **58**(27), 7379–7386 (2019). [CrossRef]

**19. **T. Yang, G.-F. Jin, and J. Zhu, “Automated design of freeform imaging systems,” Light: Sci. Appl. **6**(10), e17081 (2017). [CrossRef]

**20. **C. Menke, “Application of particle swarm optimization to the automatic design of optical systems,” Proc. SPIE **10690**, 106901A (2018).

**21. **Z. Nan, W. Tao, and H. Zhao, “Laser pointing error analysis and compensation method of low-power laser diode source applied to triangulation ranging system,” Rev. Sci. Instrum. **92**(10), 103001 (2021). [CrossRef]

**22. **N. Zhuojiang, T. Wei, and Z. Hui, “Development of a small-size laser triangulation displacement sensor and temperature drift compensation method,” Meas. Sci. Technol. **32**(9), 095107 (2021). [CrossRef]

**23. **A. Miks, J. Novak, and P. Novak, “Analysis of imaging for laser triangulation sensors under Scheimpflug rule,” Opt. Express **21**(15), 18225–18235 (2013). [CrossRef]

**24. **R. Eberhart and J. Kennedy, “A new optimizer using particle swarm theory,” in MHS'95. Proceedings of the Sixth International Symposium on Micro Machine and Human Science (IEEE, 1995), pp.39–43.