diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-07-27 00:55:43 +0200 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-07-27 00:55:43 +0200 |
commit | db5d668439be63e4c8fd7dab49b81c5e162ee095 (patch) | |
tree | 32857bbbd0ec8185e4904d8b12162dc3fede7fd1 /src/modules/commander | |
parent | c5b97fdb1f1add64b4b83623a790e1a83baffcd4 (diff) | |
download | px4-firmware-db5d668439be63e4c8fd7dab49b81c5e162ee095.tar.gz px4-firmware-db5d668439be63e4c8fd7dab49b81c5e162ee095.tar.bz2 px4-firmware-db5d668439be63e4c8fd7dab49b81c5e162ee095.zip |
add simplistic gps failure detection
Diffstat (limited to 'src/modules/commander')
-rw-r--r-- | src/modules/commander/commander.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index fe1974c88..50beb5da8 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1135,6 +1135,22 @@ int commander_thread_main(int argc, char *argv[]) check_valid(global_position.timestamp, POSITION_TIMEOUT, eph_epv_good, &(status.condition_global_position_valid), &status_changed); /* check if GPS fix is ok */ + if (gps_position.fix_type >= 3 && //XXX check eph and epv ? + hrt_elapsed_time(&gps_position.timestamp_position) < FAILSAFE_DEFAULT_TIMEOUT) { + /* handle the case where gps was regained */ + if (status.gps_failure) { + status.gps_failure = false; + status_changed = true; + mavlink_log_critical(mavlink_fd, "gps regained"); + } + } else { + if (!status.gps_failure) { + status.gps_failure = true; + status_changed = true; + mavlink_log_critical(mavlink_fd, "gps fix lost"); + } + } + /* update home position */ if (!status.condition_home_position_valid && status.condition_global_position_valid && !armed.armed && |