*** empty log message ***

This commit is contained in:
Pascal Brisset
2005-05-23 22:24:12 +00:00
parent 76129ba5c0
commit 7dfe598a45
10 changed files with 50 additions and 23 deletions
+11
View File
@@ -115,6 +115,13 @@ let aircraft_pos_msg = fun track utm_x utm_y heading ->
track#add_point en;
track#move_icon en heading
let carrot_pos_msg = fun track x y ->
match !map_ref with
None -> ()
| Some utm0 ->
let en = {G.east = x; north = y } in
track#move_carrot en
let new_color =
let colors = ref ["red"; "blue"; "green"] in
fun () ->
@@ -179,6 +186,10 @@ let live_aircrafts_msg = fun (geomap:MapCanvas.widget) acs ->
Ivy.bind
(fun _ args -> aircraft_pos_msg track (fos args.(0)) (fos args.(1))(fos args.(2)))
(sprintf "%s +FLIGHT_PARAM +[^ ]* +[^ ]* +([0-9\\.]*) +([0-9\\.]*) +[0-9\\.]* +([0-9\\.]*)" ac) in
let b =
Ivy.bind
(fun _ args -> carrot_pos_msg track (fos args.(0)) (fos args.(1)))
(sprintf "%s +NAV_STATUS +[^ ]* +[^ ]* +[^ ]* +[^ ]* +[^ ]* +([\\-0-9\\.]*) +([\\-0-9\\.]*)" ac) in
Hashtbl.add live_aircrafts ac { track = track; color = color; fp_group = None }
end
)
+10 -3
View File
@@ -78,6 +78,8 @@ type aircraft = {
mutable pitch : float;
mutable east : float;
mutable north : float;
mutable desired_east : float;
mutable desired_north : float;
mutable gspeed : float;
mutable course : float;
mutable alt : float;
@@ -150,6 +152,9 @@ let log_and_parse = fun log ac_name a msg values ->
a.course <- fvalue "course";
a.alt <- fvalue "alt";
a.climb <- fvalue "climb"
| "DESIRED" ->
a.desired_east <- fvalue "desired_x";
a.desired_north <- fvalue "desired_y"
| "ATTITUDE" ->
a.roll <- fvalue "phi";
a.pitch <- fvalue "theta"
@@ -198,7 +203,7 @@ let send_aircraft_msg = fun ac ->
let _, fp_msg = AcInfo_Pprz.message_of_name "FLIGHT_PARAM" in
Ivy.send (sprintf "%s %s" ac (AcInfo_Pprz.string_of_message fp_msg values));
let values = ["cur_block", Pprz.Int a.cur_block;"cur_stage", Pprz.Int a.cur_stage]
let values = ["cur_block", Pprz.Int a.cur_block;"cur_stage", Pprz.Int a.cur_stage; "target_east", f a.desired_east; "target_north", f a.desired_north]
and _, ns_msg = AcInfo_Pprz.message_of_name "NAV_STATUS" in
Ivy.send (sprintf "%s %s" ac (AcInfo_Pprz.string_of_message ns_msg values));
@@ -213,7 +218,7 @@ let send_aircraft_msg = fun ac ->
Not_found -> prerr_endline ac
let new_aircraft = fun id ->
{ port = id ; roll = 0.; pitch = 0.; east = 0.; north = 0.; gspeed=0.; course = 0.; alt=0.; climb=0.; cur_block=0; cur_stage=0; throttle = 0.; rpm = 0.; temp = 0.; bat = 0.; amp = 0.; energy = 0.; ap_mode=0; ap_altitude=0; if_calib_mode=0; mcu1_status=0; lls_calib=0 }
{ port = id ; roll = 0.; pitch = 0.; east = 0.; north = 0.; desired_east = 0.; desired_north = 0.; gspeed=0.; course = 0.; alt=0.; climb=0.; cur_block=0; cur_stage=0; throttle = 0.; rpm = 0.; temp = 0.; bat = 0.; amp = 0.; energy = 0.; ap_mode=0; ap_altitude=0; if_calib_mode=0; mcu1_status=0; lls_calib=0 }
let register_aircraft = fun name a ->
Hashtbl.add aircrafts name a;
@@ -223,9 +228,11 @@ let register_aircraft = fun name a ->
(** Callback of an identifying message from a soft simulator *)
let ident_msg = fun log id name ->
if not (Hashtbl.mem aircrafts name) then begin
prerr_endline "ident_msg";
let ac = new_aircraft (Ivy id) in
let b = Ivy.bind (fun _ args -> sim_msg log name ac args.(0)) (sprintf "^%s +(.*)" id) in
register_aircraft name ac
register_aircraft name ac;
send_aircrafts_msg ()
end
(* Waits for new simulated aircrafts *)
+6
View File
@@ -46,6 +46,9 @@ class track = fun ?(name="coucou") ?(size = 50) ?(color="red") (geomap:MapCanvas
ignore (GnoCanvas.line ~fill_color:color ~props:[`WIDTH_PIXELS 4;`CAP_STYLE `ROUND] ~points:[|-4.;10.;4.;10.|] aircraft) in
let ac_label =
GnoCanvas.text group ~props:[`TEXT name; `X 25.; `Y 25.; `ANCHOR `SW; `FILL_COLOR color] in
let carrot = GnoCanvas.group group in
let _ac_carrot =
ignore (GnoCanvas.polygon ~points:[|0.;0.;-2.5;5.;2.5;5.|] ~props:[`WIDTH_UNITS 1.;`FILL_COLOR "orange"; `OUTLINE_COLOR "orange"; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001")] carrot) in
object (self)
val mutable segments = Array.create size empty
@@ -81,6 +84,9 @@ class track = fun ?(name="coucou") ?(size = 50) ?(color="red") (geomap:MapCanvas
let (xw,yw) = geomap#world_of_en en in
aircraft#affine_absolute (affine_pos_and_angle geomap#zoom_adj#value xw yw heading);
ac_label#affine_absolute (affine_pos_and_angle geomap#zoom_adj#value xw yw 0.);
method move_carrot = fun en ->
let (xw,yw) = geomap#world_of_en en in
carrot#affine_absolute (affine_pos_and_angle geomap#zoom_adj#value xw yw 0.)
method zoom = fun z ->
let a = aircraft#i2w_affine in
let z' = sqrt (a.(0)*.a.(0)+.a.(1)*.a.(1)) in
+1 -1
View File
@@ -18,7 +18,7 @@ GetOptions (
);
my @args = ();
push @args, "-b", $options->{ivy_bus};
my $sim_binary = Paparazzi::Environment::paparazzi_home()."/var/".$options->{aircraft}."/sim/simsitl.out";
my $sim_binary = Paparazzi::Environment::paparazzi_home()."/var/".$options->{aircraft}."/sim/simsitl";
die "$sim_binary not found. try make AIRCRAFT=$options->{aircraft} ac\n" unless -e $sim_binary;
exec ($sim_binary, @args)
+1 -1
View File
@@ -33,9 +33,9 @@ module Make(A:Data.MISSION) = struct
let servos_period = 25 (* ms *)
let periodic_period = 16 (* ms *)
let rc_period = 25 (* ms *)
let id_period = 10_000 (* ms *)
let periodic = fun p f ->
f ();
ignore (GMain.Timeout.add p (fun () -> f (); true))
+1 -1
View File
@@ -44,7 +44,7 @@ sub parse_args {
my ($self) = @_;
my $options = {
ivy_bus => "127.255.255.255:2005",
map => "maps/muret_UTM.xml",
map => "muret_UTM.xml",
render => "1",
};
GetOptions("b=s" => \$options->{ivy_bus},
+2 -2
View File
@@ -51,12 +51,12 @@ let gen_periodic = fun avr_h messages ->
fprintf avr_h "#define PeriodicSend() { /* %dHz */ \\\n" freq;
fprintf avr_h " static uint8_t i;\\\n";
fprintf avr_h " i++; if (i == %d) i = 0;\\\n" nb_steps;
fprintf avr_h " if (i == %d) i = 0;\\\n" nb_steps;
List.iter
(fun (p, id) ->
fprintf avr_h " if (i %% %d == 0) PERIODIC_SEND_%s();\\\n" p id)
scheduled_messages;
fprintf avr_h "}\n"
fprintf avr_h " i++;\\\n}\n"