Arducopter's Sonar-based Altitude hold works great

I have installed the recommended sonar sensor (XL-Maxsonar EZ4) on my custom-framed Arducopter. Using the ArudPirateNG code, I've been flying with the Altitude hold and it works great. I love it! It allows me to put the quad at the altitude I want, say five feet off the ground, flip the Altitude hold switch on my Tx, and then fly around at will at that altitude. This allows me to practice my yawing, pitching, and rolling without having to worry about crashing into the ground. (Still have to watch out for trees and buildings!). It's very cool. Thank you to the team!


I'm really looking forward to automatic take off and landing in the future, and also obstacle avoidance (using yet to be installed side-firing sensors obviously). I have included some pictures of how I mounted the sonar sensor underneath my quad. I have also included some pictures of the tiny EyeCam camera (made by DraganFly Innovations) that I installed on my arducopter. It transmits video in real-time back to a 9" portable screen and a small video receiver that I rigged up with a battery.













Views: 5926

Comment by Jason Short on February 19, 2011 at 3:06pm

How well does the sensor work over grass? Doug was having trouble getting readings from carpet and grass.


Comment by Robert Beatty on February 19, 2011 at 3:18pm

I'm flying over rough, country-style lawn (couple of inches of winter grass) and horse pasture. It's somewhat sloped and variable ground. It's doing fine with that.


Comment by Jason Short on February 19, 2011 at 3:46pm

Do you see an altitude hold transition when flying over different surfaces? I was worried when I fly from grass to pavement the copter will jump up.


Comment by Robert Beatty on February 19, 2011 at 3:48pm

Automatic Takeoff through Altitude Control: As I continue to fly with and test the sonar-based Altitude Hold, I have discovered something very interesting to me: A certain series of events will cause the Arudcopter to do an automatic take-off:


1. I lift off as usual in manual stable mode, get to the altitude I want, and then switch on Altitude Hold and fly around for a while.

2. I then land manually and disarm (with the Tx's Altitude Hold switch still on).

3. As soon as I re-arm, the arducopter immediately takes-off, goes straight up, and resumes the previous altitude position. It's a very fast and yet well-controlled automatic take-off.


I'm not sure if that is an intentionally designed "feature" or an inadvertent behavior that needs to be corrected. It startled me the first time it happened, but it makes sense, and is quite manageable once you understand what's happening. The Altitude Hold is still on and still set. Dis-arming doesn't clear it. So the next time you arm, it immediately zooms straight up to the altitude it thinks it's supposed to keep. 



Comment by Robert Beatty on February 19, 2011 at 3:55pm

I have only been flying over grass/lawn/pasture, so I don't know about pavement. I'll maybe test that the next time I go out. I suspect it will not jump up as it makes the transition, or if it does, it will be minor.


One other note: It does appear to follow the contour of the ground, so if there is a depression in the ground, or a large rock jutting up from the ground, you'll see the arducopter change altitude slightly accordingly, which I think is exactly as it should be. Please note: In my tests, I'm flying very low to the ground, like 3' - 8'.



Comment by Paul Feely on February 19, 2011 at 4:30pm

Sounds really good just what I need to improve my flying and save on propellors! (and nice frame setup!).


I'm just testing out sonar for mine on the bench - output from sensor didn't look great on a o'scope so I thought I'd try test script but can't get the AP_RangeFinder_test to compile (error 'AP_RANGEFINDER_PITOT_TUBE' was not declared).....hopefully get sorted soon.....



Comment by Paul Feely on February 19, 2011 at 5:06pm

Getting a better output from the sensor now (XL-EZ4) - turns out it was my rug it didn't like, sensible values from wooden floor, ceiling but all over the place/erratic for the rug...interesting.



Comment by Robert Beatty on February 19, 2011 at 5:10pm

I have used these sonars on land-based robots for object avoidance and navigation inside the house. Sonar definitely does better with hard surfaces. My in-home robots will avoid walls, furniture, shoes, people, dogs, etc., but will run straight into a blanket or fleece jacket left on the floor. The sound doesn't bounce back from the soft, fuzzy surface.


Comment by Andrew Bailey on February 19, 2011 at 5:19pm

Robert, thanks for your report. I have been having trouble with alt-hold/sonar. As soon as I switch it on my quad starts climbing. I've tried everything I can think of and cannot work out what the problem is. I am reassured that you have this working as well as you describe. There has to be something in my setup or hardware.


I would appreciate it if you could share you sonar PID settings an tell us what code and version you are running. Thanks.

Comment by Robert Beatty on February 19, 2011 at 5:32pm


Sonar PID settings: P=0.8 I=0.3 D=0.7

Code: ArduPirateNG

Couple of things:

1. Make sure nothing is blocking your sonar, like a wire or landing gear or something. If something is blocking it, then it is gong to read a very close range value, so it would make sense that it would climb rapidly because it thinks it's on the ground.

2. Regarding fast-climb-when-switched-on behavior: I noticed that happened a few times to me before I installed a sonar and I was using the GPS/Barometer/etc. So, maybe your sonar isn't turning on at all, but the other instruments are.

3. Make sure you have the right lines of code commented and uncommented so that the sonar is enabled.

4. Follow this:

5. Test your sonar using the AP_RangeFinder example sketch (referenced in the wiki page in #4).



You need to be a member of DIY Drones to add comments!

Join DIY Drones


Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service