APM2 & Sonar - is it suppose to work?

212 views
Skip to first unread message

Christopher Cosmo Rogers

unread,
Mar 17, 2015, 8:24:58 AM3/17/15
to drones-...@googlegroups.com
Appologies if this has been asked before, although I can't find a reference to it anywhere

Basically I'm wondering if sonar is suppose to work still with an APM2 running multicopter?

I know there this is in the release notes

Dropped support for sonar for MultiCopters on APM1 and TradHeli on APM1 & APM2 (ran out of Flash space)

I have taken that to mean sonar doesn't work on APM1, or on APM2 with TradHeli, but should work on APM2 with multicopter

I'm running ArduCopter V3.2.1 on an APM 2.5 and I've followed the instructions on http://copter.ardupilot.com/wiki/common-optional-hardware/common-rangefinder-landingpage/common-rangefinder-maxbotix-analog/#connecting_to_the_apm2x
Testing it I get the correct values, and in the logs I get correct values (EG http://arduplotter.com/view/55081af82028c8bc5057dcf5#altitude) however when I put my hex into Altitude Hold it doesn't seem to use the sonar any more?

So I've just like to clarify whether or not Sonar is suppose to work on APM2, and if could someone update the wiki to reflect this?

Thanks
Chris

Randy Mackay

unread,
Mar 17, 2015, 8:34:05 AM3/17/15
to drones-...@googlegroups.com

Chris,

 

     Some unfortunately ambiguity in that statement.  Maybe I should have used brackets.

 

     In any case, your interpretation is correct, sonar should work on multicopters with APM2.

 

-Randy

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julien Dubois

unread,
Mar 17, 2015, 8:40:30 AM3/17/15
to drones-...@googlegroups.com
Hi Chris,

from your log everything seems to be working properly, especially the surface tracking.
Most of your flight is in stabilize, so no surface tracking.
But during the while you've flown AltHold we can see the surface tracking is adjusting the desired alt to maintain sonar alt.

Maybe you could increase a bit the SONAR_GAIN param (now RNGFND_GAIN) for the surface tracking to be more responsive (between 1 and 1.5 should be good imo).. but I could not find this param in your log... so many things changed I'm a bit lost

Julien
Surface_Tracking_OK.jpg

Christopher Cosmo Rogers

unread,
Mar 17, 2015, 8:45:52 AM3/17/15
to drones-...@googlegroups.com
Hi Julien, Randy

Good to know it still is suppose to work! :-)

Ok I'll try increasing the gain a bit. Alt Hold used to be rock solid to within a couple of centimetres, but ever since I've updated it seems to drift up and down quite a lot.
That flight was indoors and with the alt hold drifting I didn't want to leave it in that mode too long. Like I say it used to be perfect and not budge, but I shall try playing with the gain a bit
RNGFND_GAIN is currently 0.8 (http://arduplotter.com/view/55081af82028c8bc5057dcf5#params ,search for RNGFND_GAIN, near the top) so I'll nudge that up a bit.

Thanks
Chris

Julien Dubois

unread,
Mar 17, 2015, 8:54:51 AM3/17/15
to drones-...@googlegroups.com
Ok Chris,

if you're inside with flat surface, maybe you don't need a lot of gain (that will bring unstability and oscillation if you increase it too much).
You can play as well with the throttle controller because actually sonar is just there to adjust desired alt the same way you would do manually with your throttle stick in alt_hold.
So the sonar gain acts on the amplitude of those fake throttle adjustment.
and the throttle controller will maintain altitude using barometer. So, if the throttle controller is not stable, or maybe the barometer is disturbed, you can have oscillations too.

Julien

Randy Mackay

unread,
Mar 17, 2015, 9:20:36 AM3/17/15
to drones-...@googlegroups.com

 

     Those little spikes in the sonar alt may not be a huge problem but they won’t help either.  Getting the spikes out of the sonar is tough and is the major reason why these sensors are not super popular.

 

-Randy

--

Danny Thompson

unread,
Mar 17, 2015, 4:49:22 PM3/17/15
to drones-...@googlegroups.com
Hi Guys

One of my friends (rotorx on the forum Chris) has been expirimenting with the Sonar and having the same experience as you.

In one of his flights we picked up the attached graph result (I don't have access to his actual log file) where we can see SAlt remains at almost a flat line regardless of whether or not it has encountered a change of "terrain" imediately below it.  See the attached.

.

Regards
Danny
sonar graph.bmp

Danny Thompson

unread,
Mar 17, 2015, 4:49:27 PM3/17/15
to drones-...@googlegroups.com
Also here are the Parameters that were used for that test run









On Tuesday, 17 March 2015 12:54:51 UTC, Julien Dubois wrote:
sonar params.bmp
Reply all
Reply to author
Forward
0 new messages