## 3 Marker-Assisted Region Scanning
### Update Robot State
The robot's initial position is randomly selected within the map's boundaries. The robot is positioned with coordinates \((x,y)\) in meters, converted to pixels using a \(m2p\) conversion rate. The initial orientation (\(\theta\)) is also randomly defined, covering the range from \(-\pi\) to \(\pi\). The LiDAR sensor is simulated to take measurements in \(nM\) directions, covering a field of view of angle \(sR\) degrees with a configurable maximum of \(mS\) pixel. It is used to detect obstacles within this field of view and maximum distance. The robot is programmed to avoid obstacles that are within a distance of \(mOd\) pixel. If an obstacle is detected within this limit, the robot adjusts its direction to avoid collisions by calculating the evasion angle based on the LiDAR readings. The evasion direction is stored in control variables, and the robot continues its path after the correction. The parameters used in the robot's instantiation are detailed in Table 3.

### Robot Position Update

The robot's position is updated based on the left (\(vL\)) and right (\(vR\)) motor speeds, which determine both linear and angular movement. These speeds are used to calculate \begin{table}
\begin{tabular}{l l l l l} \hline \hline
**Parameter** & **Variable** & **Map 1** & **Map 2** & **Map 3** \\ \hline LiDAR sensor maximum range & mS (pixel) & 150 & 70 & 25 \\ Minimum distance for obstacle avoidance & mOd (pixel) & 15 & 8 & 6 \\ LiDAR field of view & sR (degrees) & 180\({}^{\circ}\) & 180\({}^{\circ}\) & 180\({}^{\circ}\) \\ Initial motor speed & vL, vR (m/s) & 0.01 & 0.01 & 0.01 \\ Maximum motor speed & vM (m/s) & 0.02 & 0.02 & 0.02 \\ Meters to pixels conversion factor & m2p (pixels/meter) & 30 & 15 & 5 \\ Number of LiDAR measurements & nM (unit) & 181 & 181 & 181 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Parameters used in robot instantiationthe variation in the robot's position and orientation in space. The robot's linear velocity (\(v\)) can be calculated as the average of the left (\(v_{l}\)) and right (\(v_{r}\)) motor velocities:

\[v=\frac{v_{l}+v_{r}}{2} \tag{1}\]

Additionally, the robot's angular velocity (\(w\)) can be determined from the motor velocities and the distance between the robot's wheels (\(L\)):

\[w=\frac{v_{r}-v_{l}}{L} \tag{2}\]

To calculate the variations in the robot's \(x\) and \(y\) coordinates, as well as its orientation \(\theta\), the differential motion equations can be used. Suppose that during a small time interval \(\Delta t\), the robot moves with velocities \(v\) and \(w\). The variations in the \(x\) and \(y\) coordinates and in the orientation \(\theta\) can be calculated as follows:

\[\Delta_{x} =vs.\cdot\Delta t\cdot\cos(\theta) \tag{3}\] \[\Delta_{y} =vs.\cdot\Delta t\cdot\sin(\theta)\] \[\Delta_{\theta} =w\cdot\Delta t\]

These equations describe the variations in the robot's position and orientation based on the left and right motor velocities and the time interval \(\Delta t\). They are essential for predicting the change in the robot's pose in a 2D mobile robotics environment. ### Obstacle Detection

Obstacle detection is performed by the robot's LiDAR sensor, which checks for the proximity of objects around the robot to avoid collisions. The process focuses on analyzing a limited subsection of the LiDAR's field of view, corresponding to the range from \(-25^{\circ}\) to \(+25^{\circ}\) relative to the robot's current orientation. This choice aims to reduce processing time and concentrate resources on detecting obstacles directly in front of the robot, which are more relevant for immediate navigation. The LiDAR sensor takes distance measurements in various directions within this range, and the data from each measurement are compared to a predefined minimum distance threshold, called m0d. If an obstacle is detected at a distance less than or equal to this value, it is identified as a potential obstacle, and its information, such as the measured distance and detection angle, is stored in an obstacle list.