GPS altitude hold is good for +-5m, but what if you want more precision than that, closer to the ground. ArduCopter team member Randy Mackay. He explains what it takes (this is also in the manual):
To give it a go do this:1. get yourself one of these Sonars and attach to the bottom of your quadhttp://www.sparkfun.com/products/8504 <-- the cheaper LV ($28)http://www.sparkfun.com/products/9495 <-- the slightly more XL ($50)2. attach it up to AN1 (the Analog2Digital port on the very back
right of the oilpan near the CLI switch. AN5 is the outmost, so count
in from there to AN1).3. comment out this line in ArduCopterNG.pde://#define UseBMP4. make sure this isn't commented out just below in ArduCopterNG.pde#define isRANGEFINDER5. if you're using the LV sonar you will need to change this line in ArduCopterNG.pde:AP_RangeFinder_MaxsonarXL AP_RangeFinder_down;to be like this:AP_RangeFinder_MaxsonarLV AP_RangeFinder_down;6. you'll need to reset your EEPROM values or go into the CLI menu and select 'o' and set your Sonar PIDs to 0.8;0.3;0.7I had to make one change though that affects the existing functionality
... if you're UseBMP (i.e. using baro for altitude hold) it's now
possible to do altitude hold even though you're not doing GPS hold (I.e.
if you don't have a GPS lock). I think this is ok.So the Barometer altitude control and sonar altitude control continue
to be quite separate functionality that can't be used at the same time.
Clearly we need a nice transition from one to the other when you go out
of sonar range. anyway still, thinking about how to do that.


@Taylor - my opinion is the safe bet is to get the more expensive one. It's $22 more but you're only buying one (or maybe 2 if you've got a couple of quads). The video above was shot with the more expensive XL-EZ4. This opinion isn't based on evidence yet..I have some more sensors arriving shortly so I will test more.
Besides whether you go for the LV or XL there is also the question of beamwidth..both series have models from "0" (widest) to "4" (narrowest). I expect 4 is the best for altitude hold.
By the way - the set-up instructions are also on the wiki now: https://code.google.com/p/arducopter/wiki/Quad_Sonar

@Randy. So when we have the sonar equipped. Is it enabled with a switch or anything like that? Or is it just activated when GPS hold is activated?
Taylor,
As you guessed, it goes on with the autopilot..so when you turn on GPS hold the altitude hold also goes on. In the video above I disabled the GPS by commenting out the #define IsGPS in ArduCopterNG.pde.
https://code.google.com/p/arducopter/source/browse/trunk/Arducopter...
It would be interesting to do GPS hold at 2 feet off the ground - i suspect just because the gps signal isn't perfectly accurate the quad will wander around a bit.
-Randy

Comment by SupreCharger on December 26, 2010 at 11:39pm @taylor - you're right - i only disabled the GPS because I wanted to do some free flying with the sonar on. I'm sure you could do GPS hold at a low altitude and it would be fine.
Instead of using GPS for altitude control at higher altitudes, we use the barometer on the APM Oilpan because it's more accurate...and this is the only gotcha, at the moment, there's no transition from using sonar to barometer. it's one or the other. That'll be resolved shortly though. I expect by the end of next weekend it'll will transition nicely from sonar to barometer if you climb over a few meters, and then back from barometer to sonar as you come back down to earth.

Alrighty. Thanks Randy
Ok. I think I have it working on AN5 like the wiki says. I have the PID values set to what you said because I have the arducopter kit. Before I set them, the quad would ascend up into the air, and now that I have the settings in, it slowly descends. Which value in the PID for the sonar should I change to get the altitude hold dialed in?
Season Two of the Trust Time Trial (T3) Contest has now begun. The third round was a reliablilty/aerial photography round for both planes and copters, which is now closed. Stay tuned for the next round, beginning soon.32 members
18 members
32 members
109 members
22 members
© 2012 Created by Chris Anderson.

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