iNavFlight / inav

INAV: Navigation-enabled flight control software
https://inavflight.github.io
GNU General Public License v3.0
3.09k stars 1.46k forks source link

Strange failsafe RTH behavior when RC lost & manual RTH #8000

Closed flyingzzy closed 2 years ago

flyingzzy commented 2 years ago

https://user-images.githubusercontent.com/50829593/166232682-b87885bf-5512-4469-8146-0564aa8666a2.mp4

Current Behavior

Mini Ar wing, all conditions are good. when about 5km far and 540m high, RC link got lost and the the Failsafe rth was trigered,but it doesnt just turn around and fly back ,instead, it loitered a few cycles and finally decided to emergency landing. in the video we can see when rth trigered,zhe plane began to turn back ,but the yaw angle seemed to be "frozen",that caused the FC to make more cycles, but the angle was still very strange , so the FC decided to land. the sensor was always good,even in earlly phase of this flight and in the following flights,it seems that somewhere hides a bug? note that when i switched to cruise mode and fly towards home direction,fs rth happened again,but this time it doesnt do any strange behaviors. so why?

Steps to Reproduce

1.FLY 2.far enough to lost rc link,live home behind 3.see what happens.

Expected behavior

when rc lost,the plane should go straight back home

Suggested solution(s)

Not sure.

Additional context

version

INAV/OMNIBUSF4V3_S6_SS 4.1.0 Apr 3 2022 / 21:33:23 (6e1dacba)

GCC-10.2.1 20201103 (release)

breadoven commented 2 years ago

The emergency landing was caused by Sanity checking, i.e. it flew 500m further away from home after the RTH was triggered. See https://github.com/iNavFlight/inav/blob/master/docs/Settings.md#nav_rth_abort_threshold.

Not sure why the RTH failed to go home though, difficult to say without a log. Were you manually correcting the CRUZ direction when the failsafe occurred ?

flyingzzy commented 2 years ago

i have found the reason. if rth is trigered while the plane is flying against home, fc try to turn around and fly abck,but the gyroscope seems working wrong,the yaw angle changes very slow, maybe the sensor was affected by the wires of the VTX.i have changed the wire routing,and will do a test later

flyingzzy commented 2 years ago

IMG_20220503_181600

breadoven commented 2 years ago

I doubt yaw related stuff is the reason. Far more likely related to this bug https://github.com/iNavFlight/inav/pull/7829.

If you were moving the pitch/roll stick when the failsafe occurred RTH Nav control would have become stuck in manual RC adjustment mode preventing RTH from navigating back home.

flyingzzy commented 2 years ago

@breadoven I have done a test with nothing changed. set vtx at full power, pick up the plane and turn a few circles, left and right. the gyroscope work very well. The reason seems to be a code bug, as you have found. I have met twice rth error recent days.

When signal was low, i was doing controls(moving sticks).

flyingzzy commented 2 years ago

Here is another video, pay attention to the home arrow and the yaw direction change, it seems to be frozen at some moment. At first i was flying at cruise mode and adjusting yaw direction, the rc signal was good. then i switch to RTH mode

https://user-images.githubusercontent.com/50829593/166957174-d7bc9941-a53d-4d46-8e3a-0469f3be9dec.mp4

breadoven commented 2 years ago

The bug mentioned above kicks in only if you're moving the controls at the moment the failsafe happens.

Looking at the recent video I'd say there is a problem with horizon drift. When the horizon in the camera view is level the roll angle is around 10 degrees when it should be zero obviously. That drunken rolling movement is what you see when horizon drift is affecting navigation. There is also maybe some drift on the pitch also, but not so obvious. A known problem with INAV, possibly worse on flying wings if they suffer from pitch oscillations.

flyingzzy commented 2 years ago

The bug mentioned above kicks in only if you're moving the controls at the moment the failsafe happens.

Looking at the recent video I'd say there is a problem with horizon drift. When the horizon in the camera view is level the roll angle is around 10 degrees when it should be zero obviously. That drunken rolling movement is what you see when horizon drift is affecting navigation. There is also maybe some drift on the pitch also, but not so obvious. A known problem with INAV, possibly worse on flying wings if they suffer from pitch oscillations.

I understand the reason of the first video,its a code bug which has been found and will be solved in the following release.

The horizon drift is another puzzle, it happens in every flight.If u continuous move the roll stick toward one direction,the horizon line will go wrong. To correct it,u can move the stick toward the other direction for a while, or u can switch to cruise mode to let the fc correct it. Will this problem be solved in the following release?

breadoven commented 2 years ago

Horizon drift is a long standing issue with INAV and won't get fixed until someone works out how to fix it. All you can do to minimise it is make sure the plane is mechanically well trimmed and PIDs well tuned to try and minimise pitch/roll oscillations, pitch oscillations in particular on a flying wing.

flyingzzy commented 2 years ago

@breadoven Here is another question, in early release i used to turn on altitude sidebar scroll arrow, but i found the move direction was wrong:if u dive,the sidebar arrow scrolls down. On real plane HUD it should scroll up. Do u know if this has been fixed or not? Screenshot_20220506_111430_edit_422201098399638