inav icon indicating copy to clipboard operation
inav copied to clipboard

Failsafe RTH disarms the machine in some cases

Open digitalentity opened this issue 9 years ago • 31 comments

Per @sppnk

I am having big problems with my failsafe configuration. I am not sure if the openlrsng receiver is missconfigured or it is my Inav configuration.

If I signal FAILSAFE by switch, it works well and do RTH.

But if I turn off the transmitter or go out of range, sometimes the plane disarms in flight and I have no control of it althought I turn on again the transmitter. Is it trying to land? Almost lost a plane yesterday.

I have it configured to RTH. All parameters default. GPS I guess doesnt have any glitches.

When I turned off my transmitter in flight I did that almost when plane was over home position or very close. Several times. I didnt want to test that far away Could be the plane started to land ? BUT I had no control over it (when I switched on of course)

digitalentity avatar Mar 03 '17 13:03 digitalentity

Sub-bugs:

  • If machine is close to home failsafe RTH won't activate and failsafe will disarm the craft
  • Any exit from RTH_IN_PROGRESS state during failsafe RTH will cause disarm

digitalentity avatar Mar 03 '17 13:03 digitalentity

Solution:

  1. Smarter interaction between navigation core and failsafe system - don't treat non-active RTH as a failsafe abort. In case of failsafe event if RTH is unable to activate it should fallback to emergency landing.
  2. Emergency landing should be treated as part of Failsare-RTH handling.
  3. Disredard minimum distance to home in case of Failsafe-RTH event.

digitalentity avatar Mar 03 '17 14:03 digitalentity

Is quite hard and sad to see how a friend losses the control of his flying wing caused by a bug that hasn't been tested before the latest version has been released (click the picture to see full video of the crass):

Reptile s800 killed by iNav

Not only failsafe has a bug, also enabling horizon start causing problems. If you want more details of what happens during the flight I will be very pleasant to explain every thing second by second.

We were very excited with the release, but we are seriously thinking of abandoning the idea of continuing being beta tester.

raul-ortega avatar Mar 03 '17 17:03 raul-ortega

@raul-ortega Your plane was not in Failsafe, it looks more like a momentary power surge that disarmed it. Look at the picture power fail copy

Redshifft avatar Mar 03 '17 18:03 Redshifft

@raul-ortega Yes, I believe you suffered a power surge and this caused the flight controller to reboot.

How is the wiring done? Seperate BEC from servos and FC or shared?

Issue is after and reboot in air, the GYRO cannot do its calibration, and all other modes will fail. You need to switch into passthrough.

( I must add that I been an tester since the fixedwing early days of INAV, and have yet to crash and airplane where I can blame it on INAV. I have tested features before the even came into develeopment branch and was far from finished. )

oleost avatar Mar 03 '17 18:03 oleost

I to am curious, according to the video posted it never showed it was in failsafe (RTH) mode, showing disarmed in Horizon mode.

tonyintn avatar Mar 03 '17 18:03 tonyintn

Ok about the shapshot of the video frame, but the crash more or less one minute after that, just when the pilot (my friend) activated failsafe from a switch on the transmiter. This is the explanation of what happened in the previous moments of the crash:

"..I was flying in Acro until minute 4:33, when I activated STAB again, and at minute 5:44 I activated the HOLD, and the plane was responding well and made 2 circles arround the point where it was flying.

In this moment the main problem began. I SWITCHED ON THE FAILSAFE MODE, with the intention of testing the RTH procedure, but instead of returning, It ignored it and followed flying without control, It leaves the return to home and makes a straight flight, before the total loss.

As there were no response from the plane, I changed from HOLD moe to STAB mode at minute 6:45, and I lost control at 6:55."

raul-ortega avatar Mar 03 '17 19:03 raul-ortega

This is what I think that could be happening after the reset of the board (minute 4:58):

The arming contitions are fullfiled for armed, and continues flying. Home is established because it has fix and enougth sats. Failsafe is activated manually, the plane is close to home (distance and altitude), then it disarms the motor thinking that the plane has landed.

If it is as I say, it is really a very dangerous bug.

