Landing Gear - Auto Retract

I had been wanting the landing gear to auto retract/deploy based on a set altitude, but discovered that function wasn’t available on the current ArduCopter code (3.3rc8).

I then came across this code https://github.com/timotto/ardupilot/tree/landinggear where someone had gotten this working based on the 3.2 code. Credit for working out how to get it to work goes to him…I just adapted it to work with the 3.3rc8 code.

So long story short, I used his code as a base for getting this working on the 3.3rc8 code base.

I have attached the modified files to make it work. Just drop these files over the ones form the latest git pull and compile. It uses the middle position of your 3 position switch to put the gear in auto mode and will raise and lower based on the altitude and speed values you specify in the parameters.

Hopefully someone finds it useful. I have tested on Pixhawk (have not had a flight test outside yet, just living room test).