218 changes: 0 additions & 218 deletions sw/airborne/subsystems/sensors/infrared_i2c.c

This file was deleted.

60 changes: 0 additions & 60 deletions sw/airborne/subsystems/sensors/infrared_i2c.h

This file was deleted.

80 changes: 0 additions & 80 deletions sw/airborne/test/test_esc_asctecv1_simple.c

This file was deleted.

75 changes: 0 additions & 75 deletions sw/airborne/test/test_esc_mkk_simple.c

This file was deleted.

24 changes: 7 additions & 17 deletions sw/simulator/sim.ml
Expand Up @@ -39,7 +39,7 @@ let georef_of_xml = fun xml ->


(* Frequencies for perdiodic tasks are expressed in s *)
let ir_period = 1./.20.
let airspeed_period = 1./.20.
let fm_period = 1./.25.
let fg_period = 1./.25.
let ahrs_period = 1./.20.
Expand All @@ -61,8 +61,8 @@ sig
val commands : pprz_t array -> unit
(** Called once at init *)

val infrared_and_airspeed : float -> float -> float -> float -> unit
(** [infrared ir_left ir_front ir_top air_speed] Called on timer *)
val airspeed : float -> unit
(** [air_speed] Called on timer *)

val attitude_and_rates : float -> float -> float -> float -> float -> float ->unit
(** [ahrs phi theta psi p q r] Called on timer *)
Expand Down Expand Up @@ -155,16 +155,14 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct
let wind_x = ref 0.
and wind_y = ref 0.
and wind_z = ref 0. in
let infrared_contrast = ref 266.
and time_scale = object val mutable v = 1. method value = v method set_value x = v <- x end
let time_scale = object val mutable v = 1. method value = v method set_value x = v <- x end
and gps_availability = ref 1 in

let world_update = fun _ vs ->
gps_availability := PprzLink.int_assoc "gps_availability" vs;
wind_x := PprzLink.float_assoc "wind_east" vs;
wind_y := PprzLink.float_assoc "wind_north" vs;
wind_z := PprzLink.float_assoc "wind_up" vs;
infrared_contrast := PprzLink.float_assoc "ir_contrast" vs;
time_scale#set_value (PprzLink.float_assoc "time_scale" vs)
in

Expand Down Expand Up @@ -203,16 +201,8 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct
| None -> 0. in
FM.state_update !state FM.nominal_airspeed (!wind_x, !wind_y, !wind_z) agl fm_period

and ir_task = fun () ->
let phi, theta, _ = FlightModel.get_attitude !state in

let phi_sensor = phi +. FM.roll_neutral_default
and theta_sensor = theta +. FM.pitch_neutral_default in

let ir_left = sin phi_sensor *. !infrared_contrast
and ir_front = sin theta_sensor *. !infrared_contrast
and ir_top = cos phi_sensor *. cos theta_sensor *. !infrared_contrast in
Aircraft.infrared_and_airspeed ir_left ir_front ir_top (FlightModel.get_air_speed !state)
and airspeed_task = fun () ->
Aircraft.airspeed (FlightModel.get_air_speed !state)

and gps_task = fun () ->
let (x,y,z) = FlightModel.get_xyz !state in
Expand Down Expand Up @@ -265,7 +255,7 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct
let boot = fun () ->
Aircraft.boot (time_scale:>value);
Simlib.timer ~scale:time_scale fm_period fm_task;
Simlib.timer ~scale:time_scale ir_period ir_task;
Simlib.timer ~scale:time_scale airspeed_period airspeed_task;
Simlib.timer ~scale:time_scale gps_period gps_task;
Simlib.timer ~scale:time_scale ahrs_period ahrs_task;

Expand Down
2 changes: 1 addition & 1 deletion sw/simulator/sim.mli
Expand Up @@ -9,7 +9,7 @@ module type AIRCRAFT =
val init : int -> GPack.box -> unit
val boot : Simlib.value -> unit
val commands : Simlib.pprz_t array -> unit
val infrared_and_airspeed : float -> float -> float -> float -> unit
val airspeed : float -> unit
val attitude_and_rates : float -> float -> float -> float -> float -> float -> unit
val gps : Gps.state -> unit
end
Expand Down
7 changes: 3 additions & 4 deletions sw/simulator/sitl.ml
Expand Up @@ -206,10 +206,9 @@ module Make (A:Data.MISSION) (FM: FlightModel.SIG) = struct
(* Functions called by the simulator *)
let commands = fun s -> rcommands := s

external set_ir_and_airspeed : int -> int -> int -> float -> unit = "set_ir_and_airspeed"
let infrared_and_airspeed = fun ir_left ir_front ir_top air_speed ->
(** ADC neutral is not taken into account in the soft sim (c.f. sim_ir.c)*)
set_ir_and_airspeed (truncate ir_left) (truncate ir_front) (truncate ir_top) air_speed
external set_airspeed : float -> unit = "set_airspeed"
let airspeed = fun air_speed ->
set_airspeed air_speed

external provide_attitude : float -> float -> float -> unit = "provide_attitude"
external provide_rates : float -> float -> float -> unit = "provide_rates"
Expand Down