# Path Optimization Using Metaheuristic Techniques for a Surveillance Robot
## 3 Description of the Experimental Setup and Simulation Scenarios
### Modeling and Simulation of the Detection System  
The detection system, multiScan100 LiDAR sensing system [30], has been simulated by successively creating straight lines with a defined pitch angle starting from a certain point (location of the sensor robot). The possible intersection of the LiDAR with any obstacle is calculated by segmenting each colliding line when it intersects with it. In other works that used and modeled this sensor, the coverage did not consider the obstacles, so the radiation passed through them, losing precision in the simulation [31; 32]. In this work, this issue has been solved.  
This methodology is very suitable for calculating the visibility of the environment. Lines of sight whose coordinates match those of the spatial matrix cells are classified as \"seen\" and are, therefore, considered covered. Figure 5 illustrates the modeling of the sensor's operation with a scanning angle of 1 degree and a range of 4 m, encountering an obstacle that simulates a bed. The blue lines represent the space detected and, therefore, covered by the robot.  
Equations (5) and (6) illustrate the mathematical process followed in creating the lines of sight. It shows two different calculations that depend on whether there has been a line-obstacle intersection. If this occurs, the visible object truncates the range of the line. Otherwise, the laser visibility is extended to its maximum range. In that equation, \(\{X_{FINAL},Y_{FINAL}\}\) are the final coordinates of each line; \(\{x_{n},\ y_{n}\}\) refers to the position of the robot and, therefore, the starting point of the lines of sight; \(\alpha\) refers to the set of sensor angles; \(r_{eff}\) denotes the sensor range in m (Equation (5)); and \(\left\{x_{n}^{int}(\alpha),y_{n}^{int}(\alpha)\right\}\) refers to the closest intersection point with an obstacle. The minimum value of angle \(\alpha\) is \(\alpha_{min}\), the maximum value is \(\alpha_{max}\), and the distance between two consecutive angles is the angular resolution, indicated as \(\alpha_{r}\).  
\[r_{eff}(\alpha)=\left\{\begin{array}{ll}r_{max}&if\ \
exists\ intersection\\ \sqrt{\left(x_{n}-x_{n}^{int}(\alpha)\right)^{2}+\left(x_{n}-y_{n}^{int}( \alpha)\right)^{2}}&if\ \
exists\ intersection\end{array}\right. \tag{5}\]  
If there is an intersection with an obstacle, there is a reduction in effective sensor range \(r_{eff}\) (3). If there is no intersection, then the effective range is the maximum LiDAR range, i.e., \(r_{max}\). The end point of each vision line is calculated as shown in Equation (6).  
\[\left\{X_{FINAL},Y_{FINAL}\right\}=\left\{\begin{array}{ll}X_{FINAL}=x_{n} +r_{eff}(\alpha)\cdot\cos(\alpha)\\ Y_{FINAL}=y_{n}+r_{eff}(\alpha)\cdot\sin(\alpha)\end{array}\right. \tag{6}\]  
Finally, given the initial point \(P\{x_{n},\ y_{n}\}\) and the set of endpoints of the straight lines \(\text{Q}\{X_{FINAL},Y_{FINAL}\}\), the set of points that belong to the segments PQ, that is, \(\{X,Y\}\in PQ\), are used to mark the sensed area in the matrix \(V_{M}\) which represents the simulation environment by \(V_{M}(X,Y)=1\).  
Figure 5: Space sensed by the LiDAR in the presence of obstacles.  
To classify the object viewed as an obstacle or a malicious object, a 360-degree LiDAR was used to identify its position. This is compared with the environment map created by the LiDAR built into the robot and if there is a mismatch between the two, it is detected as an unwanted object.  
Table 1 presents the robot and sensor parameters used in this research. These parameters are those of the Hussar robot and LiDAR multiscan100. The last column specifies whether the parameter is related to the robot or the sensor. If this proposal is implemented with a different robot or sensor, the parameters in this table must be updated to the values of the new devices.