# High-Fidelity Drone Simulation with Depth Camera Noise and Improved Air Drag Force Models
## 2 Depth Camera Modeling and Implementation
### Simulation Implementation and Results  
The depth camera model is implemented in the Airsim simulation to provide realistic depth camera functionality for drone simulations. As shown in Figure 6, the depth camera model (Equation (4)) generates a noise model based on the simulated depth value and subsequently applies it to the simulated depth value. In our work, we conducted simulations with a MSI laptop (Taipei, Taiwan) equipped with the following specifications: Intel i7-10750H processor, 16 GB DDR4 RAM, and an NVIDIA GeForce GTX 1660 Ti (laptop version). The simulation is run on Ubuntu 18.04 with ROS melodic version, Unreal Engine 4, Airsim, and PX4 programs [33]. Unreal Engine 4 was responsible for visualization of the simulation and enabled the creation of simulation environments with obstacles. On the other hand, PX4, an open-source drone control program, provided simulated internal sensors such as IMU and barometer [34; 35]. Airsim links PX4 to Unreal Engine 4 and allows for the attachment of GPS, RGB camera, and depth camera to the simulated drone [26], as well as the ability to perform collision detection and map-scanning. When a control command is input into PX4, the control value is calculated, and the simulated drone begins to move [35]. The simulated drone's position, velocity, and rotation are calculated in Airsim and visualized in Unreal Engine 4. Figure 5a illustrates that all pixels of the depth camera from the simulation have true depth values, while Figure 5b demonstrates the implementation of the fill-rate error in the simulation. Figure 6 provides an overview  
Figure 4: Comparison between real standard deviations of the depth errors and simulated standard deviations of the depth using our depth noise model for (**a**) cement, (**b**) formboard, and (**c**) plastic materials. Figure 5: (**a**) Simulation depth camera value, (**b**) value with fill-rate error implemented. of the implementation of our depth camera noise model in simulation. We subscribe to the depth camera topic from Airsim to obtain depth information for the camera depth noise model. This information is used in our ROS package to compute Gaussian noise, following Equation (4). Subsequently, we publish the resulting noise values back to Airsim through another topic. The depth noise calculation at each pixel includes 2 multiplications and 1 exponential calculation. Its required calculation time depends on the processor's capabilities. The complexity of the algorithm is then \(\mathcal{O}(n)\), where n is the number of depth points. Using our hardware setup, it takes approximately 0.0121 s to calculate the depth noise data for 460 \(\times\) 320 pixels. The depth camera noise topic is then published back to Airsim at a rate of about 30 Hz, enabling real-time usage. Figure 7a,b demonstrate how the depth value appears as a pointcloud when the material value is altered, causing the simulated measurement of a wall to appear thicker due to increased noise. To further evaluate our model, the coefficient of determination (\(R^{2}\)) value was calculated between two standard deviation data sets for each material. One set is the standard deviation values calculated from a real environment using Intel Realsense D435 depth camera, while the other set is standard deviation values calculated from simulation using our depth camera model. Each set has 751 values as described in Section 2.2. \(R^{2}\) values are shown in Table 1. The average coefficient of determination (\(R^{2}\)) value is 0.6204, indicating that the depth camera noise model can accurately simulate different noise levels for different materials. However, it is important to note that the model errors tend to increase with distance. It is observed that the model performs optimally in the distance range from 0.5 m to 3 m (ideal range for D435 [36]) with an average \(R^{2}\) of 0.92 for all materials (0.89 for plastic walls). In the range from 0.5 m to 6 m (the maximum range for drones), those values decrease to 0.73 and 0.5948, respectively.