From 5f8d5ee5ea1b2d186a811eec69407d84d58b25c5 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 3 Mar 2015 15:40:04 +0100 Subject: [PATCH 1/4] [gcs] GPS accuracy speech less verbose (#1046) --- sw/ground_segment/cockpit/live.ml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml index f73ef94ce2..e5aa5fcba4 100644 --- a/sw/ground_segment/cockpit/live.ml +++ b/sw/ground_segment/cockpit/live.ml @@ -1326,6 +1326,10 @@ let get_alert_bat_low = fun a _sender vs -> let listen_alert = fun a -> alert_bind "BAT_LOW" (get_alert_bat_low a) +type gps_acc_level = GPS_ACC_HIGH | GPS_ACC_LOW | GPS_ACC_VERY_LOW | GPS_NO_ACC + +let gps_last_acc = ref GPS_NO_ACC + let get_svsinfo = fun alarm _sender vs -> let ac = get_ac vs in let gps_page = ac.gps_page in @@ -1348,8 +1352,20 @@ let get_svsinfo = fun alarm _sender vs -> gps_page#svsinfo pacc a; - if pacc > 1500 && pacc < 9999 then - log_and_say alarm "gcs" (sprintf "GPS acc: %d m" (pacc / 100)) + let new_acc = + if pacc <= 1000 then GPS_ACC_HIGH + else if pacc > 1000 && pacc < 2000 then GPS_ACC_LOW + else GPS_ACC_VERY_LOW in + if !gps_last_acc <> new_acc then begin + match new_acc, !gps_last_acc with + | GPS_ACC_HIGH, GPS_NO_ACC -> () (* nothing if pacc is good from the start *) + | GPS_ACC_HIGH, _ -> log_and_say alarm "gcs" "GPS accuracy below 10 meter" + | GPS_ACC_LOW, _ -> log_and_say alarm "gcs" "low GPS accuracy" + | GPS_ACC_VERY_LOW, _ -> log_and_say alarm "gcs" "Warning: very low GPS accuracy" + | _, _ -> () + end; + + gps_last_acc := new_acc let listen_svsinfo = fun a -> safe_bind "SVSINFO" (get_svsinfo a) From f54f875a6993b95cab8df5d1f2f45b5ce1fdcb6f Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 3 Mar 2015 17:48:22 +0100 Subject: [PATCH 2/4] [gcs] tell A/C name before gps accuracy message --- sw/ground_segment/cockpit/live.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml index e5aa5fcba4..969f6759be 100644 --- a/sw/ground_segment/cockpit/live.ml +++ b/sw/ground_segment/cockpit/live.ml @@ -1359,9 +1359,9 @@ let get_svsinfo = fun alarm _sender vs -> if !gps_last_acc <> new_acc then begin match new_acc, !gps_last_acc with | GPS_ACC_HIGH, GPS_NO_ACC -> () (* nothing if pacc is good from the start *) - | GPS_ACC_HIGH, _ -> log_and_say alarm "gcs" "GPS accuracy below 10 meter" - | GPS_ACC_LOW, _ -> log_and_say alarm "gcs" "low GPS accuracy" - | GPS_ACC_VERY_LOW, _ -> log_and_say alarm "gcs" "Warning: very low GPS accuracy" + | GPS_ACC_HIGH, _ -> log_and_say alarm "gcs" (sprintf "%s, GPS accuracy below 10 meter" ac.ac_speech_name) + | GPS_ACC_LOW, _ -> log_and_say alarm "gcs" (sprintf "%s, low GPS accuracy" ac.ac_speech_name) + | GPS_ACC_VERY_LOW, _ -> log_and_say alarm "gcs" (sprintf "%s, Warning: very low GPS accuracy" ac.ac_speech_name) | _, _ -> () end; From 253eadfe12c47b49708441b14f96f3ec1b064b06 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Tue, 3 Mar 2015 18:23:58 +0100 Subject: [PATCH 3/4] [gcs] handle pacc properly for each A/C --- sw/ground_segment/cockpit/live.ml | 17 ++++++++--------- sw/ground_segment/cockpit/live.mli | 5 ++++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml index 969f6759be..f631058b6f 100644 --- a/sw/ground_segment/cockpit/live.ml +++ b/sw/ground_segment/cockpit/live.ml @@ -70,6 +70,8 @@ let rec list_iter3 = fun f l1 l2 l3 -> type color = string +type gps_acc_level = GPS_ACC_HIGH | GPS_ACC_LOW | GPS_ACC_VERY_LOW | GPS_NO_ACC + type aircraft = { ac_name : string; ac_speech_name : string; @@ -109,6 +111,7 @@ type aircraft = { mutable last_unix_time : float; mutable airspeed : float; mutable version : string; + mutable last_gps_acc : gps_acc_level } let aircrafts = Hashtbl.create 3 @@ -687,7 +690,8 @@ let create_ac = fun alert (geomap:G.widget) (acs_notebook:GPack.notebook) (ac_id got_track_status_timer = 1000; dl_values = [||]; last_unix_time = 0.; airspeed = 0.; - version = "" + version = ""; + last_gps_acc = GPS_NO_ACC } in Hashtbl.add aircrafts ac_id ac; select_ac acs_notebook ac_id; @@ -1326,10 +1330,6 @@ let get_alert_bat_low = fun a _sender vs -> let listen_alert = fun a -> alert_bind "BAT_LOW" (get_alert_bat_low a) -type gps_acc_level = GPS_ACC_HIGH | GPS_ACC_LOW | GPS_ACC_VERY_LOW | GPS_NO_ACC - -let gps_last_acc = ref GPS_NO_ACC - let get_svsinfo = fun alarm _sender vs -> let ac = get_ac vs in let gps_page = ac.gps_page in @@ -1356,16 +1356,15 @@ let get_svsinfo = fun alarm _sender vs -> if pacc <= 1000 then GPS_ACC_HIGH else if pacc > 1000 && pacc < 2000 then GPS_ACC_LOW else GPS_ACC_VERY_LOW in - if !gps_last_acc <> new_acc then begin - match new_acc, !gps_last_acc with + if ac.last_gps_acc <> new_acc then begin + match new_acc, ac.last_gps_acc with | GPS_ACC_HIGH, GPS_NO_ACC -> () (* nothing if pacc is good from the start *) | GPS_ACC_HIGH, _ -> log_and_say alarm "gcs" (sprintf "%s, GPS accuracy below 10 meter" ac.ac_speech_name) | GPS_ACC_LOW, _ -> log_and_say alarm "gcs" (sprintf "%s, low GPS accuracy" ac.ac_speech_name) | GPS_ACC_VERY_LOW, _ -> log_and_say alarm "gcs" (sprintf "%s, Warning: very low GPS accuracy" ac.ac_speech_name) | _, _ -> () end; - - gps_last_acc := new_acc + ac.last_gps_acc <- new_acc let listen_svsinfo = fun a -> safe_bind "SVSINFO" (get_svsinfo a) diff --git a/sw/ground_segment/cockpit/live.mli b/sw/ground_segment/cockpit/live.mli index 4b2df8d279..d3a857a328 100644 --- a/sw/ground_segment/cockpit/live.mli +++ b/sw/ground_segment/cockpit/live.mli @@ -24,6 +24,8 @@ type color = string +type gps_acc_level = GPS_ACC_HIGH | GPS_ACC_LOW | GPS_ACC_VERY_LOW | GPS_NO_ACC + type aircraft = private { ac_name : string; ac_speech_name : string; @@ -62,7 +64,8 @@ type aircraft = private { mutable dl_values : string option array; mutable last_unix_time : float; mutable airspeed : float; - mutable version : string + mutable version : string; + mutable last_gps_acc : gps_acc_level } val aircrafts : (string, aircraft) Hashtbl.t From d94c7748117ae9b50d80c8f13fdac26a49189006 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 4 Mar 2015 14:52:44 +0100 Subject: [PATCH 4/4] [gcs] reword GPS accuracy speech and nothing if pacc > 999 --- sw/ground_segment/cockpit/live.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml index f631058b6f..babd04adf4 100644 --- a/sw/ground_segment/cockpit/live.ml +++ b/sw/ground_segment/cockpit/live.ml @@ -877,7 +877,7 @@ let get_telemetry_status = fun alarm _sender vs -> | (Pages.Linkup, _)-> log_and_say alarm ac.ac_name (sprintf "%s, link %s re-connected" ac.ac_speech_name link_id) | (Pages.Nochange, _) -> () | (Pages.Linkdown, _) -> log_and_say alarm ac.ac_name (sprintf "%s, link %s lost" ac.ac_speech_name link_id) - + let get_engine_status_msg = fun _sender vs -> let ac = get_ac vs in ac.strip#set_throttle ~kill:ac.in_kill_mode (Pprz.float_assoc "throttle" vs); @@ -1355,13 +1355,13 @@ let get_svsinfo = fun alarm _sender vs -> let new_acc = if pacc <= 1000 then GPS_ACC_HIGH else if pacc > 1000 && pacc < 2000 then GPS_ACC_LOW - else GPS_ACC_VERY_LOW in + else if pacc > 999 then GPS_NO_ACC else GPS_ACC_VERY_LOW in if ac.last_gps_acc <> new_acc then begin match new_acc, ac.last_gps_acc with | GPS_ACC_HIGH, GPS_NO_ACC -> () (* nothing if pacc is good from the start *) - | GPS_ACC_HIGH, _ -> log_and_say alarm "gcs" (sprintf "%s, GPS accuracy below 10 meter" ac.ac_speech_name) + | GPS_ACC_HIGH, _ -> log_and_say alarm "gcs" (sprintf "%s, GPS accuracy better than 10 meter" ac.ac_speech_name) | GPS_ACC_LOW, _ -> log_and_say alarm "gcs" (sprintf "%s, low GPS accuracy" ac.ac_speech_name) - | GPS_ACC_VERY_LOW, _ -> log_and_say alarm "gcs" (sprintf "%s, Warning: very low GPS accuracy" ac.ac_speech_name) + | GPS_ACC_VERY_LOW, _ -> log_and_say alarm "gcs" (sprintf "%s, Warning: GPS accuracy worse than 20 meter" ac.ac_speech_name) | _, _ -> () end; ac.last_gps_acc <- new_acc