Skip to content

Commit

Permalink
Merge remote branch 'paparazzi/master' into target
Browse files Browse the repository at this point in the history
  • Loading branch information
gautierhattenberger committed Jan 31, 2011
2 parents d7ee8c7 + 9208b0d commit 95d17d0
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 33 deletions.
Binary file added data/pictures/gcs_icons/bungee_launch.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pictures/gcs_icons/cam_lock.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pictures/gcs_icons/cam_unlock.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pictures/gcs_icons/decide_landing_dir.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pictures/gcs_icons/observe.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pictures/gcs_icons/parachute.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/pictures/gcs_icons/target.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion sw/airborne/arch/sim/mcu_periph/i2c_arch.c
Expand Up @@ -2,5 +2,5 @@

void i2c_hw_init ( void ) {}

bool_t i2c_idle(struct i2c_periph *p) { return TRUE; }
bool_t i2c_idle(struct i2c_periph *p __attribute__ ((unused))) { return TRUE; }
bool_t i2c_submit(struct i2c_periph* p __attribute__ ((unused)), struct i2c_transaction* t __attribute__ ((unused))) { return TRUE;}
20 changes: 14 additions & 6 deletions sw/airborne/boards/tiny_sim.h
Expand Up @@ -2,20 +2,20 @@
#define CONFIG_TINY_H

/* Master oscillator freq. */
#define FOSC (12000000)
#define FOSC (12000000)

/* PLL multiplier */
#define PLL_MUL (5)
#define PLL_MUL (5)

/* CPU clock freq. */
#define CCLK (FOSC * PLL_MUL)
#define CCLK (FOSC * PLL_MUL)

/* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */
#define PBSD_BITS 0x00
#define PBSD_BITS 0x00
#define PBSD_VAL 4

/* Peripheral bus clock freq. */
#define PCLK (CCLK / PBSD_VAL)
#define PCLK (CCLK / PBSD_VAL)

#define LED_1_BANK 1
#define LED_1_PIN 28
Expand Down Expand Up @@ -80,7 +80,14 @@
#define USE_AD0_1
#endif

/* #define ADC_3 AdcBank1(7) Used for VSUPPLY */
#define ADC_3 AdcBank0(6)
#ifdef USE_ADC_3
#ifndef USE_AD0
#define USE_AD0
#endif
#define USE_AD0_6
#endif


#define ADC_4 AdcBank1(3)
#ifdef USE_ADC_4
Expand Down Expand Up @@ -114,6 +121,7 @@
#define USE_AD1_2
#endif

/* #define ADC_3 AdcBank1(7) Used for VSUPPLY */
#define ADC_CHANNEL_VSUPPLY AdcBank1(7)
#ifndef USE_AD1
#define USE_AD1
Expand Down
10 changes: 5 additions & 5 deletions sw/ground_segment/cockpit/live.ml
Expand Up @@ -1158,11 +1158,11 @@ let listen_flight_params = fun geomap auto_center_new_ac alert alt_graph ->
let label = Pprz.string_assoc "ap_mode" vs in
ac.strip#set_label "AP" (if label="MANUAL" then "MANU" else label);
let color =
match ap_mode with
"AUTO2" -> ok_color
| "AUTO1" -> "#10F0E0"
| "MANUAL" -> warning_color
| _ -> alert_color in
match ap_mode with
"AUTO2" | "NAV" -> ok_color
| "AUTO1" | "R_RCC" | "A_RCC" | "ATT_C" | "R_ZH" | "A_ZH" | "HOVER" | "HOV_C" | "H_ZH" -> "#10F0E0"
| "MANUAL" | "RATE" | "ATT" -> warning_color
| _ -> alert_color in
ac.strip#set_color "AP" color;
end;
let gps_mode = Pprz.string_assoc "gps_mode" vs in
Expand Down
6 changes: 1 addition & 5 deletions sw/ground_segment/tmtc/Makefile
Expand Up @@ -48,7 +48,7 @@ OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring)
INCLUDES= -I $(OCAMLLIB) -I ../multimon $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) $(OCAMLNETINCLUDES)
LIBPPRZCMA=$(OCAMLLIB)/lib-pprz.cma

SERVERCMO = server_globals.cmo aircraft.cmo wind.cmo airprox.cmo kml.cmo fw_server.ml booz_server.ml server.cmo
SERVERCMO = server_globals.cmo aircraft.cmo wind.cmo airprox.cmo kml.cmo fw_server.ml rotorcraft_server.ml server.cmo
SERVERCMX = $(SERVERCMO:.cmo=.cmx)

