Use APDS-9930 proximity sensor for land detection


Land detection in copter generally works very well. But when auto landing in a windy condition, especially with precision landing enabled (PLND_ENABLED). copter may flip over sometimes like this video

APDS-9930 is a small and cheap short range (~10cm) proximity sensor. I attach it to landing gear to detect copter is close to ground

I also write a simple library for it (porting from With this proximity sensor, copter can detect it is almost landed and prevent flip over. My code is here and test video is here

Please give me some comments. Thank you very much

1 Like

nice !!!
I think I’ll expand it to use the VL530L0X sensor,

I’m all for this, but perhaps the driver could be in ap_rangefinder as a new backend? Then this could call any rangefinder (there is already a vl53l0x driver in there by the way).
Also, implementing as AP_Landing_Detector (rather than AC_xxx) would make it easier for quadplane/vtol to use it (I think tailsitters would be a great use case). But please, make a PR!

thank you very much for feedbacks

I did not put it in ap_rangefinder because apds-9930 is not exactly a rangefinder. It cannot output exact distance reading. It can only tell you “there is something within detect range”. Rangefinders usually have a minimum range and tends to inaccurate in very close range. By contrast, proximity sensor can only detect object in very close range.