From 4b9916eded5330b8964edb87b3cc9f4815ac7af0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 19 Jan 2013 19:32:44 +0100 Subject: Made threshold a bit nicer, still a magic number --- apps/commander/commander.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'apps/commander/commander.c') 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) { -- cgit v1.2.3