## 2 Materials and Methods
### Environment Mapping Using the Hector Sham Method  
In this study, LiDAR was used to map the working environment and designate a safe working area for the mobile robot. Based on data from the utilized LiDAR and SLAM (Simultaneous Localization and Mapping) techniques, a 2D map of the working environment was generated for each work setting. In robotics research, it is common for mobile robots to perform simultaneous localization and mapping (SLAM) in an unknown environment. SLAM is a technique for mapping an unknown area while monitoring the position of moving objects under specific conditions. We can perform SLAM using various sensors, including laser sensors with LiDAR or visual sensors with stereo cameras. A map of the environment is required for a mobile robot to move from room to room and collect and deposit objects. To perform these tasks, the robot must be aware of its surroundings as well as its position within them [20]. This study examined Hector SLAM, which was the LiDAR-based 2D-SLAM algorithm that was implemented in the robot operating system. Experiments were conducted to generate maps using the Hector SLAM method. The map was created in real-time, which allowed us to view the mobile robot's path throughout its operation. The robot was equipped with an RP LiDAR A1 that was utilized for Hector SLAM. A robot operating system (ROS) was utilized to implement the SLAM algorithms. We could see the entire procedure due to the use of the RViz program. Additionally, the map was saved in the system. An ROS provides frameworks and tools for robot application and development. It includes components such as hardware abstraction, device drivers, libraries, visualizers, message forwarding, and package management. Mapping, localization, and autonomous navigation in an unfamiliar environment are all frequent challenges for autonomous mobile robots. An ROS serves as an operating system as well. The melodic release of an ROS was installed on a Linux workstation that was linked to  
Figure 5: YOLOv5 network structure. CBL: Conv2D+BatchNormNormal+LeakyRELU; Bottleneck CSP: Cross Stage Partial; SPP: Spatial Pyramid Pooling. LiDAR in the proposed project, and the data collected from LiDAR was used to generate a 2D map of the surrounding environment. Hector SLAM is an open-source method that employs a laser scan sensor to generate a 2D grid map of the surrounding area. In contrast to existing SLAM algorithms that rely on wheel odometry, this algorithm determines the location of the robot through scan matching. Due to its rapid update rate, LIDAR can perform the scan matching function to detect borders and objects quickly and accurately. The initial frame data generated by LiDAR is immediately utilized to create a graph of the home location, after which the sensor data is compared with the map and the optimal position for the LiDAR unit is chosen [21]. The Hector algorithm employs the Gaussian-Newton minimization technique [22], which is regarded as an update to the Newton method and eliminates the need to calculate second derivatives. By obtaining the transformation specified by Equation (1) [23], this method was used to determine the optimal endpoint of the laser scan in relation to the map. The optimal location of the LiDAR unit was then transmitted to the ROS-operating hector mapping node. This served as the algorithm's base link, and the odometry frame served as the base link and odometry frame for the algorithm by recording the ideal location of the LiDAR unit. Consequently, we were not required to provide odometry information. The optimal LiDAR position is represented as:  
\[\zeta=\big{(}P_{x},\ P_{y},\psi\big{)}^{T} \tag{1}\]  
The \(\zeta\) is calculated by an argument of the minimum:  
\[\zeta^{*}=argmin\sum_{i=1}^{n}[1-M(S_{i}(\zeta))]^{2} \tag{2}\]  
where \(S_{i}(\zeta)\) represents the coordinates \(S_{i}=\big{[}S_{ix},\ S_{iy}\big{]}^{T}\) of the endpoint coordinate of the LiDAR in the global coordinate system, as shown in Equation (3) below.