A bit on sonar, i think it maybe usefull for the community
To connect the DYP-ME007 or one of the many clones(HC-SR04 and alike), and to roubleshoot the connection, you may need this small walkthrough
Check the wiring connections
1) Trig must go to the signal pin of D9 connector
2) Echo must go to the signal pin of D10 connector
3) Power, any, regulated +5v, with common ground to the flight controller board. I reccomend(!) - if you are powering the FC board externally, and have removed the yellow jumper - connect one of the ESC power connectors to the ESC connector on the board.
Check that the sonar emmits ultrasonic and actually works
4) Once powered - you MUST be able to hear small "clicks" from the sonar, another way - is to use iAnalyzer software on the iPhone, as i have found out, that iPhone is extremely sensitive to ultrasound(i used an ultrasonic cleaning bath, and a phone rang.. on the other end a person was unable to hear anything except buzzing), you should see something like this:
As you see below - the spikes are actually sonar working(iphone from sonar ~5cm away). If the sonar works, then go to next phase
5) It's really a good idea to see with an oscilloscope the returning signal, but that can not be reccomended to everyone, and the person who knows how to use one, probably won't be needing this guide
6) In APM_config make sure the value is
#define MAX_SONAR_RANGE 200
7) In APM Mission Planner, make sure you have the sonar checkbox enabled(!), and the sonar WILL work.
8) In APM mission planner - you will see even the slightest movement of the copter, or you own hand waving at front of a sonar.
But in any case - theese sonars are crap. The good stuff is MB1260 XL-MaxSonar-EZL0 but it doesent seem to work in megapirates. Will get one, as soon as i will have some spare time, and tinker with the code to make it work.