The resetting of the board is also very strange because that board has been flying before with other aircraft (a multirrotor) with a differnet firmware (cleanflight).

raul-ortega avatar Mar 03 '17 20:03 raul-ortega

Issues with airplanes is servo that can draw alot of power, especially if they get stuck.

But it would be helpful to share CLI dump and hopefully blackbox log of the event.

oleost avatar Mar 03 '17 20:03 oleost

I'm not so sure on power reset... see how the GPS data continues to update with no delay. Sure you would see a short blip.

Also I had similar issue with patrike fixedwing a couple of times. I figured out my issue was this...

Flying ok like in vid. Had a rx glitch which made FC think it was receiving switch input to disarm. glitch was very short, but because throttle was on like in video, it wouldn't re-arm. Happened a few times before I figured out. Since then I don't use arm switch.

MAybe that is part of issue?

ShikOfTheRa avatar Mar 03 '17 20:03 ShikOfTheRa

It is not a power reset, it is caused exactly when the failsafe mode is switched on manually by the pilot, on 6:56 (on time in the osd).

raul-ortega avatar Mar 03 '17 21:03 raul-ortega

@raul-ortega Can you list your full hardware specs, Bec, servos OSD etc etc ?

Redshifft avatar Mar 03 '17 21:03 Redshifft

@ShikOfTheRa strange no speed was displayed after the "glitch" I think it's that dodgy old OSD firmware :D LOL Another good one I would not discount is people put other flight modes the other side of "dangerous" ones, not thinking they cycle past them when they throw the switch ;)

Redshifft avatar Mar 03 '17 21:03 Redshifft

Osd sets distance to zero when disarmed.

Perhaps osd caused It. It wouldn't be first time :)

Good point on bad arm position. I did that on one build until I realised it was bad idea. Trying to make most out of switch positions, centre was disarmed. Toggling between other two caused similar issue.

ShikOfTheRa avatar Mar 03 '17 21:03 ShikOfTheRa

I have attached the configuration (complete dump): flip32-crashes-iNav1.6.txt

raul-ortega avatar Mar 03 '17 21:03 raul-ortega

Please, there is not place for speculations about what causes the disarming, it happens exactly when the pilot activates failsafe mode manually from the transmiter. Everything that appears on the OSD affter that instant is as consecuence of the disarming issue.

raul-ortega avatar Mar 03 '17 22:03 raul-ortega

@raul-ortega pity to hear about your friend's crash. I'm not that different - also have lost a plane recently - due to a power failure.

I doubt this is the case of exactly this bug - "disarm-close-to-home bug" was there from day 1 and we never hit it before because it can only manifest very close to home (5m by default). I personally tested failsafe RTH in 1.6-ALPHA's and it was fully functional otherwise I wouldn't have released the new version.

I must admit that not all scenarios were tested - as you can understand it's hard to test momentary GPS loss or power failure. Without a blackbox log it's really impossible to say what was happening under the hood, so we can only guess.

How is your friend's failsafe configured? No pulses? Pre-set value? Other?

digitalentity avatar Mar 03 '17 22:03 digitalentity

@ShikOfTheRa No I was joking, can't see the OSD causing it :) yes jumping across a mode has no doubt caught out a few.... @raul-ortega , That was just a FW dump, do you have a list of the components ? If you have changed your mind and now don't want to discuss the details I think it only fair you delete your post.

Redshifft avatar Mar 03 '17 22:03 Redshifft

@raul-ortega I know what was the cause of your particular issue - it's totally user error. From your dump I figure that you have

set failsafe_kill_switch = ON

This setting means that failsafe will instantly disarm the machine bypassing everything else you might have condifured - so when you flipped the FAILSAFE switch the plane did exactly what it was configured to do. This is mentioned in the docs https://github.com/iNavFlight/inav/blob/master/docs/Failsafe.md#flight-controller-failsafe-system, however most of us don't read docs

digitalentity avatar Mar 03 '17 22:03 digitalentity

I have to remind everyone once more - always test failsafe on the ground first. You'll avoid many hairy moments and save developers some time to figure out something that is not a bug.

digitalentity avatar Mar 03 '17 23:03 digitalentity