-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Landing detection revamp #7270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Landing detection revamp #7270
Conversation
|
Awesome! I've been thinking about doing something like this for a while. I can't test or review the code right now but I'll be sure to do that once I'm back from vacation. |
|
This issue / pull request has been automatically marked as stale because it has not had any activity in 60 days. The resources of the INAV team are limited, and so we are asking for your help. |
|
@breadoven do you think we should merge it for 5.0? |
Well I've been using it for a while and it hasn't produced any false landings whilst still detecting landings when it should. I was hoping for some feedback but since there hasn't been any I guess it should be OK to include in 5.0. I'll add in something related to #7068 and remove Draft status. Probably needs a warning though initially to be careful using it with Disarm on landing set, at least until you're happy it isn't throwing up "LANDED" in the OSD when it hasn't. |
|
@breadoven please resolve conflicts and we should merge it to 5.0 |
|
@breadoven I ran some multi-rotor tests today, with a build containing this PR. I then load a firmware I had from the master a week ago. |
I take it this was a RTH landing ? Was there any indication landing had been detected, motors returned to idle or a message in the OSD "LANDING DETECTED" ? What size quad was it ? Should be able to test myself in the next few days with some better weather for a change. |
|
Yes, it was landing after RTH. Once it completed the landing slowdown and touchdown, the motors did return to idle. The quad would try to move on the pitch and roll axis's while on the grass, trying to detect flight. This is a 3"quad I use for testing. |
|
@Jetrell So I tested this by "hand flying" and it was detecting landing with a quad both for RTH and otherwise. For RTH it correctly enters and follows the routine used previously, waits a second for the throttle to stabilise and then checks the throttle during descent so the logic and timings all work as before (I had to rejig the code a bit to account for some constants that had been added which could have caused some basic error but that isn't the case in fact, all works OK) . I'll check again during flight but I don't see that anything will change other than it being more reliable than simulating a landing by hand. Only thing I can think of is the landing detector isn't initialising after take off. It needs the throttle to exceed I'll add a LANDING debug which should help understand what's happening. |
|
You should be able to use the hex from the run for the PR adding a LANDING debug: https://github.com/iNavFlight/inav/actions/runs/1986047348 |
|
Sorry.. I hadn't noticed that you'd already made a fix 👍 |
|
The debug fields for Landing are: 0 - landing detector active Landing detected when 6 < 7 for RTH landing (maintained for set safety time delay) |
|
I set I tested RTH landing again a few times. Both with the debug addition and the original landing detection. These log images are when the quad is on the ground, after landing. |
|
Right the answer is very simple, the landing detector routine isn't running at all because there is a The |
|
@breadoven Just to confirm, MR nav auto disarm works again as expected. Can I ask you a little more of what to expect from the Landing detector, for both MR and FW.
Thank you. I appreciate your efforts to write this feature... Any information you can give me to help understand its operation better, would help me with testing it. |
|
The landing detector needs to detect flight before it becomes active. Flight is detected on a FW based on speed, valid heading and throttle > cruise throttle OR a successful auto launch. It's detected on a MR just based on throttle > hover throttle and gyro movement, Once active the detector only starts checking for a landing when certain basic criteria have been met which are:
*On a multirotor if WP mode is active and If the basic criteria are met to start checking for a landing then the following specific checks are made:
Multirotor
If not in autonomous flight or Failsafe the throttle needs to be low in order to start detecting a landing so if you land manually you need to cut the throttle to detect the landing. You can active the landing detector on a fixed wing for ground test by doing a dummy launch otherwise it needs to fly because it requires a valid heading. Once active it should detect a landing simply by cutting the throttle and placing it on the ground so it's not moving. It can take up to 8s or so to trigger after flight mainly because even minimal horizon drift causes the pitch/roll axes to continue moving even when the plane is static. The issue with multirotors and a manual landing is they tend to be a bit skittish sitting on the ground after landing with airmode active which makes it harder to achieve the velocity and gyro limits although from tests it does get there eventually but may take up to 8s again. Land on a slope though with horizon active and it probably won't work, too much movement with one end effectively still flying. No GPS lock required for FW or MR, landing should be detected flying manually. |
|
@breadoven Thanks mate for all the information. It was very useful. I ran some more MR tests. It disarms perfectly on grass or a firm surface in Angle or Horizon modes, when the throttle is stopped. I did a fair amount of elaborate ground testing with a fixed wing.... All worked well, with no false disarming, even at very low forward ACC X axis movements... It practically required it to be almost stationary on the ground, before it detected landing. All in all, my results are the same as yours 💯 Once more I would like to say a big thanks for your addition of this feature.. It may be helpful to include the information you wrote me in your last post, in the Wiki, to help others? @DzikuVx I think this feature is the general fulfillment of this #2331? |
Been using this for a while now so issuing as a draft for discussion. Updates landing detection for multirotor and adds detection for fixed wing.
Detects when flying and activates landing detection from that point. However, final detection routines are only active when basic flight criteria are met.
Multirotor detection added for non autonomous landing as well as RTH.
Fixed wing detection based on velocity, axis rates and finally absolute movement in roll and pitch (so probably wouldn't work if stuck in a tree being blown around by the wind).
The conditions used to detect flying and landing are relatively basic but are structured as much as possible to make it easier to improve/add to the conditions to increase reliability. #7068 would be useful for flight detection on fixed wing.
Been used for a few months with no false landings detected although the conditions that might cause false detection, e.g. gale hanging etc, weren't encountered. RTH landing detection on multirotors works as before. Fixed wing detection takes some time to trigger, > 6s + disarm delay, probably due to horizon drift moving the roll/pitch axis after landing. However, detection tolerances haven't been optimised so could be relaxed reducing detection time but with increased risk of false triggers.
Things that could be improved: