4.1. Depth Accuracy Comparison
To validate the credibility of the Intel RealSense D435i model in the Gazebo simulation environment, a two-stage experimental procedure was designed. The first stage evaluated the stability of a single pixel measurement, followed by a multi-point sampling analysis to examine trend consistency. This experiment was designed as a preliminary sensor-model consistency check and does not represent full UAV sensing validation.
The experimental setup is illustrated in
Figure 10. Three fixed obstacles were positioned in front of the camera at distances of 1.0 m, 1.5 m, and 2.0 m, respectively. Both the simulated and physical environments were configured to maintain consistent viewing angles, lighting conditions, and spatial arrangements to ensure data comparability.
The experimental results are illustrated in
Figure 11, with the corresponding statistical data summarized in
Table 5 and
Table 6.
In the single-pixel evaluation, the simulated camera exhibited a systematic overestimation in depth output, with mean absolute errors ranging from 3.40 to 6.82 cm. Notably, the standard deviation remained below 0.12 cm, indicating a high degree of output stability. In contrast, the physical camera’s measurement error fell within the manufacturer’s specified accuracy range (±2–4 cm), with standard deviations between 0.2 and 1.4 cm, reflecting greater variability due to lighting conditions and surface material properties.
Both systems demonstrated optimal performance at a distance of 1.5 m, where the physical camera achieved a minimal error of only 0.73 cm.
In the multi-point sampling experiment, the results were consistent with those obtained from the single-pixel analysis. The simulated camera continued to exhibit systematic overestimation while maintaining low measurement noise. The physical camera achieved its highest accuracy at 1.5 m, with a mean error of 1.10 cm and an RMSE of 1.21 cm.
As the distance increased, the discrepancy between the simulated and physical measurements widened, with the mean difference expanding from 0.7 cm at 1.0 m to 9.7 cm at 2.0 m. This phenomenon is primarily attributable to the simplified modeling of illumination, surface reflection, and depth return mechanisms within the Gazebo simulation environment. These findings indicate that although the simulated system can provide consistent and low-noise depth data, calibration against physical measurements remains necessary to ensure practical reliability.
4.2. SLAM Localization Error Using Simulated Ground-Truth Pose Analysis
To evaluate the localization accuracy of the SLAM system, the estimated positions were compared with the simulated ground-truth pose provided by the Gazebo/ArduPilot SITL environment. Experiments were conducted in three obstacle-density scenarios—low, medium, and high—each comprising five traversal missions and five return missions.
Because the SLAM map is constructed in a relative coordinate frame, its initial origin and orientation do not coincide with those of the GPS reference frame. Therefore, prior to error computation, coordinate alignment and rotational transformation were performed to ensure that both trajectories were evaluated within a common reference framework.
To compensate for discrepancies between the SLAM and GPS coordinate systems, four alignment strategies were applied prior to error computation:
Original: No alignment was performed; the two trajectories were compared directly.
Rotated: A fixed angular correction was applied to adjust the overall orientation.
Best angle: An optimal rotation angle within the range of 0–180° was determined by minimizing the RMSE.
Initial angle: Alignment was conducted based on the initial directional vector, simulating a practical real-time application scenario.
To evaluate localization accuracy, three commonly adopted error metrics were employed: RMSE, Mean Error, and Maximum Error. Their computational formulations and interpretations are described as follows.
First, RMSE was utilized to quantify the overall deviation between the SLAM-estimated and GPS-referenced coordinates, thereby reflecting the global stability of the localization system. The definition is given in Equation (15):
where
denotes the total number of data points, and
and
represent the SLAM and GPS coordinates of the
-th data sample, respectively.
The Mean Error represents the average Euclidean distance between corresponding coordinate pairs and is used to characterize the overall positional deviation trend. Its formulation is provided in Equation (16):
The Maximum Error is employed to identify the largest deviation among all sampled points, thereby capturing potential extreme discrepancies that may occur in specific trajectory segments during SLAM operation. Its formulation is presented in Equation (17):
In this study, five traversal missions and five return missions were conducted in each obstacle-density environment to compare localization errors between SLAM and GPS. The corresponding statistical results are summarized in
Table 7.
As illustrated in
Figure 12a and
Figure 13b, under the unaligned condition, the RMSE values for the traversal and return missions were 25.93 m and 23.48 m, respectively, indicating substantial discrepancies between the original coordinate frames. Following alignment, the errors were markedly reduced. Among the evaluated strategies, the Best Angle method achieved the lowest RMSE, reducing it to 0.183 m for traversal and 0.473 m for return missions. The Initial Angle method yielded RMSE values of 0.197 m and 0.474 m, respectively, demonstrating performance comparable to that of the optimal rotation approach.
It should be noted that the Best Angle method requires access to the complete trajectory to search for the optimal rotation angle and is therefore applicable only to offline analysis. In contrast, the Initial Angle method estimates the coordinate misalignment based on the initial heading vector and vehicle orientation at the beginning of the mission, and applies the corresponding correction without relying on GPS throughout the entire trajectory. As a result, it exhibits greater potential for real-time deployment.
The error performance of the Initial Angle approach is nearly identical to that of the optimal rotation method, indicating that it can maintain stability and accuracy during return missions as well. This demonstrates its practical feasibility. Accordingly, subsequent experiments and result analyses focus primarily on comparisons between the Best Angle and Initial Angle strategies.
A further examination of the localization error trends during traversal and return missions indicates that the observed differences are primarily associated with flight maneuver characteristics.
In the traversal mission, as shown in
Figure 12b, the discrepancy between SLAM and GPS remains generally stable, demonstrating satisfactory temporal continuity and error convergence of the system. However, a pronounced increase in the error curve is observed between approximately 37 and 100 s. By correlating this interval with the yaw angle variation depicted in
Figure 12c, it is evident that the UAV executed multiple turning maneuvers for obstacle avoidance during this period. Frequent directional changes induced abrupt shifts in the camera’s field of view, thereby destabilizing visual feature matching and temporarily increasing SLAM trajectory estimation error.
In the return mission, as illustrated in
Figure 13b, the error curve remains relatively stable during the initial phase of the task but exhibits a pronounced increase after approximately 150 s, corresponding to the UAV’s execution of an approximately 180° turning maneuver. This large-angle rotation introduced a directional deviation in SLAM pose estimation, resulting in a temporary degradation of localization accuracy. The yaw angle variation shown in
Figure 13c further corroborates this turning behavior.
Nevertheless, as the UAV gradually approached the initial position and reoriented its heading, the loop closure mechanism successfully matched historical visual features, thereby correcting the accumulated localization error. Consequently, even within the medium-density environment, the system was able to effectively constrain localization error within ±0.5 m through the combined effects of loop closure detection and initial orientation alignment, demonstrating both stability and practical applicability.
In the low-density obstacle environment, five traversal and five return missions were likewise conducted to compare SLAM and GPS trajectories, with the results presented in
Figure 14 and
Figure 15. Overall, the localization error curves remain stable with minimal fluctuation, indicating that the SLAM system maintains strong temporal continuity and error stability in open environments.
With respect to alignment strategies, the Best Angle method again achieved the lowest error, yielding RMSE values of 0.193 m for traversal and 0.281 m for return missions. The Initial Angle method produced comparable results of 0.195 m and 0.295 m, respectively.
The limited increases observed in certain segments of the error curves correspond to UAV turning maneuvers, as illustrated in
Figure 14b,c and
Figure 15b,c, though their magnitudes are substantially lower than those observed in the medium-density scenario. In comparison, the maximum localization errors for traversal and return missions decreased by approximately 0.07 m and 0.32 m, respectively. These findings further substantiate the influence of environmental occlusion on the stability of visual SLAM algorithms.
In the high-density obstacle environment, comparisons between SLAM and GPS trajectories for traversal and return missions are presented in
Figure 16 and
Figure 17. Using the Best Angle strategy, the RMSE values were 0.347 m for traversal and 1.022 m for return missions. The Initial Angle method yielded RMSE values of 0.420 m and 1.084 m, respectively. These results indicate that even under the optimal alignment strategy, the return mission error remains substantially higher than that of traversal, with a difference of approximately 0.67 m.
The error curves exhibit frequent fluctuations, including multiple segments of abrupt error escalation, corresponding to repeated turning and obstacle avoidance maneuvers within confined spaces, as shown in
Figure 16b,c and
Figure 17b,c. This phenomenon reflects the increased likelihood of visual feature loss or mismatching in complex terrains, leading to transient drift in SLAM estimation. Notably, during the return phase, the time required for the error to recover to a stable level is significantly prolonged, indicating that the corrective effectiveness of loop closure detection is constrained under conditions of severe environmental occlusion.
Across the three obstacle-density scenarios, the UAV successfully completed both traversal and return missions in all cases. Overall, localization error during traversal missions was consistently lower than that observed during return missions. The former benefited from a more uniform path direction and sustained visual continuity, whereas the latter involved frequent turning and large-angle maneuvers, leading to feature loss and increased estimation uncertainty.
Environmental density was also found to exert a significant influence on localization accuracy. In the high-density scenario, the maximum RMSE reached 1.084 m. The localization errors were evaluated with respect to the simulated ground-truth pose. A direct comparison with real GNSS performance is not considered a fair comparison in this study.
4.3. Localization Error Analysis Under Varying Exploration Orientations and Starting Configurations
To evaluate the robustness of the SLAM system under different initial conditions, two experimental scenarios were designed. The first scenario fixed the starting position while varying the exploration direction; the second maintained a constant exploration direction while altering the starting position. In each of the three obstacle-density environments, five traversal and five return missions were conducted, with performance assessed using RMSE, Mean Error, and Maximum Error.
For each exploration orientation and starting configuration, multiple traversal missions were performed to compare localization discrepancies between SLAM and GPS. The statistical results are summarized in
Table 8, and representative trajectories under different initial conditions are illustrated in
Figure 18.
In the medium-density environment, when the starting position was fixed at the center of the map and traversal missions were executed along different exploration directions, the error magnitude exhibited moderate variation depending on the selected heading. For example, along the 330° northwest and 45° northeast directions, the RMSE after initial orientation alignment was 0.438 m and 0.373 m, respectively, representing an increase of approximately 0.15–0.30 m compared with the northbound mission (0.197 m).
The corresponding error curves and yaw angle variations are presented in
Figure 19. When the exploration direction deviated from the forward-facing orientation, the UAV was required to perform more frequent turning and obstacle avoidance maneuvers, resulting in amplified heading fluctuations and consequently elevating the risk of cumulative SLAM estimation error.
These findings indicate that although directional variation influences localization accuracy to a certain extent, the system is nevertheless capable of maintaining stable positioning performance.
When the exploration direction was fixed at due north (0°), but the starting position was set at three different locations (0, 0), (6, −2), and (−6, 4), the corresponding RMSE values were 0.197 m, 0.349 m, and 0.249 m, respectively. Although variations in the starting position introduced differences in the early-stage trajectory, the final localization error in all cases remained within 0.40 m.
The associated error curves and yaw angle variations are presented in
Figure 20. Changes in the starting position primarily affected the frequency of obstacle avoidance maneuvers during the initial navigation phase; however, no substantial difference was observed in overall SLAM accuracy. These results demonstrate a high degree of tolerance to initial position variations within the proposed system.
The overall results indicate that variations in exploration direction, due to differences in obstacle distribution, may increase the frequency of turning maneuvers and attitude adjustments, thereby leading to a moderate rise in localization error. In contrast, changes in the starting position primarily affect the initial path planning phase and exert only limited influence on the final localization accuracy.
In general, even under conditions where both exploration direction and starting position are altered, the SLAM error remains consistently within ±0.5 m. These findings validate the adaptability and operational flexibility of the proposed system.
4.4. Navigation with Dynamic Obstacles
To evaluate the system’s real-time responsiveness and obstacle avoidance capability in dynamic environments, additional obstacles were manually introduced along the predefined navigation trajectory within the low-density map, simulating unexpected disturbances that may occur in forested scenarios. During the experiment, RTAB-Map continuously updated the map representation, while move_base (DWA) performed real-time local replanning, enabling the UAV to successfully circumvent the obstacles and complete the mission.
The evaluation focused primarily on obstacle avoidance success and path deviation characteristics, with qualitative validation provided through visualization results in RViz and Gazebo.
Figure 21 and
Figure 22 illustrate the UAV navigation trajectories during traversal and return missions, respectively, when dynamic obstacles were introduced. The following observations can be made:
Dynamic sensing and replanning: Once an obstacle entered the sensing range, the depth camera output promptly updated the local costmap, while the SLAM module simultaneously incorporated the newly detected obstacle into the map representation. The navigation module subsequently triggered real-time path replanning.
Obstacle avoidance behavior: The UAV adjusted its heading prior to direct interception with the obstacle, generating a detour trajectory. After clearing the obstacle, it resumed its original navigation direction.
Success rate: Across five experimental trials, the UAV successfully avoided the introduced obstacles and completed both exploration and return missions, demonstrating the reliability of the proposed system.
The system was evaluated in a Gazebo simulation environment, where manually introduced sudden dynamic obstacles were placed approximately 1–2 m in front of the UAV during navigation. The experimental results demonstrated that the system could update the SLAM map and costmap in real time and perform local path replanning through the DWA module, thereby effectively avoiding collisions while continuously executing the navigation task.
It should be noted that this experiment is a qualitative demonstration of dynamic-obstacle response. Quantitative metrics such as replanning latency, minimum obstacle clearance, path-length increase, and mission completion time were not systematically evaluated. In addition, quantitative success rate and mission completion metrics were not systematically evaluated. Therefore, the results should be interpreted as preliminary evidence of local replanning capability.