Parameters mismatch between MissionPlanner and aircraft model in Simulink

Dear folks,

Hello!

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.

  1. 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.

  2. 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!

Boris Georgiev

Hello folks,

The above mismatch between what the SIMULINK model calculates (body attitude angles, altitude, etc…) and what is actually displayed on the Mission Planer appears to be SOLVED in the following way:

If SITL (Sofware in the Loop) simulations are performed, the user should set the parameter AHRS_EKF_TYPE = 10 ( this parameter is located in the “Parameters list” in the Simulation menu of the Mission Planner)

The following two discussions explain more about this:

  1. SITL JSON Interface not working? (iampete’s reply)
  2. https://github.com/ArduPilot/ardupilot/issues/15671 (rmackay9’s reply)

Hope it is useful for those of you who perform SITL at any point!

All the best!

Boris Georgiev

Interesting, I noticed that parameter was at 10 a while back and wondered why when I used template parameters for an SITL simulation. Thank’s for the info,

By the way, consider signing my petition so we can more easily use our own firmware version at:

https://discuss.ardupilot.org/t/petition-for-us-to-choose-sitl-firmware-version/71778