## 3 Methods
### Obstacle Avoidance  
In this study, a 2D LiDAR-based obstacle avoidance method is proposed. We use 2D LiDAR to finely sample the robot's surrounding environment. In the collection of data points obtained by LiDAR, each point is treated as an independent entity, and they play an  
\begin{table}
\begin{tabular}{c c c c c c c c c c c c} \hline \hline
**Number** & **AP50** & **AP55** & **AP60** & **AP6  
important role in path planning for obstacle avoidance. In order to improve data processing efficiency, a distance-based filtering mechanism is proposed and described by  
\[\text{error}_{\text{obs}}=\sum\text{gain}_{\text{d}}*(D_{\text{max}}-P_{\text{ dis}})+\text{gain}_{\text{a}}*\left(A_{\text{max}}-P_{\text{angle}}\right) \tag{13}\]  
where \(D_{max}\) is the maximum value of distance from the obstacle, \(P_{dis}\) is the actual distance with respect to the obstacle, \(A_{max}\) is the maximum angle with respect to the obstacle, and \(P_{angle}\) is the actual angle with respect to the obstacle. First only those data points that are larger than the default value \(D_{max}\) are filtered to exclude those that do not have a significant impact on the navigation decision. Among these filtered data points, this study further considers the distance and angle of each point to calculate the error value of the distance center. Specifically, the current position of the robot is assumed to be the origin, and according to Equation (13), each valid data point is converted into an error value, which is weighted according to its distance and angle relative to the current position of the robot. This process is similar to a weighted summation, where each data point will affect the moving direction of the robot.  
It is further understood that data points closer to the robot and directly in front of it have a greater impact. Therefore, these points are assigned higher weights in the algorithm. It ultimately integrates all these weighted data points into a single value, which provides the robot with real-time directional guidance. It is worth noting that the correlation between data points is not a critical factor in the decision-making process, so the proposed method also reduces computational complexity. As shown in Figure 6, the original data points (red lines) collected by the LiDAR and the important data points (dark red lines) are filtered and used to calculate the error. The algorithm integrates these weighted data points into a comprehensive error evaluation value through Equation (13), so that the robot can effectively avoid obstacles and stay within the predetermined path. One experimental video can be viewed on this website: [[https://youtu.be/kbgB1](https://youtu.be/kbgB1) MqsVRc]([https://youtu.be/kbgB1](https://youtu.be/kbgB1) MqsVRc) (accessed on 22 July 2024). From the actual experimental result, we can see that the proposed 2D LiDAR-based obstacle avoidance method can allow the implemented robot to avoid obstacles autonomously.  
An obstacle avoidance method based on 2D LiDAR is proposed. The proposed distance-based filtering mechanism can filter important data points and assign appropriate weights, which can effectively reduce the computational complexity and improve the robot's response speed to avoid obstacles.