send ACINFO only if more than 1 aircraft flying

This commit is contained in:
Gautier Hattenberger
2008-04-09 13:25:55 +00:00
parent 53955da61a
commit ee9e5539f8
+15 -11
View File
@@ -565,17 +565,21 @@ let send_aircraft_msg = fun ac ->
"agl", f a.agl;
"climb", f a.climb] in
Ground_Pprz.message_send my_id "FLIGHT_PARAM" values;
(** build ACINFO messages *)
let cm_of_m = fun f -> Pprz.Int (truncate (100. *. f)) in
let ac_info = ["ac_id", Pprz.String ac;
"utm_east", cm_of_m a.pos.utm_x;
"utm_north", cm_of_m a.pos.utm_y;
"course", Pprz.Int (truncate (10. *. (Geometry_2d.rad2deg a.course)));
"alt", cm_of_m a.alt;
"speed", cm_of_m a.gspeed;
"climb", cm_of_m a.climb;
"itow", Pprz.Int32 a.itow] in
Dl_Pprz.message_send my_id "ACINFO" ac_info;
(** send ACINFO messages if more than one A/C registered *)
if Hashtbl.length aircrafts > 1 then
begin
let cm_of_m = fun f -> Pprz.Int (truncate (100. *. f)) in
let ac_info = ["ac_id", Pprz.String ac;
"utm_east", cm_of_m a.pos.utm_x;
"utm_north", cm_of_m a.pos.utm_y;
"course", Pprz.Int (truncate (10. *. (Geometry_2d.rad2deg a.course)));
"alt", cm_of_m a.alt;
"speed", cm_of_m a.gspeed;
"climb", cm_of_m a.climb;
"itow", Pprz.Int32 a.itow] in
Dl_Pprz.message_send my_id "ACINFO" ac_info;
end;
if !kml then
update_kml_ac a;