From 30f63ac86d4f7579f88328041f44da4d91c9a323 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Fri, 27 Mar 2020 21:44:30 +0100 Subject: [PATCH] [sim] change name of stdlib module to avoid collision with the new stdlib in ocaml >= 4.08 --- sw/simulator/Makefile | 4 ++-- sw/simulator/diffusion.ml | 2 +- sw/simulator/flightModel.ml | 4 ++-- sw/simulator/flightModel.mli | 2 +- sw/simulator/gps.ml | 2 +- sw/simulator/sim.ml | 14 +++++++------- sw/simulator/sim.mli | 4 ++-- sw/simulator/{stdlib.ml => simlib.ml} | 0 sw/simulator/{stdlib.mli => simlib.mli} | 0 sw/simulator/sitl.ml | 14 +++++++------- 10 files changed, 23 insertions(+), 23 deletions(-) rename sw/simulator/{stdlib.ml => simlib.ml} (100%) rename sw/simulator/{stdlib.mli => simlib.mli} (100%) diff --git a/sw/simulator/Makefile b/sw/simulator/Makefile index 1f9a77b6d55..293dfd187a5 100644 --- a/sw/simulator/Makefile +++ b/sw/simulator/Makefile @@ -31,7 +31,7 @@ INCLUDES = PKG = -package glibivy,pprz LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz,pprzlink -SIMML = stdlib.ml data.ml flightModel.ml gps.ml +SIMML = simlib.ml data.ml flightModel.ml gps.ml SIMHML = $(SIMML) hitl.ml sim.ml SIMHCMO=$(SIMHML:%.ml=%.cmo) SIMSML = $(SIMML) sitl.ml sim.ml @@ -59,7 +59,7 @@ gaia : gaia.cmo $(LIBPPRZCMA) $(LIBPPRZLINKCMA) @echo OL $@ $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gtkInit.cmo $< -diffusion : stdlib.cmo diffusion.cmo +diffusion : simlib.cmo diffusion.cmo @echo OL $@ $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gtkInit.cmo $^ diff --git a/sw/simulator/diffusion.ml b/sw/simulator/diffusion.ml index 5326f61a8fc..da2b033b6a6 100644 --- a/sw/simulator/diffusion.ml +++ b/sw/simulator/diffusion.ml @@ -130,7 +130,7 @@ let _ = let time_scale = object val mutable v = 1. method value = v method set_value x = v <- x end in - Stdlib.timer ~scale:time_scale dt periodic; + Simlib.timer ~scale:time_scale dt periodic; safe_bind "FLIGHT_PARAM" flight_param_msg; safe_bind "WORLD_ENV" (gaia time_scale); diff --git a/sw/simulator/flightModel.ml b/sw/simulator/flightModel.ml index f658e16ce3c..2482a3fbe00 100644 --- a/sw/simulator/flightModel.ml +++ b/sw/simulator/flightModel.ml @@ -22,7 +22,7 @@ * *) -open Stdlib +open Simlib open Printf let ios = fun x -> @@ -54,7 +54,7 @@ type state = { module type SIG = sig val init : radian -> state - val do_commands : state -> Stdlib.pprz_t array -> unit + val do_commands : state -> Simlib.pprz_t array -> unit val nb_commands : int val nominal_airspeed : float (* m/s *) val max_bat_level : float (* V *) diff --git a/sw/simulator/flightModel.mli b/sw/simulator/flightModel.mli index 72a8f01472a..289924243f6 100644 --- a/sw/simulator/flightModel.mli +++ b/sw/simulator/flightModel.mli @@ -39,7 +39,7 @@ val get_air_speed : state -> meter_s module type SIG = sig val init : radian -> state - val do_commands : state -> Stdlib.pprz_t array -> unit + val do_commands : state -> Simlib.pprz_t array -> unit val nb_commands : int val nominal_airspeed : float (* m/s *) val max_bat_level : float (* V *) diff --git a/sw/simulator/gps.ml b/sw/simulator/gps.ml index 6587971c85e..d2ecfd11e8d 100644 --- a/sw/simulator/gps.ml +++ b/sw/simulator/gps.ml @@ -22,7 +22,7 @@ * *) -open Stdlib +open Simlib open Latlong type state = { diff --git a/sw/simulator/sim.ml b/sw/simulator/sim.ml index 87c33f71c2f..7ef8bcf7b9f 100644 --- a/sw/simulator/sim.ml +++ b/sw/simulator/sim.ml @@ -24,7 +24,7 @@ open Printf -open Stdlib +open Simlib open Latlong module Ground_Pprz = PprzLink.Messages(struct let name = "ground" end) @@ -55,7 +55,7 @@ module type AIRCRAFT = sig val init : int -> GPack.box -> unit (** [init ac_id box] *) - val boot : Stdlib.value -> unit + val boot : Simlib.value -> unit (** [boot time_acceleration] *) val commands : pprz_t array -> unit @@ -264,10 +264,10 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct let boot = fun () -> Aircraft.boot (time_scale:>value); - Stdlib.timer ~scale:time_scale fm_period fm_task; - Stdlib.timer ~scale:time_scale ir_period ir_task; - Stdlib.timer ~scale:time_scale gps_period gps_task; - Stdlib.timer ~scale:time_scale ahrs_period ahrs_task; + Simlib.timer ~scale:time_scale fm_period fm_task; + Simlib.timer ~scale:time_scale ir_period ir_task; + Simlib.timer ~scale:time_scale gps_period gps_task; + Simlib.timer ~scale:time_scale ahrs_period ahrs_task; (** Connection to Flight Gear client *) if !fg_client <> "" then @@ -277,7 +277,7 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct (* Unix.connect socket (Unix.ADDR_INET (inet_addr, 5501)); *) let buffer = Bytes.create (fg_sizeof ()) in let sockaddr = (Unix.ADDR_INET (inet_addr, 5501)) in - Stdlib.timer ~scale:time_scale fg_period (fg_task socket buffer sockaddr); + Simlib.timer ~scale:time_scale fg_period (fg_task socket buffer sockaddr); fprintf stdout "Sending to FlightGear at %s\n" !fg_client; flush stdout with e -> fprintf stderr "Error setting up FlightGear viz: %s\n" (Printexc.to_string e); flush stderr diff --git a/sw/simulator/sim.mli b/sw/simulator/sim.mli index 16fef82c51e..3e65b7c3d95 100644 --- a/sw/simulator/sim.mli +++ b/sw/simulator/sim.mli @@ -7,8 +7,8 @@ val ac_name : string ref module type AIRCRAFT = sig val init : int -> GPack.box -> unit - val boot : Stdlib.value -> unit - val commands : Stdlib.pprz_t array -> unit + val boot : Simlib.value -> unit + val commands : Simlib.pprz_t array -> unit val infrared_and_airspeed : float -> float -> float -> float -> unit val attitude_and_rates : float -> float -> float -> float -> float -> float -> unit val gps : Gps.state -> unit diff --git a/sw/simulator/stdlib.ml b/sw/simulator/simlib.ml similarity index 100% rename from sw/simulator/stdlib.ml rename to sw/simulator/simlib.ml diff --git a/sw/simulator/stdlib.mli b/sw/simulator/simlib.mli similarity index 100% rename from sw/simulator/stdlib.mli rename to sw/simulator/simlib.mli diff --git a/sw/simulator/sitl.ml b/sw/simulator/sitl.ml index f9cb8a9e6ab..02dd73f21a9 100644 --- a/sw/simulator/sitl.ml +++ b/sw/simulator/sitl.ml @@ -55,7 +55,7 @@ module Make (A:Data.MISSION) (FM: FlightModel.SIG) = struct let rcommands = ref [||] let adj_bat = GData.adjustment ~value:FM.max_bat_level ~lower:0. ~upper:(FM.max_bat_level+.2.) ~step_incr:0.1 ~page_size:0. () - external get_commands : Stdlib.pprz_t array -> int = "get_commands" + external get_commands : Simlib.pprz_t array -> int = "get_commands" (** Returns gaz servo value (us) *) let energy = ref 0. @@ -119,7 +119,7 @@ module Make (A:Data.MISSION) (FM: FlightModel.SIG) = struct let send_ppm = fun () -> if on_off#active then send_ppm () in - Stdlib.timer rc_period send_ppm; (** FIXME: should use time_scale *) + Simlib.timer rc_period send_ppm; (** FIXME: should use time_scale *) window#show () external sys_time_task : unit -> unit = "sim_sys_time_task" @@ -189,11 +189,11 @@ module Make (A:Data.MISSION) (FM: FlightModel.SIG) = struct ignore (Dl_Pprz.message_bind name (get_message name link_mode)) let boot = fun time_scale -> - Stdlib.timer ~scale:time_scale servos_period (update_servos bat_button); - Stdlib.timer ~scale:time_scale periodic_period periodic_task; - Stdlib.timer ~scale:time_scale nav_period nav_task; - Stdlib.timer ~scale:time_scale monitor_period monitor_task; - Stdlib.timer ~scale:time_scale sys_time_period sys_time_task; + Simlib.timer ~scale:time_scale servos_period (update_servos bat_button); + Simlib.timer ~scale:time_scale periodic_period periodic_task; + Simlib.timer ~scale:time_scale nav_period nav_task; + Simlib.timer ~scale:time_scale monitor_period monitor_task; + Simlib.timer ~scale:time_scale sys_time_period sys_time_task; (* Forward or broacast messages according to "link" mode *) Hashtbl.iter