diydrones/ardupilot — pull request #1193 by apmKrauser (2014-07-06 00:26:32+00:00)
Title: Arducopter/AP_Mount: retract camera mount near ground

Retract camera mount at low altitude to prevent crash when landing.

While flying around in Stabilize, RTL, Land (I will change it to work for every Flightmode) the camera mount will be retracted as soon as the rangefinder (sonar_alt) reports an altitude below mnt_autortrct_h [cm] (parameter can be changed in Missionplanner. 0 disables auto retract)

As soon as the altitude gets high enough again the camera mount returns to its former position (neutral, rc_targeting, …). At this point it is necessary to exclude all take off and landing modes (I think this only affects Stabilize, Land, maybe RTL). The reason is that the sonar reports a wrong (1-2m to high) altitude eg. when the copter lands on lawn.

Auto retract in general and auto move out can be included/excluded via #defines in Apm_config.h and AP_mount.cpp