$(VAR)/boa.conf :$(CONF)/boa.conf
Expand Down Expand Up @@ -112,10 +112,6 @@ diadec : diadec.cmo ../multimon/multimon.cma
$(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $^


booz_translator : booz_translator.cmo ../../lib/ocaml/lib-pprz.cma
@echo OL $@
$(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma booz_translator.cmo

150m : 150m.cmo
@echo OL $@
$(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ unix.cma str.cma xml-light.cma lablgtk.cma glibivy-ocaml.cma lib-pprz.cma gtkInit.cmo $^
Expand Down
8 changes: 7 additions & 1 deletion sw/ground_segment/tmtc/aircraft.ml
Expand Up @@ -70,6 +70,11 @@ type nav_ref =
| Utm of Latlong.utm
| Ltp of Latlong.ecef

type vehicle_type =
FixedWing
| Rotorcraft
| UnknownVehicleType

let add_pos_to_nav_ref = fun nav_ref ?(z = 0.) (x, y) ->
let rec lat_of_xy = fun lat last geo (_x, _y) n e ->
if n > 0 && abs_float (lat -. last) > e then
Expand All @@ -92,6 +97,7 @@ let add_pos_to_nav_ref = fun nav_ref ?(z = 0.) (x, y) ->
type waypoint = { altitude : float; wp_geo : Latlong.geographic }

type aircraft = {
mutable vehicle_type : vehicle_type;
id : string;
name : string;
flight_plan : Xml.xml;
Expand Down Expand Up @@ -150,7 +156,7 @@ let max_nb_dl_setting_values = 256 (** indexed iwth an uint8 (messages.xml) *)

let new_aircraft = fun id name fp airframe ->
let svsinfo_init = Array.init gps_nb_channels (fun _ -> svinfo_init ()) in
{ id = id ; name = name; flight_plan = fp; airframe = airframe;
{ vehicle_type = UnknownVehicleType; id = id; name = name; flight_plan = fp; airframe = airframe;
pos = { Latlong.posn_lat = 0.; posn_long = 0. };
unix_time = 0.; itow = Int32.of_int 0;
roll = 0.; pitch = 0.;
Expand Down
6 changes: 6 additions & 0 deletions sw/ground_segment/tmtc/aircraft.mli
Expand Up @@ -54,11 +54,17 @@ type nav_ref =
| Utm of Latlong.utm
| Ltp of Latlong.ecef

type vehicle_type =
FixedWing
| Rotorcraft
| UnknownVehicleType

val add_pos_to_nav_ref : nav_ref -> ?z:float -> (float * float) -> Latlong.geographic

type waypoint = { altitude : float; wp_geo : Latlong.geographic }

type aircraft = {
mutable vehicle_type : vehicle_type;
id : string;
name : string;
flight_plan : Xml.xml;
Expand Down
3 changes: 2 additions & 1 deletion sw/ground_segment/tmtc/fw_server.ml
Expand Up @@ -187,7 +187,8 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values ->
a.bat <- fvalue "vsupply" /. 10.;
a.fbw.rc_rate <- ivalue "frame_rate"
| "PPRZ_MODE" ->
a.ap_mode <- check_index (ivalue "ap_mode") ap_modes "AP_MODE";
a.vehicle_type <- FixedWing;
a.ap_mode <- check_index (ivalue "ap_mode") fixedwing_ap_modes "AP_MODE";
a.gaz_mode <- check_index (ivalue "ap_gaz") gaz_modes "AP_GAZ";
a.lateral_mode <- check_index (ivalue "ap_lateral") lat_modes "AP_LAT";
a.horizontal_mode <- check_index (ivalue "ap_horizontal") horiz_modes "AP_HORIZ";
Expand Down
7 changes: 6 additions & 1 deletion sw/ground_segment/tmtc/kml.ml
Expand Up @@ -259,10 +259,15 @@ let update_ac = fun ac ->
else
sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name
in
let ap_mode = match ac.vehicle_type with
Rotorcraft -> rotorcraft_ap_modes.(ac.ap_mode)
| FixedWing -> fixedwing_ap_modes.(ac.ap_mode)
| UnknownVehicleType -> "UNK"
in
let blocks = ExtXml.child ac.flight_plan "blocks" in
let block = ExtXml.child blocks (string_of_int ac.cur_block) in
let block_name = ExtXml.attrib block "name" in
let description = sprintf "<b><font color=\"green\">%s</font></b>: %s\nBat: <b><font color=\"red\">%.1fV</font></b>\nAGL: %.0fm\nSpeed: %.1fm/s" ap_modes.(ac.ap_mode) block_name ac.bat ac.agl ac.gspeed in
let description = sprintf "<b><font color=\"green\">%s</font></b>: %s\nBat: <b><font color=\"red\">%.1fV</font></b>\nAGL: %.0fm\nSpeed: %.1fm/s" ap_mode block_name ac.bat ac.agl ac.gspeed in
let change = change_placemark ~description ac.name ac.pos ac.alt in
let kml_changes = link_update url_flight_plan [change] in
print_xml ac.name "ac_changes.kml" kml_changes
Expand Down
@@ -1,7 +1,5 @@
(*
* $Id: fw_server.ml,v 1.1 2009/03/22 17:53:48 hecto Exp $
*
* Server part specific to booz vehicles
* Server part specific to rotorcraft vehicles
*
* Copyright (C) ENAC
*
Expand Down Expand Up @@ -97,12 +95,13 @@ let update_waypoint = fun ac wp_id p alt ->
Not_found ->
Hashtbl.add ac.waypoints wp_id new_wp

let get_pprz_mode = fun ap_mode ->
(*let get_pprz_mode = fun ap_mode ->
let mode = ref 0 in
if ap_mode = 0 || ap_mode = 1 || ap_mode = 2 || ap_mode = 4 || ap_mode = 7 then mode := 0 (* MANUAL *)
else if ap_mode = 3 || ap_mode = 5 || ap_mode = 6 || ap_mode = 8 then mode := 1 (* AUTO1 *)
else if ap_mode = 9 || ap_mode = 10 || ap_mode = 11 || ap_mode = 12 then mode := 2; (* AUTO2 *)
!mode
*)

let get_rc_status = fun rc_status ->
let status = ref "" in
Expand Down Expand Up @@ -178,13 +177,14 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values ->
(*a.unix_time <- LL.unix_time_of_tow (truncate (fvalue "itow" /. 1000.));
a.itow <- Int32.of_float (fvalue "itow");*)
a.flight_time <- ivalue "flight_time";
if a.gspeed > 3. && a.ap_mode = _AUTO2 then
Wind.update ac_name a.gspeed a.course
(*if a.gspeed > 3. && a.ap_mode = _AUTO2 then
Wind.update ac_name a.gspeed a.course*)
| "ROTORCRAFT_STATUS" ->
a.vehicle_type <- Rotorcraft;
a.fbw.rc_status <- get_rc_status (ivalue "rc_status");
a.fbw.rc_rate <- ivalue "frame_rate";
a.gps_mode <- check_index (ivalue "gps_status") gps_modes "GPS_MODE";
a.ap_mode <- check_index (get_pprz_mode (ivalue "ap_mode")) ap_modes "BOOZ_AP_MODE";
a.ap_mode <- check_index (ivalue "ap_mode") rotorcraft_ap_modes "ROTORCRAFT_AP_MODE";
a.kill_mode <- ivalue "ap_motors_on" == 0;
a.bat <- fvalue "vsupply" /. 10.;
| "INS_REF" ->
Expand Down
@@ -1,7 +1,5 @@
(*
* $Id: fw_server.mli,v 1.1 2009/03/22 17:53:48 hecto Exp $
*
* Server part specific to booz vehicles
* Server part specific to rotorcraft vehicles
*
* Copyright (C) ENAC
*
Expand Down
10 changes: 8 additions & 2 deletions sw/ground_segment/tmtc/server.ml
Expand Up @@ -52,6 +52,12 @@ let srtm_path = Env.paparazzi_home // "data" // "srtm"
let get_indexed_value = fun t i ->
if i >= 0 then t.(i) else "UNK"

let modes_of_type = fun vt ->
match vt with
FixedWing -> fixedwing_ap_modes
| Rotorcraft -> rotorcraft_ap_modes
| UnknownVehicleType -> [| |]

(** The aircrafts store *)
let aircrafts = Hashtbl.create 3

Expand Down Expand Up @@ -135,7 +141,7 @@ let ac_msg = fun messages_xml logging ac_name ac ->
let msg = Tele_Pprz.message_of_id msg_id in
log ?timestamp logging ac_name msg.Pprz.name values;
Fw_server.log_and_parse ac_name ac msg values;
Booz_server.log_and_parse ac_name ac msg values
Rotorcraft_server.log_and_parse ac_name ac msg values
with
Telemetry_error (ac_name, msg) ->
Ground_Pprz.message_send my_id "TELEMETRY_ERROR" ["ac_id", Pprz.String ac_name;"message", Pprz.String msg];
Expand Down Expand Up @@ -355,7 +361,7 @@ let send_aircraft_msg = fun ac ->
"energy", Pprz.Int a.energy] in
Ground_Pprz.message_send my_id "ENGINE_STATUS" values;

let ap_mode = get_indexed_value ap_modes a.ap_mode in
let ap_mode = get_indexed_value (modes_of_type a.vehicle_type) a.ap_mode in
let gaz_mode = get_indexed_value gaz_modes a.gaz_mode in
let lat_mode = get_indexed_value lat_modes a.lateral_mode in
let horiz_mode = get_indexed_value horiz_modes a.horizontal_mode in
Expand Down
3 changes: 2 additions & 1 deletion sw/ground_segment/tmtc/server_globals.ml
Expand Up @@ -3,7 +3,8 @@ exception Telemetry_error of string * string
let hostname = ref "localhost"

(** FIXME: Should be read from messages.xml *)
let ap_modes = [|"MANUAL";"AUTO1";"AUTO2";"HOME";"NOGPS"|]
let fixedwing_ap_modes = [|"MANUAL";"AUTO1";"AUTO2";"HOME";"NOGPS"|]
let rotorcraft_ap_modes = [|"SAFE";"KILL";"RATE";"ATT";"R_RCC";"A_RCC";"ATT_C";"R_ZH";"A_ZH";"HOVER";"HOV_C";"H_ZH";"NAV"|]
let _AUTO2 = 2
let gaz_modes = [|"MANUAL";"GAZ";"CLIMB";"ALT"|]
let lat_modes = [|"MANUAL";"ROLL_RATE";"ROLL";"COURSE"|]
Expand Down

0 comments on commit 95d17d0

Please sign in to comment.