Landing and Sonar

Yesterday I did some testing of sonar.

I see that sonar altitude isn't smooth - it is understandable, as the ground isn't flat (I was flying over grass and small bushes). That implies nervous jumping of my hexa when flying on low altitude.

I think, that sonar data should processed somehow (Kalman, moving average?) before it will be used in altitude calculation.

The second issue is auto-landing. When my hexa touches ground, it starts bouncing.

I think, that using baro, sonar and accelerometers it should be easy to detect when copter touches ground and stop motors. Now I have to switch to manual control and put throttle to 0, just before landing.

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

Join diydrones

Email me when people reply –


  • Developer

    By the way, there can be spikes in the readings from the sonar caused by electrical noise.  This can be caused by being too close to ESCs or motors and if you don't have a cap + resistor on the powerline as recommended by MaxBotix.  It's mentioned on the wiki page but here's the direct link:


    If you don't have this cap and resistor on your sonar I think you definitely will get spikes in the readings.  I always do anyway.

  • Developer

    Not quite as sophisticated as a Kalman filter but there is a median filter on it which throws away the top and bottom values regularly so you end up with just the good values in the middle.


    Yes, perhaps we need to improve the landing code a bit.  I didn't write that part of the code but I imagine it's a bit more difficult than you think to judge whether you've touched down or not.  Easy for a human to see and imagine .. a lot tougher for a blind robot to figure it out.  There's also a ton of noise in the accelerometers and we need to be very careful of false positives.

This reply was deleted.