Skip to content

Commit

Permalink
[ocaml] add old and new GCS srtm path to default directory list (#3030)
Browse files Browse the repository at this point in the history
  • Loading branch information
gautierhattenberger committed May 9, 2023
1 parent 1a985e5 commit 10bdec0
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 14 deletions.
2 changes: 0 additions & 2 deletions sw/ground_segment/cockpit/gcs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ let soi = string_of_int

let home = Env.paparazzi_home
let (//) = Filename.concat
let default_path_srtm = home // "data" // "srtm"
let default_path_maps = home // "data" // "maps"
let layout_path = home // "conf" // "gcs"
let var_maps_path = home // "var" // "maps"
Expand Down Expand Up @@ -628,7 +627,6 @@ let () =
Ivy.start !ivy_bus
end;

Srtm.add_path default_path_srtm;
Gm.cache_path := var_maps_path;
IGN.cache_path := var_maps_path;

Expand Down
2 changes: 0 additions & 2 deletions sw/ground_segment/cockpit/lib/mapCanvas.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ type meter = float

let distance = fun (x1,y1) (x2,y2) -> sqrt ((x1-.x2)**2.+.(y1-.y2)**2.)

let _ = Srtm.add_path "SRTM"

let affine_pos_and_angle ?(z = 1.) xw yw angle =
let cos_a = cos angle in
let sin_a = sin angle in
Expand Down
5 changes: 0 additions & 5 deletions sw/ground_segment/tmtc/150m.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

let (//) = Filename.concat

let srtm_path = Env.paparazzi_home // "data" // "srtm"

(* Hard coded id of the A/C *)
let ac_id = "1"

Expand Down Expand Up @@ -78,9 +76,6 @@ let () =
(* And a button *)
let button = GButton.button ~label:"HOME" ~packing:hbox#add () in

(* Add the appriopriate path to the SRTM tiles *)
Srtm.add_path srtm_path;

(* Listen GPS message *)
ignore (Tele_Pprz.message_bind "GPS" (get_gps_message label));

Expand Down
2 changes: 0 additions & 2 deletions sw/ground_segment/tmtc/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ let dl_id = "ground_dl" (* Hack, should be [my_id] *)
let (//) = Filename.concat
let logs_path = Env.paparazzi_home // "var" // "logs"
let conf_xml = ExtXml.parse_file (Env.paparazzi_home // "conf" // "conf.xml")
let srtm_path = Env.paparazzi_home // "data" // "srtm"

let get_indexed_value = fun ?(text="UNK") t i ->
if i >= 0 then t.(i) else text
Expand Down Expand Up @@ -972,7 +971,6 @@ let () =
(fun x -> Printf.fprintf stderr "%s: Warning: Don't do anything with '%s' argument\n" Sys.argv.(0) x)
"Usage: ";

Srtm.add_path srtm_path;
Ivy.init "Paparazzi server" "READY" (fun _ _ -> ());
Ivy.start !ivy_bus;

Expand Down
3 changes: 3 additions & 0 deletions sw/lib/ocaml/env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ let paparazzi_conf = paparazzi_home // "conf"
let flight_plans_path = paparazzi_conf // "flight_plans"
let flight_plan_dtd = flight_plans_path // "flight_plan.dtd"

let srtm_path = paparazzi_home // "data" // "srtm"
let srtm_pprzgcs_path = (Sys.getenv "HOME") // ".local" // "share" // "pprzgcs" // "srtm"

(** Returns the list of directories where to look for modules
* Default PAPARAZZI_HOME/conf/modules is always returned
* Extra directories can be added with PAPARAZZI_MODULES_PATH
Expand Down
3 changes: 3 additions & 0 deletions sw/lib/ocaml/env.mli
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ val flight_plan_dtd : string
val modules_paths : string list
val modules_ext_paths : string list

val srtm_path : string
val srtm_pprzgcs_path : string

val icon_file : string
(** PNG paparazzi logo icon (48 x 48, 8-bit/color RGBA, non-interlaced) *)

Expand Down
2 changes: 1 addition & 1 deletion sw/lib/ocaml/srtm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ let tile_size_gl1 = 3601
let htiles = Hashtbl.create 13

(* Path to data files *)
let path = ref ["."]
let path = ref ["."; Env.srtm_pprzgcs_path; Env.srtm_path]

let add_path = fun p -> path := p :: !path

Expand Down
1 change: 0 additions & 1 deletion sw/simulator/sim.ml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct

let alt0 =
let ground_alt =
Srtm.add_path (Env.paparazzi_home ^ "/data/srtm");
try
float (Srtm.of_wgs84 !pos0)
with Srtm.Tile_not_found x ->
Expand Down
1 change: 0 additions & 1 deletion sw/tools/generators/gen_flight_plan.ml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ let security_height = ref 0.
let fp_wgs84 = ref { posn_lat = 0.; posn_long = 0.}

let check_altitude_srtm = fun a x wgs84 ->
Srtm.add_path (Env.paparazzi_home ^ "/data/srtm");
try
let srtm_alt = float (Srtm.of_wgs84 wgs84) in
if a < srtm_alt then begin (* Not fully correct, Flightplan "alt" is not alt as we know it *)
Expand Down

0 comments on commit 10bdec0

Please sign in to comment.