Skip to content

Commit

Permalink
[sim] change name of stdlib module
Browse files Browse the repository at this point in the history
to avoid collision with the new stdlib in ocaml >= 4.08
  • Loading branch information
gautierhattenberger committed Mar 30, 2020
1 parent 4d920c1 commit 30f63ac
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions sw/simulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 $^

Expand Down
2 changes: 1 addition & 1 deletion sw/simulator/diffusion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions sw/simulator/flightModel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
*)

open Stdlib
open Simlib
open Printf

let ios = fun x ->
Expand Down Expand Up @@ -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 *)
Expand Down
2 changes: 1 addition & 1 deletion sw/simulator/flightModel.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
Expand Down
2 changes: 1 addition & 1 deletion sw/simulator/gps.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
*)

open Stdlib
open Simlib
open Latlong

type state = {
Expand Down
14 changes: 7 additions & 7 deletions sw/simulator/sim.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


open Printf
open Stdlib
open Simlib
open Latlong

module Ground_Pprz = PprzLink.Messages(struct let name = "ground" end)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sw/simulator/sim.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions sw/simulator/sitl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 30f63ac

Please sign in to comment.