diff --git a/conf/messages.xml b/conf/messages.xml
index 81277bd0ac..6b2f81d1ad 100644
--- a/conf/messages.xml
+++ b/conf/messages.xml
@@ -601,8 +601,16 @@
+
+
+
+
+
+
+
+
diff --git a/sw/ground_segment/cockpit/gcs.ml b/sw/ground_segment/cockpit/gcs.ml
index 416bf84a86..4eaed94e89 100644
--- a/sw/ground_segment/cockpit/gcs.ml
+++ b/sw/ground_segment/cockpit/gcs.ml
@@ -575,6 +575,7 @@ let _main =
Live.listen_waypoint_moved ();
Live.listen_infrared ();
Live.listen_svsinfo ();
+ Live.listen_telemetry_status ();
Live.listen_alert my_alert;
(** Display the window *)
diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml
index d4fdd10201..1297c92550 100644
--- a/sw/ground_segment/cockpit/live.ml
+++ b/sw/ground_segment/cockpit/live.ml
@@ -643,3 +643,13 @@ let get_svsinfo = fun _sender vs ->
let listen_svsinfo = fun () -> safe_bind "SVSINFO" get_svsinfo
let message_request = Ground_Pprz.message_req
+
+let get_ts = fun _sender vs ->
+ let ac = get_ac vs in
+ let t = Pprz.float_assoc "time_since_last_bat_msg" vs in
+ Strip.set_label ac.strip "telemetry_status" (if t > 2. then sprintf "%.1f" t else " ");
+ Strip.set_color ac.strip "telemetry_status" (if t > 5. then "red" else "green")
+
+
+let listen_telemetry_status = fun () ->
+ safe_bind "TELEMETRY_STATUS" get_ts
diff --git a/sw/ground_segment/cockpit/live.mli b/sw/ground_segment/cockpit/live.mli
index 734bb42813..7f4c9ebf83 100644
--- a/sw/ground_segment/cockpit/live.mli
+++ b/sw/ground_segment/cockpit/live.mli
@@ -13,3 +13,4 @@ val listen_waypoint_moved : unit -> unit
val listen_infrared : unit -> unit
val listen_svsinfo : unit -> unit
val listen_alert : < add : string -> unit; .. > -> unit
+val listen_telemetry_status : unit -> unit
diff --git a/sw/ground_segment/cockpit/strip.ml b/sw/ground_segment/cockpit/strip.ml
index 086b7f93b9..a3ff6c65aa 100644
--- a/sw/ground_segment/cockpit/strip.ml
+++ b/sw/ground_segment/cockpit/strip.ml
@@ -38,9 +38,11 @@ let add config color select center_ac commit_moves mark =
let ac_name = Pprz.string_assoc "ac_name" config in
+ let tooltips = GData.tooltips () in
+
(* frame of the strip *)
let frame = GBin.frame ~shadow_type: `IN ~packing: (widget#attach ~top: (strip_number) ~left: 0) () in
- let strip = GPack.table ~rows: 2 ~columns: 2 ~col_spacings: 10 ~packing: frame#add () in
+ let strip = GPack.table ~rows:2 ~columns: 2 ~col_spacings: 10 ~packing: frame#add () in
ignore (GMisc.label ~text: (ac_name) ~packing: (strip#attach ~top: 0 ~left: 0) ());
let plane_color = GBin.event_box ~width:10 ~height:10 ~packing:(strip#attach ~top:0 ~left: 1) () in
@@ -53,12 +55,18 @@ let add config color select center_ac commit_moves mark =
let block_name = GMisc.label ~text: "______" ~packing:h#add () in
add_label ("block_name_value") (plane_color, block_name);
-
- (* battery and flight time *)
- let pb = GRange.progress_bar ~orientation: `BOTTOM_TO_TOP ~packing:(strip#attach ~top:1 ~left:0) () in
+ (* battery and telemetry status *)
+ let vb = GPack.vbox ~packing:(strip#attach ~top:1 ~left:0) () in
+ let pb = GRange.progress_bar ~orientation: `BOTTOM_TO_TOP ~packing:vb#add () in
+ pb#misc#set_size_request ~height:50 ();
pb#coerce#misc#modify_fg [`PRELIGHT, `NAME "green"];
pb#coerce#misc#modify_font_by_name "sans 12";
-
+
+ let eb = GBin.event_box ~packing:vb#add () in
+ let ts = GMisc.label ~text:"N/A" ~packing:eb#add () in
+ add_label "telemetry_status_value" (eb, ts);
+ tooltips#set_tip eb#coerce ~text:"Telemetry status\nGreen if time since last bat message < 5s";
+
let left_box = GPack.table ~rows ~columns: 6 ~col_spacings: 5
~packing: (strip#attach ~top: 1 ~left: 1) () in
diff --git a/sw/ground_segment/tmtc/aircraft.ml b/sw/ground_segment/tmtc/aircraft.ml
index a70c4005bd..182c9fcd2b 100644
--- a/sw/ground_segment/tmtc/aircraft.ml
+++ b/sw/ground_segment/tmtc/aircraft.ml
@@ -116,5 +116,6 @@ type aircraft = {
mutable horiz_mode : horiz_mode;
dl_setting_values : float array;
mutable nb_dl_setting_values : int;
- mutable survey : (Latlong.geographic * Latlong.geographic) option
+ mutable survey : (Latlong.geographic * Latlong.geographic) option;
+ mutable last_bat_msg_date : float
}
diff --git a/sw/ground_segment/tmtc/aircraft.mli b/sw/ground_segment/tmtc/aircraft.mli
index 532be1bf15..f53ff941ae 100644
--- a/sw/ground_segment/tmtc/aircraft.mli
+++ b/sw/ground_segment/tmtc/aircraft.mli
@@ -103,5 +103,6 @@ type aircraft = {
mutable horiz_mode : horiz_mode;
dl_setting_values : float array;
mutable nb_dl_setting_values : int;
- mutable survey : (Latlong.geographic * Latlong.geographic) option
+ mutable survey : (Latlong.geographic * Latlong.geographic) option;
+ mutable last_bat_msg_date : float
}
diff --git a/sw/ground_segment/tmtc/server.ml b/sw/ground_segment/tmtc/server.ml
index 2c98ef7f74..7c29cd083e 100644
--- a/sw/ground_segment/tmtc/server.ml
+++ b/sw/ground_segment/tmtc/server.ml
@@ -189,6 +189,7 @@ let log_and_parse = fun logging ac_name a msg values ->
a.cur_stage <- ivalue "cur_stage";
a.desired_course <- norm_course ((Deg>>Rad)(fvalue "desired_course" /. 10.));
| "BAT" ->
+ a.last_bat_msg_date <- U.gettimeofday ();
a.throttle <- fvalue "desired_gaz" /. 9600. *. 100.;
a.flight_time <- ivalue "flight_time";
a.rpm <- a.throttle *. 100.;
@@ -429,6 +430,16 @@ let send_wind = fun a ->
with
_exc -> ()
+let send_telemetry_status = fun a ->
+ let id = a.id in
+ try
+ let vs =
+ ["ac_id", Pprz.String id;
+ "time_since_last_bat_msg", Pprz.Float (U.gettimeofday () -. a.last_bat_msg_date)] in
+ Ground_Pprz.message_send my_id "TELEMETRY_STATUS" vs
+ with
+ _exc -> ()
+
let send_moved_waypoints = fun a ->
Hashtbl.iter
(fun wp_id wp ->
@@ -511,7 +522,8 @@ let send_aircraft_msg = fun ac ->
send_horiz_status a;
send_survey_status a;
send_dl_values a;
- send_moved_waypoints a
+ send_moved_waypoints a;
+ send_telemetry_status a
with
Not_found -> prerr_endline ac
| x -> prerr_endline (Printexc.to_string x)
@@ -539,7 +551,7 @@ let new_aircraft = fun id ->
flight_time = 0; stage_time = 0; block_time = 0;
horiz_mode = UnknownHorizMode;
horizontal_mode = 0;
- waypoints = Hashtbl.create 3; survey = None
+ waypoints = Hashtbl.create 3; survey = None; last_bat_msg_date = 0.
}
let check_alerts = fun a ->