Skip to content

Commit

Permalink
[gcs] prevent speech spam with 'approaching'
Browse files Browse the repository at this point in the history
only triggered when close enough but not too much, and flying a long segment
fix #1833
  • Loading branch information
gautierhattenberger committed Aug 16, 2016
1 parent 08cd0ff commit e1ff1dc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions sw/ground_segment/cockpit/live.ml
Expand Up @@ -38,6 +38,9 @@ let (//) = Filename.concat
let gcs_id = "GCS"

let approaching_alert_time = 3.
let approaching_alert_dmin = 0.5
let approaching_alert_slmin = 20.

let track_size = ref 500

let _auto_hide_fp = ref false
Expand Down Expand Up @@ -961,12 +964,14 @@ let highlight_fp = fun ac b s ->
end


let check_approaching = fun ac geo alert ->
let check_approaching = fun ac geo1 geo2 alert ->
match ac.track#last with
None -> ()
| Some ac_pos ->
let d = LL.wgs84_distance ac_pos geo in
if d < ac.speed *. approaching_alert_time then
let s_len = LL.wgs84_distance geo1 geo2 in (* length of the segment *)
let d = LL.wgs84_distance ac_pos geo2 in (* distance to end of the segment *)
(* only log_and_say "approaching" if close enough but not too much and when flying long segments *)
if d < ac.speed *. approaching_alert_time && d > approaching_alert_dmin && s_len > approaching_alert_slmin then
log_and_say alert ac.ac_name (sprintf "%s, approaching" ac.ac_speech_name)


Expand Down Expand Up @@ -1266,7 +1271,7 @@ let listen_flight_params = fun geomap auto_center_new_ac alert alt_graph ->
ac.track#draw_segment geo1 geo2;

(* Check if approaching the end of the segment *)
check_approaching ac geo2 alert
check_approaching ac geo1 geo2 alert
in
safe_bind "SEGMENT_STATUS" get_segment_status;

Expand Down

0 comments on commit e1ff1dc

Please sign in to comment.