aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2013-09-22 16:53:48 +0200
committerAnton Babushkin <anton.babushkin@me.com>2013-09-22 16:53:48 +0200
commit4124417934932907d4663d23e44ab2f436064b58 (patch)
tree407591662ef4799b06f9ae926106573eeb40ba53 /src/modules
parent8a9a230e0db9a8348cef2ff93357fb9bb2389394 (diff)
downloadpx4-firmware-4124417934932907d4663d23e44ab2f436064b58.tar.gz
px4-firmware-4124417934932907d4663d23e44ab2f436064b58.tar.bz2
px4-firmware-4124417934932907d4663d23e44ab2f436064b58.zip
position_estimator_inav: GPS topic timeout detection fixed, messages about GPS signal state in mavlink added
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/position_estimator_inav/position_estimator_inav_main.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/modules/position_estimator_inav/position_estimator_inav_main.c b/src/modules/position_estimator_inav/position_estimator_inav_main.c
index ba7a5df44..8807020d0 100644
--- a/src/modules/position_estimator_inav/position_estimator_inav_main.c
+++ b/src/modules/position_estimator_inav/position_estimator_inav_main.c
@@ -438,12 +438,20 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
/* vehicle GPS position */
if (fds[6].revents & POLLIN) {
orb_copy(ORB_ID(vehicle_gps_position), vehicle_gps_position_sub, &gps);
- if (gps.fix_type >= 3 && t < gps.timestamp_position + gps_timeout) {
+ if (gps.fix_type >= 3) {
/* hysteresis for GPS quality */
if (gps_valid) {
- gps_valid = gps.eph_m < 10.0f;
+ if (gps.eph_m > 10.0f) {
+ gps_valid = false;
+ warnx("GPS signal lost");
+ mavlink_log_info(mavlink_fd, "[inav] GPS signal lost");
+ }
} else {
- gps_valid = gps.eph_m < 5.0f;
+ if (gps.eph_m < 5.0f) {
+ gps_valid = true;
+ warnx("GPS signal found");
+ mavlink_log_info(mavlink_fd, "[inav] GPS signal found");
+ }
}
} else {
gps_valid = false;
@@ -501,7 +509,12 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
}
}
- /* end of poll return value check */
+ /* check for timeout on GPS topic */
+ if (gps_valid && t > gps.timestamp_position + gps_timeout) {
+ gps_valid = false;
+ warnx("GPS timeout");
+ mavlink_log_info(mavlink_fd, "[inav] GPS timeout");
+ }
float dt = t_prev > 0 ? (t - t_prev) / 1000000.0f : 0.0f;
t_prev = t;