diff --git a/Makefile b/Makefile index 6de7d98b1e..b4778d82c6 100644 --- a/Makefile +++ b/Makefile @@ -114,13 +114,13 @@ clean_ac : rm -fr $(PAPARAZZI_HOME)/var/$(AIRCRAFT) run_sitl : - $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/sim/simsitl.out + $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/sim/simsitl -install : all - ./Makefile.pl -install -destdir $(DESTDIR) +install : + ./Makefile.pl -install -destdir $(DESTDIR)/usr uninstall : - ./Makefile.pl -uninstall -destdir $(DESTDIR) + ./Makefile.pl -uninstall -destdir $(DESTDIR)/usr deb : chmod u+x debian/rules diff --git a/conf/Makefile.local b/conf/Makefile.local index 8914f769d7..94c91b07d7 100644 --- a/conf/Makefile.local +++ b/conf/Makefile.local @@ -1,11 +1,11 @@ -DESTDIR=/usr +DESTDIR=/ ifeq ($(PAPARAZZI_HOME),) PAPARAZZI_HOME=$(HOME)/paparazzi endif ifeq ($(PAPARAZZI_SRC),) -TOOLS=$(DESTDIR)/share/paparazzi/bin +TOOLS=$(DESTDIR)/usr/share/paparazzi/bin else TOOLS=$(PAPARAZZI_SRC)/sw/tools endif diff --git a/conf/install.xml b/conf/install.xml index 3f010dafb0..74951c36a0 100644 --- a/conf/install.xml +++ b/conf/install.xml @@ -2,19 +2,20 @@
+
- + - - - - - + + + + + @@ -66,7 +67,7 @@ - + @@ -119,17 +120,64 @@
+
+ + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + + + + + + + + + + + +
+
- - - - - - + + + + + + + + + + + + + + + + + +
@@ -139,13 +187,11 @@ - - - + @@ -153,11 +199,12 @@ - - + + +
@@ -224,11 +271,11 @@
- +
- +
diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/control b/debian/control index 14c41867b0..f9fa3010cc 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 4.0.0) Standards-Version: 3.6.1 Package: paparazzi -Architecture: any +Architecture: i386 Depends: ivy-c-dev, ivy-c, ivy-perl, libsubject-perl, zinc-perl, zinc-tk, ivy-ocaml, xml-light-ocaml, libxml-dom-perl, libpcre3-dev, liblablgtk2-ocaml-dev, gcc-avr, avr-libc, binutils-avr, libexpect-perl, libgnomecanvas2-dev, libcamlimages-ocaml-dev, uisp, libfile-ncopy-perl, libtext-csv-perl, digikit Description: Paparazzi Meta Package diff --git a/debian/rules b/debian/rules index 88d683b7ba..b488190f9c 100644 --- a/debian/rules +++ b/debian/rules @@ -34,8 +34,8 @@ build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. - # $(MAKE) - #docbook-to-man debian/paparazzi.sgml > paparazzi.1 + $(MAKE) + #docbook-to-man debian/ivy-ocaml.sgml > ivy-ocaml.1 touch build-stamp @@ -45,7 +45,7 @@ clean: rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. - # -$(MAKE) clean + -$(MAKE) clean dh_clean @@ -55,8 +55,8 @@ install: build dh_clean -k dh_installdirs - # Add here commands to install the package into debian/paparazzi. - # $(MAKE) install DESTDIR=$(CURDIR)/debian/paparazzi + # Add here commands to install the package into debian/ivy-ocaml. + $(MAKE) install DESTDIR=$(CURDIR)/debian/paparazzi # Build architecture-independent files here. diff --git a/paparazzi_demo b/paparazzi_demo new file mode 100755 index 0000000000..b3d3b92ad6 --- /dev/null +++ b/paparazzi_demo @@ -0,0 +1,15 @@ +#! /bin/sh +mkdir -p $HOME/paparazzi +cp -a /usr/share/paparazzi/var $HOME/paparazzi +cp -a /usr/share/paparazzi/conf $HOME/paparazzi +cp -a /usr/share/paparazzi/data $HOME/paparazzi +PATH=$PATH:/usr/share/paparazzi/bin +cockpit.pl & +sleep 1 +map2d -m muret_UTM.xml & +sleep 1 +$HOME/paparazzi/var/Thon1/sim/simsitl & +sleep 1 +$HOME/paparazzi/var/Thon2/sim/simsitl & +sleep 1 +receive diff --git a/pprz_src_test.sh b/pprz_src_test.sh new file mode 100644 index 0000000000..f5926e2706 --- /dev/null +++ b/pprz_src_test.sh @@ -0,0 +1,4 @@ +#! /bin/sh +if test -z "$PAPARAZZI_SRC"; then + PAPARAZZI_SRC=/usr/share/paparazzi +fi diff --git a/sw/configurator/Makefile b/sw/configurator/Makefile index dc57bedddc..62218b9a6a 100644 --- a/sw/configurator/Makefile +++ b/sw/configurator/Makefile @@ -23,16 +23,25 @@ OCAMLC=ocamlc -g -I +labltk -I +lablgtk2 -I ../lib/ocaml -SRC = env_conf.ml notebook.ml tty.ml varXml.ml console.ml tkXml.ml flasher.ml welcome.ml hardware.ml radio.ml servos.ml adc.ml infrared.ml attitude.ml autopilot.ml airframe.ml flightplan.ml upload.ml simulator.ml monitor.ml logalizer.ml main.ml -CMO = $(SRC:.ml=.cmo) +CMO = env_conf.cmo notebook.cmo tty.cmo varXml.cmo console.cmo tkXml.cmo flasher.cmo welcome.cmo hardware.cmo radio.cmo servos.cmo adc.cmo infrared.cmo attitude.cmo autopilot.cmo airframe.cmo flightplan.cmo upload.cmo simulator.cmo monitor.cmo logalizer.cmo main.ml -all : configurator medit.out +ABS_CMO = $(CMO:%=$$PAPARAZZI_SRC/sw/configurator/%) + +all : configurator medit configurator : $(CMO) - $(OCAMLC) -custom -o $@ unix.cma str.cma xml-light.cma labltk.cma jpflib.cma lib.cma $^ + $(OCAMLC) -custom -o /dev/null unix.cma str.cma xml-light.cma labltk.cma jpflib.cma lib-pprz.cma $^ # To check + cat ../../pprz_src_test.sh > $@ + echo 'ocaml -I +labltk -I $$PAPARAZZI_SRC/sw/lib/ocaml -I $$PAPARAZZI_SRC/sw/configurator unix.cma str.cma xml-light.cma labltk.cma jpflib.cma lib-pprz.cma $(ABS_CMO) $$*' >> $@ + chmod a+x $@ + +medit : medit.ml + $(OCAMLC) -o /dev/null str.cma unix.cma xml-light.cma glibivy-ocaml.cma -I +lablgtk2 lablgtk.cma lablgnomecanvas.cma gtkInit.cmo lib-pprz.cma $^ # To check + cat ../../pprz_src_test.sh > $@ + echo 'lablgtk2 -I $$PAPARAZZI_SRC/sw/lib/ocaml str.cma unix.cma xml-light.cma glibivy-ocaml.cma lib-pprz.cma $$PAPARAZZI_SRC/sw/configurator/$< $$*' >> $@ + chmod a+x $@ + -medit.out : medit.cmo - $(OCAMLC) -o $@ str.cma unix.cma xml-light.cma glibivy-ocaml.cma -I +lablgtk2 lablgtk.cma lablgnomecanvas.cma gtkInit.cmo lib.cma $^ %.cmo : %.ml $(OCAMLC) -c $< diff --git a/sw/ground_segment/cockpit/Makefile b/sw/ground_segment/cockpit/Makefile index 41eeaa713b..98607889bf 100644 --- a/sw/ground_segment/cockpit/Makefile +++ b/sw/ground_segment/cockpit/Makefile @@ -1,25 +1,18 @@ OCAMLC=ocamlc -g OCAMLOPT=ocamlopt INCLUDES=-I +lablgtk2 -I +camlimages -I ../../lib/ocaml -LIBS=glibivy-ocaml.cma lablgtk.cma ci_core.cma ci_png.cma ci_gif.cma ci_jpeg.cma ci_tiff.cma ci_bmp.cma ci_ppm.cma ci_ps.cma lib.cma lablgnomecanvas.cma xlib.cma +LIBS=glibivy-ocaml.cma lablgtk.cma ci_core.cma ci_png.cma ci_gif.cma ci_jpeg.cma ci_tiff.cma ci_bmp.cma ci_ppm.cma ci_ps.cma lib-pprz.cma lablgnomecanvas.cma xlib-pprz.cma CMXA=$(LIBS:.cma=.cmxa) -SRC = map2d.ml -CMO = $(SRC:.ml=.cmo) -CMX = $(SRC:.ml=.cmx) -all : map2d.opt +all : map2d -map2d.out : $(CMO) - $(OCAMLC) $(INCLUDES) $(LIBS) gtkInit.cmo $(CMO) -o $@ - - -map2d.opt : $(CMX) - $(OCAMLOPT) str.cmxa unix.cmxa xml-light.cmxa $(INCLUDES) $(CMXA) gtkInit.cmx $(CMX) -o $@ - -map2d.run: - lablgtk2 str.cma unix.cma xml-light.cma -I +camlimages -I ../../lib/ocaml glibivy-ocaml.cma ci_core.cma ci_png.cma ci_gif.cma ci_jpeg.cma ci_tiff.cma ci_bmp.cma ci_ppm.cma ci_ps.cma lib.cma xlib.cma map2d.ml +map2d : map2d.ml + $(OCAMLC) -custom $(INCLUDES) $(LIBS) gtkInit.cmo $(CMO) -o /dev/null #to Check + cat ../../../pprz_src_test.sh > $@ + echo 'lablgtk2 str.cma unix.cma xml-light.cma -I +camlimages glibivy-ocaml.cma ci_core.cma ci_png.cma ci_gif.cma ci_jpeg.cma ci_tiff.cma ci_bmp.cma ci_ppm.cma ci_ps.cma -I $$PAPARAZZI_SRC/sw/lib/ocaml lib-pprz.cma xlib-pprz.cma $$PAPARAZZI_SRC/sw/ground_segment/cockpit/$< $$*' >> $@ + chmod a+x $@ .SUFFIXES: .ml .mli .cmo .cmi .cmx diff --git a/sw/ground_segment/cockpit/map2d.ml b/sw/ground_segment/cockpit/map2d.ml index 88f88ddd67..757ac2cb38 100644 --- a/sw/ground_segment/cockpit/map2d.ml +++ b/sw/ground_segment/cockpit/map2d.ml @@ -18,7 +18,7 @@ let gen_flight_plan = try Sys.getenv "PAPARAZZI_SRC" // "sw/tools/gen_flight_plan.out" with - Not_found -> "/usr/bin/paparazzi gen_flight_plan" + Not_found -> "/usr/share/paparazzi/bin/gen_flight_plan.out" type aircraft = { diff --git a/sw/ground_segment/tmtc/Makefile b/sw/ground_segment/tmtc/Makefile index a1852c7d64..70cb93011d 100644 --- a/sw/ground_segment/tmtc/Makefile +++ b/sw/ground_segment/tmtc/Makefile @@ -22,37 +22,32 @@ include ../../../conf/Makefile.local -all: messages.cmo modem.cmo receive.cmo receive.opt messages.opt +all: receive messages clean: - rm -f receive *.bak *~ core *.o .depend *.opt *.out *.cm* + rm -f receive messages *.bak *~ core *.o .depend *.opt *.out *.cm* OCAMLC = ocamlc OCAMLOPT = ocamlopt INCLUDES= -I ../../lib/ocaml -I +lablgtk2 -messages.opt : messages.ml - $(OCAMLOPT) $(INCLUDES) -o $@ unix.cmxa xml-light.cmxa glibivy-ocaml.cmxa -I +lablgtk2 lablgtk.cmxa gtkInit.cmx str.cmxa lib.cmxa $^ - strip $@ +messages: messages.ml + $(OCAMLC) $(INCLUDES) -o /dev/null unix.cma xml-light.cma glibivy-ocaml.cma -I +lablgtk2 lablgtk.cma gtkInit.cmo str.cma lib-pprz.cma $^ # To check + cat ../../../pprz_src_test.sh > $@ + echo 'lablgtk2 str.cma ivy-ocaml.cma -I $$PAPARAZZI_SRC/sw/lib/ocaml lib-pprz.cma $$PAPARAZZI_SRC/sw/ground_segment/tmtc/$< $$*' >> $@ + chmod a+x $@ -messages.run: - lablgtk2 str.cma -I ../../lib/ocaml ivy-ocaml.cma lib.cma messages.cmo -receive.opt : modem.ml receive.ml - $(OCAMLOPT) $(INCLUDES) -o $@ str.cmxa unix.cmxa xml-light.cmxa glibivy-ocaml.cmxa -I +lablgtk2 lablgtk.cmxa lib.cmxa $^ - strip $@ +receive : modem.cmo receive.ml + $(OCAMLC) $(INCLUDES) -o $@ str.cma unix.cma xml-light.cma glibivy-ocaml.cma -I +lablgtk2 lablgtk.cma lib-pprz.cma $^ #To check + cat ../../../pprz_src_test.sh > $@ + echo 'lablgtk2 str.cma glibivy-ocaml.cma -I $$PAPARAZZI_SRC/sw/lib/ocaml lib-pprz.cma -I $$PAPARAZZI_SRC/sw/ground_segment/tmtc $$PAPARAZZI_SRC/sw/ground_segment/tmtc/modem.cmo $$PAPARAZZI_SRC/sw/ground_segment/tmtc/receive.ml $$*' >> $@ + chmod a+x $@ listen.opt : listen.ml $(OCAMLOPT) $(INCLUDES) -o $@ str.cmxa unix.cmxa xml-light.cmxa glibivy-ocaml.cmxa -I +lablgtk2 lablgtk.cmxa lib.cmxa $^ strip $@ -receive.out : modem.ml receive.ml - $(OCAMLC) -g $(INCLUDES) -o $@ str.cma unix.cma xml-light.cma glibivy-ocaml.cma -I +lablgtk2 lablgtk.cma lib.cma $^ - - -receive.run: - lablgtk2 str.cma -I ../../lib/ocaml ivy-ocaml.cma lib.cma modem.cmo receive.ml - %.cmo : %.ml $(OCAMLC) $(INCLUDES) -c $< diff --git a/sw/ground_segment/visu3d/Makefile b/sw/ground_segment/visu3d/Makefile index 1b36cf18ca..c7f696439d 100644 --- a/sw/ground_segment/visu3d/Makefile +++ b/sw/ground_segment/visu3d/Makefile @@ -12,22 +12,22 @@ OBJS= $(SRC:.ml=.cmo) LINK= $(OCAMLC) $(MLFLAGS) LIBS_CI = ci_core.cma ci_gif.cma ci_jpeg.cma ci_tiff.cma ci_bmp.cma ci_ppm.cma ci_png.cma \ ci_xpm.cma ci_ps.cma ci_freetype.cma -STDLIBS = unix.cma str.cmxa xml-light.cma lablgtk.cma lablgl.cma lablgtkgl.cma $(LIBS_CI) -ADD_LIBS = lib.cma xlib.cma glibivy-ocaml.cma +STDLIBS = unix.cma str.cma xml-light.cma lablgtk.cma lablgnomecanvas.cma lablgl.cma lablgtkgl.cma $(LIBS_CI) +ADD_LIBS = lib-pprz.cma xlib-pprz.cma glibivy-ocaml.cma CLIBS = -cclib -lpthread -all: mapGL.opt +all: mapGL clean: - \rm -f *.cm* *.o *.a *~ *.opt *.out *.top *.output *obj *exe \ + \rm -f mapGL *.cm* *.o *.a *~ *.opt *.out *.top *.output *obj *exe \ stars_lexer.ml stars_parser.mli stars_parser.ml .depend # Executables -mapGL.out: $(OBJS) - $(OCAMLC) $(MLFLAGS) $(STDLIBS) gtkInit.cmo $(ADD_LIBS) -o $@ $(OBJS_3D) $(OBJS) $(CLIBS) - -mapGL.opt: $(OBJS:.cmo=.cmx) - $(OCAMLOPT) $(MLFLAGS) $(STDLIBS:.cma=.cmxa) gtkInit.cmx $(ADD_LIBS:.cma=.cmxa) -o $@ $(OBJS:.cmo=.cmx) $(CLIBS) +mapGL: mapGL.ml + $(OCAMLC) $(MLFLAGS) $(STDLIBS) gtkInit.cmo $(ADD_LIBS) -o $@ $< $(CLIBS) # To check + cat ../../../pprz_src_test.sh > $@ + echo 'ocaml -I +lablgtk2 -I +lablGL -I +camlimages -I $$PAPARAZZI_SRC/sw/lib/ocaml $(STDLIBS) gtkInit.cmo $(ADD_LIBS) $$PAPARAZZI_SRC/sw/ground_segment/visu3d/$< $$*' >> $@ + chmod a+x $@ # Do not edit below this line diff --git a/sw/ground_segment/visu3d/mapGL.ml b/sw/ground_segment/visu3d/mapGL.ml index 97dfc7bb62..87c93f8f05 100644 --- a/sw/ground_segment/visu3d/mapGL.ml +++ b/sw/ground_segment/visu3d/mapGL.ml @@ -395,7 +395,7 @@ let build_interface = fun map_file mission_file -> let (window, vbox, factory, accel_group, menus, menu_help) = Gtk_tools.create_window_with_menubar_help ("Visu Drone v"^version) width height liste_menus in - window#connect#destroy ~callback:GMain.Main.quit; + ignore (window#connect#destroy ~callback:GMain.Main.quit); (* Creation du Widget OpenGL *) let view3d = new widget_3d vbox#add false "" in @@ -407,27 +407,27 @@ let build_interface = fun map_file mission_file -> (* Creation des menus : Sol *) let factory = new GMenu.factory menus.(!nb_menus) ~accel_group in incr nb_menus ; - factory#add_item "Load Background" - ~callback:(on_load_surface window view3d id_sol) ; + ignore (factory#add_item "Load Background" + ~callback:(on_load_surface window view3d id_sol)) ; (* Creation des menus : Trajectoires *) let factory = new GMenu.factory menus.(!nb_menus) ~accel_group in incr nb_menus ; - factory#add_item "Load Track" ~callback:(load_trajectory view3d lst_ids_trajs) ; - factory#add_item "Edit Tracks" - ~callback:(build_lst_traj tooltips view3d lst_ids_trajs) ; + ignore (factory#add_item "Load Track" ~callback:(load_trajectory view3d lst_ids_trajs)) ; + ignore (factory#add_item "Edit Tracks" + ~callback:(build_lst_traj tooltips view3d lst_ids_trajs)) ; (* Creation des menus : Parametres *) let factory = new GMenu.factory menus.(!nb_menus) ~accel_group in incr nb_menus ; - factory#add_item "Edit" ~callback:(fun () -> ()) ; + ignore (factory#add_item "Edit" ~callback:(fun () -> ())) ; (* Aide *) let factory = new GMenu.factory menu_help in - factory#add_item "A propos" ~callback:build_fen_about ; - factory#add_item "Help keys/mouse" + ignore (factory#add_item "A propos" ~callback:build_fen_about) ; + ignore (factory#add_item "Help keys/mouse" ~callback:(fun () -> Gtk_tools.display_file filename_help_keys - "Aide touches clavier" 370 500 tooltips (Some "fixed")) ; + "Aide touches clavier" 370 500 tooltips (Some "fixed"))) ; (* Affichage de la fenetre principale *) window#show () ; diff --git a/sw/ground_segment/wind/Makefile b/sw/ground_segment/wind/Makefile index 4267b10be0..3d20ebef03 100644 --- a/sw/ground_segment/wind/Makefile +++ b/sw/ground_segment/wind/Makefile @@ -22,7 +22,7 @@ include ../../../conf/Makefile.local -all: wind.opt +all: wind INCLUDES= -I ../../lib/ocaml -I +lablgtk2 @@ -33,9 +33,12 @@ OCAMLDEP= ocamldep $(INCLUDES) -wind.opt : wind.cmx - $(OCAMLOPT) -o $@ xml-light.cmxa glibivy-ocaml.cmxa lablgtk.cmxa str.cmxa lib.cmxa $< - strip $@ +wind : wind.ml + $(OCAMLC) -o $@ xml-light.cma glibivy-ocaml.cma lablgtk.cma str.cma lib-pprz.cma $< # To check + cat ../../../pprz_src_test.sh > $@ + echo 'ocaml -I +lablgtk2 -I $$PAPARAZZI_SRC/sw/lib/ocaml xml-light.cma glibivy-ocaml.cma lablgtk.cma str.cma lib-pprz.cma $$PAPARAZZI_SRC/sw/ground_segment/wind/$< $$*' >> $@ + chmod a+x $@ + .SUFFIXES: .SUFFIXES: .ml .mli .mly .mll .cmi .cmo .cmx .out .opt .p.cmx .popt diff --git a/sw/lib/ocaml/Makefile b/sw/lib/ocaml/Makefile index b0f0a83865..d6bda7a113 100644 --- a/sw/lib/ocaml/Makefile +++ b/sw/lib/ocaml/Makefile @@ -21,7 +21,7 @@ # INCLUDES= -I +lablgl -I +camlimages -I +lablgtk2 -OCAMLC=ocamlc -g $(INCLUDES) +OCAMLC=ocamlc $(INCLUDES) OCAMLOPT=ocamlopt $(INCLUDES) @@ -34,22 +34,23 @@ XCMO = $(XSRC:.ml=.cmo) XCMX = $(XSRC:.ml=.cmx) -all : lib.cma lib.cmxa xlib.cma xlib.cmxa xml_get.out +all : lib-pprz.cma xlib-pprz.cma xml_get.out +# lib-pprz.cmxa xlib-pprz.cmxa -lib.cma : $(CMO) - ocamlmklib -custom -o lib str.cma xml-light.cma unix.cma $^ +lib-pprz.cma : $(CMO) + ocamlmklib -o lib-pprz str.cma xml-light.cma unix.cma $^ -lib.cmxa : $(CMX) - ocamlmklib -custom -o lib $^ +lib-pprz.cmxa : $(CMX) + ocamlmklib -o lib-pprz $^ -xlib.cma : $(XCMO) - ocamlmklib -custom -o xlib $^ +xlib-pprz.cma : $(XCMO) + ocamlmklib -o xlib-pprz $^ -xlib.cmxa : $(XCMX) - ocamlmklib -custom -o xlib $^ +xlib-pprz.cmxa : $(XCMX) + ocamlmklib -o xlib-pprz $^ -xml_get.out : lib.cma xml_get.cmo +xml_get.out : lib-pprz.cma xml_get.cmo $(OCAMLC) -o $@ str.cma xml-light.cma -I . $^ ignutm.opt : latlong.cmx ignutm.ml diff --git a/sw/lib/ocaml/pprz.ml b/sw/lib/ocaml/pprz.ml index 9fc404bf87..b60d664e2f 100644 --- a/sw/lib/ocaml/pprz.ml +++ b/sw/lib/ocaml/pprz.ml @@ -53,7 +53,8 @@ type type_descr = { let (//) = Filename.concat -let messages_xml = Xml.parse_file (Env.paparazzi_src // "conf" // "messages.xml") +let lazy_messages_xml = lazy (Xml.parse_file (Env.paparazzi_src // "conf" // "messages.xml")) +let messages_xml = fun () -> Lazy.force lazy_messages_xml external float_of_bytes : string -> int -> float = "c_float_of_indexed_bytes" external int32_of_bytes : string -> int -> int32 = "c_int32_of_indexed_bytes" @@ -85,8 +86,9 @@ let field_of_xml = fun xml -> (** Table of msg classes indexed by name. Each class is a table of messages indexed by ids *) -let classes = Hashtbl.create 13 -let _ = +let lazy_classes = + lazy + (let h = Hashtbl.create 13 in List.iter (fun xml_class -> let by_id = Hashtbl.create 13 @@ -105,9 +107,12 @@ let _ = with _ -> fprintf stderr "Warning: Ignoring '%s'\n" (Xml.to_string xml_msg)) (Xml.children xml_class); - Hashtbl.add classes (ExtXml.attrib xml_class "name") (by_id, by_name) + Hashtbl.add h (ExtXml.attrib xml_class "name") (by_id, by_name) ) - (Xml.children messages_xml) + (Xml.children (messages_xml ())); + h) + +let classes = fun () -> Lazy.force lazy_classes let magic = fun x -> (Obj.magic x:('a,'b,'c) Pervasives.format) @@ -129,7 +134,7 @@ module Protocol(Class:CLASS) = struct let index_start = fun buf -> String.index buf stx - let messages_by_id, messages_by_name = Hashtbl.find classes Class.name + let messages_by_id, messages_by_name = Hashtbl.find (classes ()) Class.name let message_of_id = fun id -> Hashtbl.find messages_by_id (id (*** +1 ***)) let message_of_name = fun name -> Hashtbl.find messages_by_name name diff --git a/sw/logalizer/Makefile b/sw/logalizer/Makefile index c3423ec6a3..4f8681890e 100644 --- a/sw/logalizer/Makefile +++ b/sw/logalizer/Makefile @@ -20,13 +20,16 @@ # Boston, MA 02111-1307, USA. # -OCAMLC = ocamlc -I ../lib/ocaml -OCAMLOPT = ocamlopt -I ../lib/ocaml +OCAMLC = ocamlc +OCAMLOPT = ocamlopt -all: play.opt +all: play clean: - rm -f *.opt *.out *~ core *.o *.bak .depend *.cm* + rm -f *.opt *.out *~ core *.o *.bak .depend *.cm* play -play.opt : play.ml - $(OCAMLOPT) -o $@ unix.cmxa glibivy-ocaml.cmxa -I +lablgtk2 lablgtk.cmxa gtkInit.cmx $^ +play : play.ml + $(OCAMLC) -o $@ unix.cma glibivy-ocaml.cma -I +lablgtk2 lablgtk.cma gtkInit.cmo $^ # to check + cat ../../pprz_src_test.sh > $@ + echo 'lablgtk2 unix.cma glibivy-ocaml.cma $$PAPARAZZI_SRC/sw/logalizer/$< $$*' >> $@ + chmod a+x $@ diff --git a/sw/simulator/Makefile b/sw/simulator/Makefile index d60c602640..d399e923db 100644 --- a/sw/simulator/Makefile +++ b/sw/simulator/Makefile @@ -34,6 +34,7 @@ SIMSCMO=$(SIMSML:%.ml=%.cmo) SIMSCMX=$(SIMSML:%.ml=%.cmx) SIMSC = sim_ir.c sim_gps.c sim_ap.c estimator.c pid.c nav.c main.c SIMSO=$(SIMSC:%.c=$(OBJDIR)/%.o) +SIMSA=sims.cma OCAMLC = ocamlc OCAMLOPT=ocamlopt -p @@ -46,7 +47,7 @@ VARINCLUDE=$(PAPARAZZI_HOME)/var/include ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT) MESSAGES = ../../conf/messages.xml -GEN_DOWNLINK = ./gen_downlink.out +GEN_DOWNLINK = ./gen_downlink SIMDIR=$(shell echo `pwd`) @@ -55,7 +56,7 @@ SIMDIR=$(shell echo `pwd`) #all : simhitl.out sitl.cma $(GEN_DOWNLINK) all : sitl.cma $(GEN_DOWNLINK) -sim_sitl : $(OBJDIR)/simsitl.out +sim_sitl : $(OBJDIR)/simsitl simhitl.out : $(SIMHCMO) simhitl.cmo $(OCAMLC) $(INCLUDES) -o $@ str.cma xml-light.cma unix.cma lib.cma lablgtk.cma gtkInit.cmo $^ @@ -66,8 +67,15 @@ sitl.cma : $(SIMSCMO) sitl.cmxa : $(SIMSCMX) ocamlopt -o $@ -a $^ -$(OBJDIR)/simsitl.out : sitl.cma $(SIMSO) $(OBJDIR)/simsitl.cmo - $(OCAMLC) $(INCLUDES) -custom -o $@ glibivy-ocaml.cma xml-light.cma unix.cma lib.cma lablgtk.cma gtkInit.cmo $(SIMSO) sitl.cma $(OBJDIR)/simsitl.cmo +$(OBJDIR)/$(SIMSA) : $(SIMSO) + touch $(OBJDIR)/dummy.ml + cd $(OBJDIR); ocamlmklib -o sims $^ dummy.ml + +$(OBJDIR)/simsitl : $(OBJDIR)/$(SIMSA) sitl.cma $(OBJDIR)/simsitl.ml + $(OCAMLC) $(INCLUDES) -o $@ glibivy-ocaml.cma xml-light.cma unix.cma lib-pprz.cma lablgtk.cma gtkInit.cmo -I $(OBJDIR) $(SIMSA) sitl.cma $(OBJDIR)/simsitl.ml # To check + cat ../../pprz_src_test.sh > $@ + echo 'lablgtk2 -I $$PAPARAZZI_SRC/sw/lib/ocaml -I $(OBJDIR) glibivy-ocaml.cma xml-light.cma lib-pprz.cma $(SIMSA) $$PAPARAZZI_SRC/sw/simulator/sitl.cma -I $$PAPARAZZI_SRC/sw/simulator $(OBJDIR)/simsitl.ml $$*' >> $@ + chmod a+x $@ $(OBJDIR)/simsitl.opt : $(SIMSO) $(OBJDIR)/simsitl.cmx $(OCAMLOPT) $(INCLUDES) -o $@ str.cmxa glibivy-ocaml.cmxa xml-light.cmxa unix.cmxa lib.cmxa lablgtk.cmxa gtkInit.cmx $(SIMSO) sitl.cmxa $(OBJDIR)/simsitl.cmx @@ -90,8 +98,10 @@ $(OBJDIR)/downlink.h : $(MESSAGES) $(GEN_DOWNLINK) $(GEN_DOWNLINK) $< > $@ $(GEN_DOWNLINK) : gen_downlink.ml - $(OCAMLC) $(INCLUDES) -o $@ str.cma xml-light.cma lib.cma $< - + $(OCAMLC) $(INCLUDES) -o $@ str.cma xml-light.cma lib-pprz.cma $< # To check + cat ../../pprz_src_test.sh > $@ + echo 'ocaml -I $$PAPARAZZI_SRC/sw/lib/ocaml str.cma xml-light.cma lib-pprz.cma $$PAPARAZZI_SRC/sw/simulator/$< $$*' >> $@ + chmod a+x $@ $(OBJDIR)/simsitl.cmo : $(OBJDIR)/simsitl.ml $(OCAMLC) $(INCLUDES) -c -o $@ $< @@ -113,7 +123,7 @@ $(OBJDIR)/simsitl.ml : simsitl.ml $(OCAMLC) $(INCLUDES) -c $< clean : - \rm -f *.cm* *~ *.out .depend *.o + \rm -f *.cm* *~ *.out .depend *.o $(GEN_DOWNLINK) .depend: ocamldep *.ml* > .depend diff --git a/sw/simulator/gen_downlink.ml b/sw/simulator/gen_downlink.ml index 796e324610..66c1416c82 100644 --- a/sw/simulator/gen_downlink.ml +++ b/sw/simulator/gen_downlink.ml @@ -76,6 +76,8 @@ let one_message = fun m -> printf "}\n\n" let _ = + if Array.length Sys.argv <> 2 then + failwith (sprintf "Usage: %s " Sys.argv.(0)); let xml = Xml2h.start_and_begin Sys.argv.(1) h_name in let xml = ExtXml.child xml ~select:(fun x -> Xml.attrib x "name"="telemetry_ap") "class" in let messages = (Xml.children xml) in diff --git a/sw/simulator/sim.ml b/sw/simulator/sim.ml index c4276eead5..c8f23b4403 100644 --- a/sw/simulator/sim.ml +++ b/sw/simulator/sim.ml @@ -120,7 +120,7 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct let gust_norm_max_adj = GData.adjustment ~value:0. ~lower:(0.) ~upper:20. ~step_incr:0.1 () in let gust_norm_ch_fact_adj = GData.adjustment ~value:0. ~lower:(0.) ~upper:20. ~step_incr:0.1 () in let gust_dir_ch_fact_adj = GData.adjustment ~value:0. ~lower:(0.) ~upper:20. ~step_incr:0.1 () in - let infrared_contrast_adj = GData.adjustment ~value:0. ~lower:(0.) ~upper:1010. ~step_incr:10. () in + let infrared_contrast_adj = GData.adjustment ~value:500. ~lower:(0.) ~upper:1010. ~step_incr:10. () in let run = ref false in let scheduler = diff --git a/sw/tools/Makefile b/sw/tools/Makefile index 055d7e53da..1f6dd1e4e6 100644 --- a/sw/tools/Makefile +++ b/sw/tools/Makefile @@ -1,13 +1,17 @@ +OCAML=ocaml OCAMLC=ocamlc -g -I ../lib/ocaml OCAMLLEX=ocamllex OCAMLYACC=ocamlyacc all: gen_aircraft.out gen_airframe.out gen_calib.out gen_messages.out gen_ubx.out gen_flight_plan.out gen_radio.out -FP_CMO = fp_syntax.cmo fp_parser.cmo fp_lexer.cmo fp_proc.cmo gen_flight_plan.cmo +FP_CMO = fp_syntax.cmo fp_parser.cmo fp_lexer.cmo fp_proc.cmo gen_flight_plan.ml +ABS_FP = $(FP_CMO:%=$$PAPARAZZI_SRC/sw/tools/%) gen_flight_plan.out : $(FP_CMO) - $(OCAMLC) lib.cma $^ -o $@ + cat ../../pprz_src_test.sh > $@ + echo '$(OCAML) -I $$PAPARAZZI_SRC/sw/lib/ocaml -I $$PAPARAZZI_SRC/sw/tools lib-pprz.cma $(ABS_FP) $$*' >> $@ + chmod a+x $@ fp_parser.cmo : fp_parser.cmi fp_syntax.cmi fp_parser.cmi : fp_parser.ml fp_syntax.cmi @@ -18,7 +22,10 @@ fp_syntax.cmo : fp_syntax.cmi %.out : %.ml - $(OCAMLC) lib.cma $< -o $@ + $(OCAMLC) -o /dev/null lib-pprz.cma $< # To check + cat ../../pprz_src_test.sh > $@ + echo '$(OCAML) -I $$PAPARAZZI_SRC/sw/lib/ocaml lib-pprz.cma $$PAPARAZZI_SRC/sw/tools/$< $$*' >> $@ + chmod a+x $@ %.cmo : %.ml $(OCAMLC) -c $< diff --git a/sw/tools/gen_aircraft.ml b/sw/tools/gen_aircraft.ml index 14dd098492..4612e8c86b 100644 --- a/sw/tools/gen_aircraft.ml +++ b/sw/tools/gen_aircraft.ml @@ -10,6 +10,8 @@ let mkdir = fun d -> Unix.mkdir d 0o755 let _ = + if Array.length Sys.argv <> 2 then + failwith (sprintf "Usage: %s " Sys.argv.(0)); let aircraft = Sys.argv.(1) in let conf = Xml.parse_file conf_xml in let aircraft_xml = diff --git a/sw/tools/gen_flight_plan.ml b/sw/tools/gen_flight_plan.ml index dc56388f09..0c295d8a6d 100644 --- a/sw/tools/gen_flight_plan.ml +++ b/sw/tools/gen_flight_plan.ml @@ -358,12 +358,14 @@ let check_distance = fun (hx, hy) max_d wp -> let _ = - let xml_file = ref "fligh_plan.xml" + let xml_file = ref "" and dump = ref false in Arg.parse [("-dump", Arg.Set dump, "Dump compile result"); ("-nocheck", Arg.Clear check_expressions, "Disable expression checking")] (fun f -> xml_file := f) "Usage:"; + if !xml_file = "" then + failwith (sprintf "Usage: %s " Sys.argv.(0)); try let xml = Xml.parse_file !xml_file in let dir = Filename.dirname !xml_file in diff --git a/sw/tools/gen_messages.ml b/sw/tools/gen_messages.ml index d0e61e25b9..053f33a46d 100644 --- a/sw/tools/gen_messages.ml +++ b/sw/tools/gen_messages.ml @@ -239,7 +239,7 @@ end let _ = if Array.length Sys.argv <> 3 then begin - fprintf stderr "Usage: %s <.xml file> " Sys.argv.(0) + failwith (sprintf "Usage: %s <.xml file> " Sys.argv.(0)) end; let filename = Sys.argv.(1) in let class_name = Sys.argv.(2) in diff --git a/sw/tools/gen_ubx.ml b/sw/tools/gen_ubx.ml index 4251a77007..2de6d7fbbb 100644 --- a/sw/tools/gen_ubx.ml +++ b/sw/tools/gen_ubx.ml @@ -100,6 +100,9 @@ let parse_class = fun c -> let _ = + if Array.length Sys.argv <> 2 then begin + failwith (sprintf "Usage: %s <.xml ubx protocol file>" Sys.argv.(0)) + end; let xml_file = Sys.argv.(1) in try let xml = Xml.parse_file xml_file in