aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander/commander.cpp
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2014-04-02 17:09:18 +0400
committerAnton Babushkin <anton.babushkin@me.com>2014-04-02 17:09:18 +0400
commit93617c4073d560ec2a804d728a2830534a74a50a (patch)
tree4df98518908c82c8d132ee45a13110ab69d64c9c /src/modules/commander/commander.cpp
parent553b122830615b1617570900cf5f5d0c04720c8b (diff)
downloadpx4-firmware-93617c4073d560ec2a804d728a2830534a74a50a.tar.gz
px4-firmware-93617c4073d560ec2a804d728a2830534a74a50a.tar.bz2
px4-firmware-93617c4073d560ec2a804d728a2830534a74a50a.zip
commander: set home position on arming only if at least 2 s from commander start spent
Diffstat (limited to 'src/modules/commander/commander.cpp')
-rw-r--r--src/modules/commander/commander.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index a896f6146..7257cb4b3 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -1329,8 +1329,8 @@ int commander_thread_main(int argc, char *argv[])
status_changed = true;
mavlink_log_info(mavlink_fd, "[cmd] arming state: %s", arming_states_str[status.arming_state]);
- /* update home position on arming */
- if (armed.armed && !was_armed && status.condition_global_position_valid &&
+ /* update home position on arming if at least 2s from commander start spent to avoid setting home on in-air restart */
+ if (armed.armed && !was_armed && hrt_absolute_time() > start_time + 2000000 && status.condition_global_position_valid &&
(global_position.eph < hdop_threshold_m) && (global_position.epv < vdop_threshold_m)) {
// TODO remove code duplication