navigator: takeoff altitude fixed

This commit is contained in:
Anton Babushkin 2014-07-04 15:49:02 +02:00
parent 904cfd7c49
commit 829a317d23
1 changed files with 2 additions and 1 deletions

View File

@ -326,11 +326,12 @@ Mission::set_mission_items()
takeoff_alt += _navigator->get_home_position()->alt;
}
/* perform takeoff at least to NAV_TAKEOFF_ALT above home/ground, even if first waypoint is lower */
if (_navigator->get_vstatus()->condition_landed) {
takeoff_alt = fmaxf(takeoff_alt, _navigator->get_global_position()->alt + _param_takeoff_alt.get());
} else {
takeoff_alt = _navigator->get_home_position()->alt + _param_takeoff_alt.get();
takeoff_alt = fmaxf(takeoff_alt, _navigator->get_home_position()->alt + _param_takeoff_alt.get());
}
mavlink_log_info(_navigator->get_mavlink_fd(), "#audio: takeoff to %.1fm above home", takeoff_alt - _navigator->get_home_position()->alt);