## 5 Underwater Data Muling Simulator (UDMSim)
### AUV Motion and Localization Simulator  
The overall structure of the AML simulator is presented in Figure 7. AML implements a six degrees of freedom (DoFs) model of the AUV [49; 50]. The model is based on the standard nonlinear dynamics and kinematics equations for an underwater vehicle [51] whose parameters have been previously derived and validated. This provides a realistic simulation of the vehicle although the _exact_ models are very difficult or even impossible to derive. Along with the vehicle model, a target-tracking control algorithm running onboard the (real) vehicle is emulated, having the reference position (SU) and its own state (position and velocity) as inputs. The algorithm generates actuation commands to the thrusters on the output side. AML outputs a set of traces that define the \"real\" 6-axis position of the AUV (x, y, z, yaw, pitch, and roll) over the mission. In general, underwater vehicles do not know their location perfectly. Their pose estimation relies on state estimators that fuse data coming from multiple sensors. As the sensors are corrupted by noise and other undesired effects, as described in Section 3.2, the resulting estimate is imperfect. This adds a time-varying error to the true state. Moreover, it has impact on the vehicle tracking performance as the controllers rely on the estimate to generate actuation commands. Although an appropriate choice of sensors may mitigate the problem, there is no way to circumvent estimate errors. Additionally,  
Figure 6: UDMSim block diagram. the enhanced estimation model, illustrated in Figure 7, is deliberately set with parameters that differ from the nominal model, aiming at bringing more realism to the simulation when compared with the previous models presented in [52]. In this model, the parameters were deliberately set with errors up to 50% of their nominal values. Details on the derivation of the extended Kalman filter and on the control laws are beyond the scope of this article. The simulation is run on Matlab Simulink, with a timestep of 10 ms, employing an ODE4 solver. The measurements from the sensors are set to be periodically output, at a constant rate. In simulation, each sensor block receives as inputs the state variables from the vehicle model and other quantities such as the magnetic field vector and the absolute position of the SU. Then, it outputs the corresponding measurement to feed the EKF state estimator, as shown in Figure 8. To bring more realism to the simulation, it should be noted that some sensors may not provide measurements over the entire mission. For example, the camera tracks artificial markers that are assumed to be undetectable at distances over 2 m. This takes into account the common visibility issues found in the underwater environment due to turbidity and rapid attenuation of optical waves. Moreover, the measurements are not available when the markers fall outside the field of view of the camera. The pressure sensor measurement is modeled as a Gaussian distribution with a mean corresponding to the pressure of the column of water and a standard deviation to model the measurement error. The IMU is modeled as a three-axes accelerometer, a three-axes gyroscope, and a three-axes magnetometer. The measurements of the accelerometers account for the acceleration of the vehicle, as well as for the effects of gravity. The measurement variances of the accelerometers and gyroscopes are calculated based on the bandwidth and the noise power spectral density of the sensors. Each measurement of accelerometers and gyroscopes is further added to a constant bias. The magnetometers measurements are based on the Earth's magnetic field mapped in the varying referential frame of the vehicle. The magnetometer variance is modeled as the total root mean square noise of the sensor. The USBL measurements are composed of a set of times of arrival (TOAs) to each of the four hydrophones in the USBL receiver located in the DMU.