ArduPlane SITL Floating Point Exception

Hello,
I am trying to run ArduPlane with Mission Planner and X-Plane 10, and I have tried every approach (except using ArduPlane.elf which I can’t find in my cloned folder structure) from next two links:
https://ardupilot.org/dev/docs/sitl-with-xplane.html
https://ardupilot.org/dev/docs/sitl-native-on-windows.html
However, after at most a couple of minutes, sitl software breaks with a floating point exception

dumpstack_arduplane.3174.txt (9.2 KB)

Approach with sim_vehicle.py and FlightGear works without issues but I would really like to get it working with X-Plane. Any suggestions?

hello,

Thanks for the report we will look at it

Just a quick follow-up… I have tried the SITL configuration on three different machines. Two of them are Win 10 HP ProBook 6570b with AMD Radeon HD 7570M. Nothing I have tried on those machines worked, SITL software always crashes.
Third machine is Win 7 HP Probook 6570b with Intel (embedded) graphic. Most of the configurations I tried have failed, but currently it works with Mission Planner 1.3.61 build 1.3.6904.12435 and MavProxy 1.5.2.

Hi! I ran into what seemed like a similar issue with the AP3.9 bits which I’m using in SITL mode with X-Plane 11. I finally traced it to a divide by zero issue in get_servo_out() in AP_YawController.cpp in ArduPilot/libraries/APM_Control/. @khancyr, noticed that the ‘scaler’ parameter passed to get_servo_out() was not being checked before being used to compute float intLimScaled = _imax * 0.01f / (_K_D * scaler * scaler); It looks like this code has not changed in the latest version. I forgot to post something about it at that time. Hope this helps.

thanks that help ! I don’t have Xplane but that may be the root cause.

If you can share a way to reproduce the issue or try to have it crash in debug mode and send us the dumfile we would be able to confirm that the issue is here.

@khancyr, the problem used to happen very infrequently and almost a year ago. I do remember that even though I was running with a debug build of AP (for plane) under gdb, when the problem happened, I never got a stack trace! I remember having to insert printf’s at various places to narrow in on the problem location. Unfortunately, we don’t have the same environment anymore, so I am unable induce the issue and get a dump for you. I got around the issue by doing something like:
if (scaler == 0)
{
return constrain_float(_last_out * 100, -4500, 4500);
}
at the very beginning of the function. I know that use of the manifest constants is bad news, but it got us around the issue and we haven’t seen it since.

That original stacktrace seems to show a problem in the EKF, a very different layer to the yaw-controller problem you’ve found here.

A way to reproduce that EKF issue would be very welcome.

we may have two differents issues here

Were all of these cygwin setups?

Yes, all of these were cygwin setups.

For what it’s worth, a day or two after my last post, I built ArduPlane 3.9.11 on two machines and ArduPlane 4.0.0 on the third, and they have all worked without a single glitch up to now.