From 7dfe598a456f502e74d070ef230f9d792a400e39 Mon Sep 17 00:00:00 2001 From: Pascal Brisset Date: Mon, 23 May 2005 22:24:12 +0000 Subject: [PATCH] *** empty log message *** --- TODO | 4 ++++ conf/control_panel.xml | 23 ++++++++++++----------- conf/messages.xml | 6 ++---- sw/ground_segment/cockpit/map2d.ml | 11 +++++++++++ sw/ground_segment/tmtc/receive.ml | 13 ++++++++++--- sw/lib/ocaml/mapTrack.ml | 6 ++++++ sw/simulator/simsitl.pl | 2 +- sw/simulator/sitl.ml | 2 +- sw/supervision/paparazzi.pl | 2 +- sw/tools/gen_sim_downlink.ml | 4 ++-- 10 files changed, 50 insertions(+), 23 deletions(-) diff --git a/TODO b/TODO index 466b17a091..46d2a05b39 100644 --- a/TODO +++ b/TODO @@ -105,3 +105,7 @@ manque gerbmerge dans les dependance??? ha non ca n'existe pas... a packager ! > - It's strange MIN_HEIGHT_CARROT and MAX_HEIGHT_CARROT are in the >code. Shouldn't it be in a conf file so as to change it ? > +- In the same way, MIN_SPEED_FOR_TAKEOFF should be in the airframe +conf file ? + + diff --git a/conf/control_panel.xml b/conf/control_panel.xml index ac78d3f94e..e96a630015 100644 --- a/conf/control_panel.xml +++ b/conf/control_panel.xml @@ -15,12 +15,12 @@ - +
- + @@ -33,10 +33,11 @@ - + + - + @@ -46,27 +47,27 @@ - + - + - + - + - + @@ -80,7 +81,7 @@ - + @@ -89,7 +90,7 @@ - + diff --git a/conf/messages.xml b/conf/messages.xml index 7e1441877a..e6749e3f23 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -287,7 +287,8 @@ twinstar2 POSITION_UTM 10 10 - + + @@ -332,9 +333,6 @@ twinstar2 POSITION_UTM 10 10 - - - diff --git a/sw/ground_segment/cockpit/map2d.ml b/sw/ground_segment/cockpit/map2d.ml index 757ac2cb38..1e9c8108be 100644 --- a/sw/ground_segment/cockpit/map2d.ml +++ b/sw/ground_segment/cockpit/map2d.ml @@ -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 ) diff --git a/sw/ground_segment/tmtc/receive.ml b/sw/ground_segment/tmtc/receive.ml index ad22c15b0c..5c61dbc27c 100644 --- a/sw/ground_segment/tmtc/receive.ml +++ b/sw/ground_segment/tmtc/receive.ml @@ -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 *) diff --git a/sw/lib/ocaml/mapTrack.ml b/sw/lib/ocaml/mapTrack.ml index e2a49dd710..beb3d65fa2 100644 --- a/sw/lib/ocaml/mapTrack.ml +++ b/sw/lib/ocaml/mapTrack.ml @@ -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 diff --git a/sw/simulator/simsitl.pl b/sw/simulator/simsitl.pl index 81b0aef25b..da38124089 100755 --- a/sw/simulator/simsitl.pl +++ b/sw/simulator/simsitl.pl @@ -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) diff --git a/sw/simulator/sitl.ml b/sw/simulator/sitl.ml index a33a77ed84..51f9959031 100644 --- a/sw/simulator/sitl.ml +++ b/sw/simulator/sitl.ml @@ -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)) diff --git a/sw/supervision/paparazzi.pl b/sw/supervision/paparazzi.pl index 2c3bb08d04..d58dfef7ac 100755 --- a/sw/supervision/paparazzi.pl +++ b/sw/supervision/paparazzi.pl @@ -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}, diff --git a/sw/tools/gen_sim_downlink.ml b/sw/tools/gen_sim_downlink.ml index 66c1416c82..889f04035a 100644 --- a/sw/tools/gen_sim_downlink.ml +++ b/sw/tools/gen_sim_downlink.ml @@ -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"