Auto take off and landing

I have a program which contains the auto take off and landing function in the Semi-Auto mode for my Quad using the APM board with the Sonar sensor LV EZ0. My approach is by sensing the height from the sonar sensor for the auto take off and landing.

For the Auto take off function, it will be activated when the height value from the Sonar is less than 16cm from ground and by pushing the throttle stick to the middle position. This function currently works fine for my Quad. 

The problem I faced is with the Auto Landing function of my Quad. The auto landing function is activated by pushing the throttle stick all the way down. The moment I activate the auto landing function, the Quad will decrease in altitude from the altitude hold height around 1 meter to 15cm. The problem I faced  is that the Quad will maintain at 15cm in height and the motor will only stop after maintaining at that height for 10-15 seconds and the Quad will just drop from 15cm to the ground. 

How can I go about improving the auto landing function so that my Quad will have a smooth landing and not a sudden drop from 15cm in height?

 

Code

3690888578?profile=original

 

3690888739?profile=original

3690888748?profile=original

 

 

 

 

 

 

 

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • I'm sorry but I may sound like a noob here but where did you declare your variables? I tried running this script and I got tons of errors pertaining to undeclared variables. So I am confused and also lacking familiarity in Arduino.

  • Hey...  May i know how do you write a program in arduino that can use the sonar for auto takeoff and land? Im doing a sch project and im currently struggling with that... im kinda weak in programming.... i will be most grateful if you can help out... ^_^

  • Moderator
    The 15cm is the same distance as the minimum visibility of the ultrasonic sensor, six inches. Inside of that, it reports all distances as the same. Might that be the issue?
This reply was deleted.

Activity