Hi Sami,
It is my understanding that you are getting discrepancies while reading ground truth data during an UAV flight simulation. To debug the issue, you can check the following environmental conditions and sensor characteristics:
- Use high-fidelity models: the created models should account for noise, bias, and other sensor-specific characteristics
- Synchronize Data Sources: Ensure that the data from the ideal sensor model and the UAV platform (‘plat.read()’) are synchronized in time. Discrepancies can arise if there is a time lag between data sources.
- Fusion Algorithms: Use sensor fusion algorithms, such as an Extended Kalman Filter (EKF), to combine data from multiple sensors (e.g., accelerometer, gyroscope, and magnetometer). This can help improve the accuracy of your ground truth data by leveraging the strengths of each sensor.
- Compare with Known Reference Points: Use known reference points or trajectories in your simulation to validate the sensor readings. For example, if the UAV is supposed to fly in a straight line, verify that the magnetometer readings reflect this trajectory.
- Post processing: After the simulation, perform post-processing to compare the ideal sensor data with the platform readings. Apply any necessary corrections for known biases or errors.
For more information regarding the above, you can refer the following resources:
- IMU and GPS Fusion for Inertial Navigation - https://www.mathworks.com/help/fusion/ug/imu-and-gps-fusion-for-inertial-navigation.html
- Simulating Unmanned Aerial Vehicles (UAV) with MATLAB and Simulink - https://www.mathworks.com/videos/simulating-unmanned-aerial-vehicles-uav-with-matlab-and-simulink--1541161299465.html
- Simulation for UAV - https://www.mathworks.com/help/uav/ug/3d-simulation-for-unmanned-aerial-vehicles.html
Hope this helps!