## 3 Identification of IPS Parameters Using Genetic Algorithms
At each step, the algorithm uses the individuals from the current generation to create the next population. To create the new population, the algorithm performs the following steps  
* It scores each member of the current population by calculating its fitness value. These values are called raw fitness scores. * It scales the raw fitness scores to convert them into a more usable range of values. These scaled values are called expected values. * It selects members, called parents, based on their probabilities. * Some of the individuals in the current population who have great fitness are chosen as the elite. These elite individuals pass values on to the next population. * It produces children from the parents. Children are produced by making random changes in a single parent--mutations--or by combining vector entries from a pair of parents--crossing. * It replaces the current population with offspring to form the next generation. * The algorithm stops when one of the stopping criteria is met. Figure 2: Calibration process. Figure 3 shows the inputs and outputs of the genetic algorithm. The inputs of the genetic algorithm are the PSD surface incident points \((x^{in},\ y^{in})\) and the corresponding 3D positions of the PSD in the environment with respect to the chosen coordinate origin \((X^{n}_{r},\ Y^{n}_{r},\ Z^{n}_{r})\). The output data of the genetic algorithm are the parameter values: position of the \(j\)th emitter in the environment \((X^{j}_{e},\ Y^{j}_{e},\ Z^{j}_{e})\), misalignment angles of the PSD system with respect to the plane of movement \((\alpha,\ \beta,\ \gamma)\), the intrinsic parameters \((f,\ C_{x},\ C_{y})\), and the lens distortion parameter \((k)\). The variable to be minimized with the genetic algorithms is the average distance error between the measured impact points and the projections of the impact points obtained analytically with the parameters of the system to be optimized. To obtain the distance error value, we start from the pinhole model, whose expression is shown in (1). \[ \begin{pmatrix}sx^{in^{\prime}}\\ sy^{in^{\prime}}\\ s\end{pmatrix} =\underbrace{ \begin{pmatrix}f&0&C_{x}\\ 0&f&C_{y}\\ 0&0&1\end{pmatrix} }_{A}\underbrace{ \begin{pmatrix}r_{11}&r_{12}&r_{13}\\ r_{21}&r_{22}&r_{23}\\ r_{31}&r_{32}&r_{33}\end{pmatrix} }_{R} \begin{pmatrix}X^{j}_{e}-X^{n}_{r}\\ Y^{j}_{e}-Y^{n}_{r}\\ Z^{j}_{e}-Z^{n}_{r}\end{pmatrix}  \tag{1}\]  
where the rotation matrix \(R\) is obtained from the angles \(\alpha,\beta,\theta\). \((x^{in^{\prime}},\ y^{in^{\prime}})\) is the projection of the \(j\)th emitter onto the sensor surface of the \(n\)th receiver position, calculated with the parameters to be optimized \((X^{j}_{e},\ Y^{j}_{e},\ Z^{j}_{e})\), \(\alpha,\ \beta,\ \gamma,\ f,\ C_{x},\ C_{y}\). Therefore, \((x^{in^{\prime}},\ y^{in^{\prime}})\) is the point of impact in the absence of distortion. Additionally, it is necessary to correct the distortion of the measured impact points \((x^{in},\ y^{in})\). In general there are two types of distortion, radial and tangential distortion. We have considered only the radial distortion, since the tangential distortion will be corrected to some extent by estimating the misalignment of the normal vectors for the sensing plane and the motion plane. It must be taken into account that this weak calibration is computed with a few number of incidence points, so that increasing the number of parameters to be optimized in excess could lead the algorithm to converge to a non-optimal solution. The radial distortion is modeled according to:  
\[d^{in}_{x}=(x^{in}-C_{x})(k_{1}r^{2}_{jn}+\ldots+k_{n}r^{2m}_{jn}) \tag{2}\]  
\[d^{in}_{y}=(y^{in}-C_{y})(k_{1}r^{2}_{jn}+\ldots+k_{m}r^{2m}_{jn}) \tag{3}\]  
where \(r_{jn}\) is the Euclidean distance between the measured point of impact \((x^{in},\ y^{in})\) and \(k_{i=1,\ldots,m}\) are the \(m\) parameters that model the lens radial distortion. Distortion is corrected according to (4) and (5), thereby obtaining the coordinates of the corrected impact point \((x^{in^{\prime}},\ y^{in^{\prime}})\).