Why switching to 'Circle' while not commanded to do so?

Hey all,

My colleagues in the lab did a test last week to test the 2.76 code on our plane RC C17, with the modified PID parameters. The P term for roll and pitch were a bit high to get the plane flying, they are 3. they set a value of 0.1 to the I and D terms too.

The RC transmitter was not working, so they used a joystick. The flight was planned to be in AUTO mode from takeoff to landing.

The plane took off nicely, but then it switched to ‘circle’ with no obvious reason. The plane crashed after switching to this mode, basically the engines were turned off!!

We flew this plane long time ago successfully using very old version (2.43 i guess), but we would like to stick to the new version (2.76)

I would appreciate if some one can help me to analyse the log file, and find out what was the cause of this

The .log file is here
dropbox.com/s/5s7h4jznilarx … 37%205.log

and here is a video of the flight.
dropbox.com/s/jqe262rr0u08u … ember3.mp4


I haven’t had a chance to look at the logfile but it sounds like it entered a failsafe condition: plane.ardupilot.com/wiki/ardupla … -function/
It supposed enter circle mode for 20 secs then RTL if setup correctly, circle mode should however maintain height so the motors should not have switched off.

Thank you. Actually I solved the problem. It was a bug in the code that I added.