diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-01-19 19:32:44 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-01-19 19:32:44 +0100 |
commit | 4b9916eded5330b8964edb87b3cc9f4815ac7af0 (patch) | |
tree | ae626fda2c60a6e31b0005e3d15e7e3f8963dd23 | |
parent | c9c64b3f25113eba565d0926b435f2b492a7468e (diff) | |
download | px4-firmware-4b9916eded5330b8964edb87b3cc9f4815ac7af0.tar.gz px4-firmware-4b9916eded5330b8964edb87b3cc9f4815ac7af0.tar.bz2 px4-firmware-4b9916eded5330b8964edb87b3cc9f4815ac7af0.zip |
Made threshold a bit nicer, still a magic number
-rw-r--r-- | apps/commander/commander.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/commander/commander.c b/apps/commander/commander.c index cc382c2fd..103c53dc6 100644 --- a/apps/commander/commander.c +++ b/apps/commander/commander.c @@ -1678,11 +1678,12 @@ int commander_thread_main(int argc, char *argv[]) orb_copy(ORB_ID(vehicle_gps_position), gps_sub, &gps_position); /* check for first, long-term and valid GPS lock -> set home position */ - float hdop = gps_position.eph / 100.0f; - float vdop = gps_position.epv / 100.0f; + float hdop_m = gps_position.eph / 100.0f; + float vdop_m = gps_position.epv / 100.0f; /* check if gps fix is ok */ // XXX magic number + float dop_threshold_m = 2.0f; /* * If horizontal dilution of precision (hdop / eph) @@ -1693,8 +1694,8 @@ int commander_thread_main(int argc, char *argv[]) * the system is currently not armed, set home * position to the current position. */ - if (gps_position.fix_type == GPS_FIX_TYPE_3D && (hdop < 4.0f) - && (vdop < 4.0f) + if (gps_position.fix_type == GPS_FIX_TYPE_3D && (hdop < dop_threshold_m) + && (vdop_m < dop_threshold_m) && !home_position_set && (hrt_absolute_time() - gps_position.timestamp < 2000000) && !current_status.flag_system_armed) { |