I would like to ask for support regarding an issue when doing Software in the Loop (SITL) simulation.
I have a fixed-wing aircraft model in Simulink (R2021a) and it is successfully connected to ArduPlane autopilot via the JSON format. Subsequently, MissionPlanner is used to observe aircraft behavior and set missions.
As required, the Simulink model sends the following parameters to the SITL(i.e. Autopilot); time, acceleration (w.r.t the body fixed frame), position (w.r.t flat earth frame which is North,East,Down), velocity (again w.r.t flat earth frame which is North,East,Down), angular rates (w.r.t body fixed frame), body attitude angles (roll, pitch, yaw).
Unfortunately, soon after the aircraft takes off and starts gaining altitude and/or rolling a mismatch appears between the displayed parameters in the Mission Planner and what the actual model in Simulink calculates as final values for the aforementioned parameters.
I attach a picture to better illustrate the problem - please refer to the red circles in the image.
Regarding the aircraft height above ground frame (North-East-Down), Mission Planer indicates 98m ,while Simulink model calculates 90.71 (mu,l,h) and x,y,z (NED) and sends the array (x,y,z (NED) to the SITL.
Regarding the ROLL, PITCH and YAW angles, Mission Planer indicates approximately 30deg for ROLL angle , 39deg for YAW angle, while Simulink model calculates 15.27 deg for ROLL angle and 67.7deg for YAW angle and sends the array with attitude angles (phi,theta,psi) to the SITL. Additionally, I believe that there is the same problem regarding the pitch angle. Simulink model calculates 0.5618 deg, while Mission Planner again indicates a greater value.
Finally, I would like to note that the parameter AHRS_EKF_TYPE is set to equal 0 in the CONFIG menu of the MissionPlanner, meaning that the Extended Kalman Filter is disabled. Reason for doing is to avoid errors, I believe.
I hope that you guys can shed more light on the reason behind this.
Thank you very much in advance for the spend time and attention!
All the best!