paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [4337] move EGM96 model in separated file


From: Pascal Brisset
Subject: [paparazzi-commits] [4337] move EGM96 model in separated file
Date: Mon, 16 Nov 2009 16:42:55 +0000

Revision: 4337
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4337
Author:   hecto
Date:     2009-11-16 16:42:55 +0000 (Mon, 16 Nov 2009)
Log Message:
-----------
 move EGM96 model in separated file

Modified Paths:
--------------
    paparazzi3/trunk/sw/lib/ocaml/Makefile
    paparazzi3/trunk/sw/lib/ocaml/latlong.ml
    paparazzi3/trunk/sw/lib/ocaml/latlong.mli

Added Paths:
-----------
    paparazzi3/trunk/sw/lib/ocaml/egm96.ml
    paparazzi3/trunk/sw/lib/ocaml/egm96.mli

Modified: paparazzi3/trunk/sw/lib/ocaml/Makefile
===================================================================
--- paparazzi3/trunk/sw/lib/ocaml/Makefile      2009-11-14 17:46:10 UTC (rev 
4336)
+++ paparazzi3/trunk/sw/lib/ocaml/Makefile      2009-11-16 16:42:55 UTC (rev 
4337)
@@ -29,7 +29,7 @@
 OCAMLLIBDIR=$(shell ocamlc -where)
 
 
-SRC = debug.ml base64.ml serial.ml ocaml_tools.ml extXml.ml env.ml xml2h.ml 
latlong.ml srtm.ml http.ml gm.ml iGN.ml geometry_2d.ml cserial.o convert.o 
ubx.ml pprz.ml xbee.ml logpprz.ml xmlCom.ml editAirframe.ml
+SRC = debug.ml base64.ml serial.ml ocaml_tools.ml extXml.ml env.ml xml2h.ml 
latlong.ml egm96.ml srtm.ml http.ml gm.ml iGN.ml geometry_2d.ml cserial.o 
convert.o ubx.ml pprz.ml xbee.ml logpprz.ml xmlCom.ml editAirframe.ml
 CMO = $(SRC:.ml=.cmo)
 CMX = $(SRC:.ml=.cmx)
 

Added: paparazzi3/trunk/sw/lib/ocaml/egm96.ml
===================================================================
--- paparazzi3/trunk/sw/lib/ocaml/egm96.ml                              (rev 0)
+++ paparazzi3/trunk/sw/lib/ocaml/egm96.ml      2009-11-16 16:42:55 UTC (rev 
4337)
@@ -0,0 +1,56 @@
+(*
+ * $Id$
+ *
+ * EGM96 geoid model
+ *  
+ * Copyright (C) 2009 ENAC, Pascal Brisset
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA. 
+ *
+ *)
+
+open Latlong
+
+let (//) = Filename.concat
+
+let ncols = 1440
+let nrows = 721
+let data =
+  lazy (
+    let path = [Env.paparazzi_home // "data" // "srtm"] in
+    let f = Ocaml_tools.open_compress (Ocaml_tools.find_file path 
"WW15MGH.DAC") in
+    let n = ncols * nrows * 2 in
+    let buf = String.create n in
+    really_input f buf 0 n;
+    buf)
+
+
+(* 
http://earth-info.nima.mil/GandG/wgs84/gravitymod/egm96/binary/binarygeoid.html 
*)
+let of_wgs84 = fun geo ->
+  let egm96_data = Lazy.force data in
+
+  let lat = truncate ((Rad>>Deg) (norm_angle geo.posn_lat))
+  and lon = truncate ((Rad>>Deg) (norm_angle geo.posn_long)) in
+  let ilat = (90-lat)*4      (* 15' == 4 entries per degree *)
+  and ilon = (lon+if lon < 0 then 360 else 0)*4 in
+
+  let i = (2*(ilat*ncols+ilon)) in
+
+  let x = Char.code egm96_data.[i] lsl 8 + Char.code egm96_data.[i+1] in
+
+  float ((x lsl 16) asr 16) /. 100.

Added: paparazzi3/trunk/sw/lib/ocaml/egm96.mli
===================================================================
--- paparazzi3/trunk/sw/lib/ocaml/egm96.mli                             (rev 0)
+++ paparazzi3/trunk/sw/lib/ocaml/egm96.mli     2009-11-16 16:42:55 UTC (rev 
4337)
@@ -0,0 +1,28 @@
+(*
+ * $Id$
+ *
+ * EGM96 geoid model
+ *  
+ * Copyright (C) 2009 ENAC, Pascal Brisset
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA. 
+ *
+ *)
+
+val of_wgs84 :  Latlong.geographic -> Latlong.fmeter
+(** Return geoid height from 15' precomputed file *)

Modified: paparazzi3/trunk/sw/lib/ocaml/latlong.ml
===================================================================
--- paparazzi3/trunk/sw/lib/ocaml/latlong.ml    2009-11-14 17:46:10 UTC (rev 
4336)
+++ paparazzi3/trunk/sw/lib/ocaml/latlong.ml    2009-11-16 16:42:55 UTC (rev 
4337)
@@ -714,32 +714,3 @@
     (float geoid_data.(ilat1).(ilon2))
     (float geoid_data.(ilat2).(ilon1)) 
     (float geoid_data.(ilat2).(ilon2))
-
-
-
-let egm96_ncols = 1440
-let egm96_nrows = 721
-let egm96_data =
-  lazy (
-    let path = [Env.paparazzi_home // "data" // "srtm"] in
-    let f = Ocaml_tools.open_compress (Ocaml_tools.find_file path 
"WW15MGH.DAC") in
-    let n = egm96_ncols * egm96_nrows * 2 in
-    let buf = String.create n in
-    really_input f buf 0 n;
-    buf)
-
-
-(* 
http://earth-info.nima.mil/GandG/wgs84/gravitymod/egm96/binary/binarygeoid.html 
*)
-let egm96 = fun geo ->
-  let egm96_data = Lazy.force egm96_data in
-
-  let lat = truncate ((Rad>>Deg) (norm_angle geo.posn_lat))
-  and lon = truncate ((Rad>>Deg) (norm_angle geo.posn_long)) in
-  let ilat = (90-lat)*4      (* 15' == 4 entries per degree *)
-  and ilon = (lon+if lon < 0 then 360 else 0)*4 in
-
-  let i = (2*(ilat*egm96_ncols+ilon)) in
-
-  let x = Char.code egm96_data.[i] lsl 8 + Char.code egm96_data.[i+1] in
-
-  float ((x lsl 16) asr 16) /. 100.

Modified: paparazzi3/trunk/sw/lib/ocaml/latlong.mli
===================================================================
--- paparazzi3/trunk/sw/lib/ocaml/latlong.mli   2009-11-14 17:46:10 UTC (rev 
4336)
+++ paparazzi3/trunk/sw/lib/ocaml/latlong.mli   2009-11-16 16:42:55 UTC (rev 
4337)
@@ -199,6 +199,3 @@
 (** [geo_of_ecef ellipsoid geo ecef] Returns llh *)
 
 val wgs84_hmsl : geographic -> fmeter
-
-val egm96 :  geographic -> fmeter
-(** Return geoid height from 15' precomputed file *)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]