diff --git a/conf/airframes/examples/easystar_ets.xml b/conf/airframes/examples/easystar_ets.xml index d8e294b7522..3b04478b012 100644 --- a/conf/airframes/examples/easystar_ets.xml +++ b/conf/airframes/examples/easystar_ets.xml @@ -20,6 +20,7 @@ + @@ -36,6 +37,9 @@ + + + diff --git a/conf/gui.xml b/conf/gui.xml deleted file mode 100644 index 93f99e18fcc..00000000000 --- a/conf/gui.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - -
- - - -
-
- - - - - - - -
- -
diff --git a/conf/modules/baro_board.xml b/conf/modules/baro_board.xml index b87687e982d..fce197a48e6 100644 --- a/conf/modules/baro_board.xml +++ b/conf/modules/baro_board.xml @@ -7,7 +7,7 @@
- + diff --git a/sw/airborne/arch/sim/sim_gps.c b/sw/airborne/arch/sim/sim_gps.c index 70a5a8c18e9..4c8d0cfa939 100644 --- a/sw/airborne/arch/sim/sim_gps.c +++ b/sw/airborne/arch/sim/sim_gps.c @@ -36,6 +36,7 @@ value sim_use_gps_pos(value x, value y, value z, value c, value a, value s, valu struct UtmCoor_f utm_f; lla_f.lat = Double_val(lat); lla_f.lon = Double_val(lon); + lla_f.alt = Double_val(a); utm_f.zone = nav_utm_zone0; utm_of_lla_f(&utm_f, &lla_f); LLA_BFP_OF_REAL(gps.lla_pos, lla_f); diff --git a/sw/airborne/boards/lisa_m_2.0.h b/sw/airborne/boards/lisa_m_2.0.h index 2b4ccfb2fcf..6a4aba0deb4 100644 --- a/sw/airborne/boards/lisa_m_2.0.h +++ b/sw/airborne/boards/lisa_m_2.0.h @@ -155,4 +155,7 @@ #define PWM5_Pin GPIO0 #define PWM6_Pin GPIO1 +// Remap the servos 5 and 6 to TIM5 CH1 and CH2 +#define REMAP_SERVOS_5AND6 1 + #endif /* CONFIG_LISA_M_2_0_H */ diff --git a/sw/airborne/modules/sensors/airspeed_ets.c b/sw/airborne/modules/sensors/airspeed_ets.c index 5d06b47d330..1c03676d34d 100644 --- a/sw/airborne/modules/sensors/airspeed_ets.c +++ b/sw/airborne/modules/sensors/airspeed_ets.c @@ -1,17 +1,4 @@ /* - * Driver for the EagleTree Systems Airspeed Sensor - * Has only been tested with V3 of the sensor hardware - * - * Notes: - * Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together. - * Sensor should be in the proprietary mode (default) and not in 3rd party mode. - * - * Sensor module wire assignments: - * Red wire: 5V - * White wire: Ground - * Yellow wire: SDA - * Brown wire: SCL - * * Copyright (C) 2009 Vassilis Varveropoulos * Modified by Mark Griffin on 8 September 2010 to work with new i2c transaction routines. * Converted by Gautier Hattenberger to modules (10/2010) @@ -32,8 +19,25 @@ * along with paparazzi; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. + */ + +/** + * @file airspeed_ets.c + * + * Driver for the EagleTree Systems Airspeed Sensor. + * Has only been tested with V3 of the sensor hardware. + * + * Notes: + * Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together. + * Sensor should be in the proprietary mode (default) and not in 3rd party mode. * + * Sensor module wire assignments: + * Red wire: 5V + * White wire: Ground + * Yellow wire: SDA + * Brown wire: SCL */ + #include "sensors/airspeed_ets.h" #include "state.h" #include "mcu_periph/i2c.h" diff --git a/sw/airborne/modules/sensors/airspeed_ets.h b/sw/airborne/modules/sensors/airspeed_ets.h index 1b27ddd1814..7d898511424 100644 --- a/sw/airborne/modules/sensors/airspeed_ets.h +++ b/sw/airborne/modules/sensors/airspeed_ets.h @@ -1,17 +1,4 @@ /* - * Driver for the EagleTree Systems Airspeed Sensor - * Has only been tested with V3 of the sensor hardware - * - * Notes: - * Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together. - * Sensor should be in the proprietary mode (default) and not in 3rd party mode. - * - * Sensor module wire assignments: - * Red wire: 5V - * White wire: Ground - * Yellow wire: SDA - * Brown wire: SCL - * * Copyright (C) 2009 Vassilis Varveropoulos * Modified by Mark Griffin on 8 September 2010 to work with new i2c transaction routines. * Converted by Gautier Hattenberger to modules (10/2010) @@ -32,7 +19,23 @@ * along with paparazzi; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. + */ + +/** + * @file airspeed_ets.h + * + * Driver for the EagleTree Systems Airspeed Sensor. + * Has only been tested with V3 of the sensor hardware. + * + * Notes: + * Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together. + * Sensor should be in the proprietary mode (default) and not in 3rd party mode. * + * Sensor module wire assignments: + * Red wire: 5V + * White wire: Ground + * Yellow wire: SDA + * Brown wire: SCL */ #ifndef AIRSPEED_ETS_H diff --git a/sw/airborne/modules/sensors/baro_board_module.h b/sw/airborne/modules/sensors/baro_board_module.h index f8d88e5595a..9a81a9fafe0 100644 --- a/sw/airborne/modules/sensors/baro_board_module.h +++ b/sw/airborne/modules/sensors/baro_board_module.h @@ -17,11 +17,12 @@ * along with paparazzi; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. - * */ -/* - * Wrapper for the board specific barometer +/** + * @file baro_board_module.h + * + * Wrapper for the board specific barometer. */ #ifndef BARO_BOARD_MODULE_H diff --git a/sw/airborne/modules/sensors/baro_ets.c b/sw/airborne/modules/sensors/baro_ets.c index f1bf697227a..aadc702abe9 100644 --- a/sw/airborne/modules/sensors/baro_ets.c +++ b/sw/airborne/modules/sensors/baro_ets.c @@ -1,19 +1,4 @@ /* - * Driver for the EagleTree Systems Altitude Sensor - * Has only been tested with V3 of the sensor hardware - * - * Notes: - * Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together. - * Sensor should be in the proprietary mode (default) and not in 3rd party mode. - * Pitch gains may need to be updated. - * - * - * Sensor module wire assignments: - * Red wire: 5V - * White wire: Ground - * Yellow wire: SDA - * Brown wire: SCL - * * Copyright (C) 2009 Vassilis Varveropoulos * Copyright (C) 2010 The Paparazzi Team * @@ -35,6 +20,25 @@ * Boston, MA 02111-1307, USA. */ +/** + * @file baro_ets.c + * + * Driver for the EagleTree Systems Altitude Sensor. + * Has only been tested with V3 of the sensor hardware. + * + * Notes: + * Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together. + * Sensor should be in the proprietary mode (default) and not in 3rd party mode. + * Pitch gains may need to be updated. + * + * + * Sensor module wire assignments: + * Red wire: 5V + * White wire: Ground + * Yellow wire: SDA + * Brown wire: SCL + */ + #include "sensors/baro_ets.h" #include "mcu_periph/i2c.h" #include "state.h" @@ -46,6 +50,16 @@ #include "subsystems/gps.h" #endif +#ifdef BARO_ETS_TELEMETRY +#ifndef DOWNLINK_DEVICE +#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE +#endif + +#include "mcu_periph/uart.h" +#include "messages.h" +#include "subsystems/datalink/downlink.h" +#endif //BARO_ETS_TELEMETRY + #define BARO_ETS_ADDR 0xE8 #define BARO_ETS_REG 0x07 #define BARO_ETS_SCALE 0.32 @@ -97,23 +111,19 @@ void baro_ets_read_periodic( void ) { if (baro_ets_i2c_trans.status == I2CTransDone) I2CReceive(BARO_ETS_I2C_DEV, baro_ets_i2c_trans, BARO_ETS_ADDR, 2); #else // SITL + /* fake an offset so sim works for under hmsl as well */ + if (!baro_ets_offset_init) { + baro_ets_offset = 200; + baro_ets_offset_init = TRUE; + } baro_ets_altitude = gps.hmsl / 1000.0; - baro_ets_adc = baro_ets_altitude / BARO_ETS_SCALE; + baro_ets_adc = baro_ets_offset - baro_ets_altitude / BARO_ETS_SCALE; baro_ets_valid = TRUE; -#endif -} - #ifdef BARO_ETS_TELEMETRY - -#ifndef DOWNLINK_DEVICE -#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE + DOWNLINK_SEND_BARO_ETS(DefaultChannel, DefaultDevice, &baro_ets_adc, &baro_ets_offset, &baro_ets_altitude); #endif - -#include "mcu_periph/uart.h" -#include "messages.h" -#include "subsystems/datalink/downlink.h" - #endif +} void baro_ets_read_event( void ) { // Get raw altimeter from buffer diff --git a/sw/airborne/modules/sensors/baro_ets.h b/sw/airborne/modules/sensors/baro_ets.h index 86e45a83efa..ed6b7d0fe31 100644 --- a/sw/airborne/modules/sensors/baro_ets.h +++ b/sw/airborne/modules/sensors/baro_ets.h @@ -1,19 +1,4 @@ /* - * Driver for the EagleTree Systems Altitude Sensor - * Has only been tested with V3 of the sensor hardware - * - * Notes: - * Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together. - * Sensor should be in the proprietary mode (default) and not in 3rd party mode. - * Pitch gains may need to be updated. - * - * - * Sensor module wire assignments: - * Red wire: 5V - * White wire: Ground - * Yellow wire: SDA - * Brown wire: SCL - * * Copyright (C) 2009 Vassilis Varveropoulos * Copyright (C) 2010 The Paparazzi Team * @@ -35,6 +20,25 @@ * Boston, MA 02111-1307, USA. */ +/** + * @file baro_ets.h + * + * Driver for the EagleTree Systems Altitude Sensor. + * Has only been tested with V3 of the sensor hardware. + * + * Notes: + * Connect directly to TWOG/Tiny I2C port. Multiple sensors can be chained together. + * Sensor should be in the proprietary mode (default) and not in 3rd party mode. + * Pitch gains may need to be updated. + * + * + * Sensor module wire assignments: + * Red wire: 5V + * White wire: Ground + * Yellow wire: SDA + * Brown wire: SCL + */ + #ifndef BARO_ETS_H #define BARO_ETS_H diff --git a/sw/airborne/subsystems/ins/ins_float.c b/sw/airborne/subsystems/ins/ins_float.c index bc9298fe38c..263f7edb65d 100644 --- a/sw/airborne/subsystems/ins/ins_float.c +++ b/sw/airborne/subsystems/ins/ins_float.c @@ -113,7 +113,7 @@ void ins_update_gps(void) { utm.north = gps.utm_pos.north / 100.; utm.zone = nav_utm_zone0; -#if !USE_BARO_BMP && !USE_BARO_ETS && !USE_BARO_MS5534A +#if !USE_BAROMETER float falt = gps.hmsl / 1000.; EstimatorSetAlt(falt); #endif diff --git a/sw/airborne/subsystems/ins/ins_float.h b/sw/airborne/subsystems/ins/ins_float.h index d2cab0b4076..4304b3cb4a2 100644 --- a/sw/airborne/subsystems/ins/ins_float.h +++ b/sw/airborne/subsystems/ins/ins_float.h @@ -30,6 +30,8 @@ #include "std.h" #include "state.h" + +#if USE_BAROMETER #ifdef BARO_MS5534A #include "baro_MS5534A.h" #endif @@ -42,6 +44,10 @@ #include "modules/sensors/baro_bmp.h" #endif +extern int32_t ins_qfe; +extern float ins_baro_alt; +extern bool_t ins_baro_initialised; +#endif //USE_BAROMETER /* position in meters, ENU frame, relative to reference */ extern float estimator_z; ///< altitude above MSL in meters @@ -58,10 +64,10 @@ extern void alt_kalman( float ); #ifdef ALT_KALMAN -#if USE_BARO_MS5534A || USE_BARO_ETS || USE_BARO_BMP +#if USE_BAROMETER /* Kalman filter cannot be disabled in this mode (no z_dot) */ #define EstimatorSetAlt(z) alt_kalman(z) -#else /* USE_BARO_x */ +#else /* USE_BAROMETER */ #define EstimatorSetAlt(z) { \ if (!alt_kalman_enabled) { \ estimator_z = z; \ @@ -69,7 +75,7 @@ extern void alt_kalman( float ); alt_kalman(z); \ } \ } -#endif /* ! USE_BARO_x */ +#endif /* ! USE_BAROMETER */ #else /* ALT_KALMAN */ #define EstimatorSetAlt(z) { estimator_z = z; } diff --git a/sw/airborne/subsystems/sensors/baro.h b/sw/airborne/subsystems/sensors/baro.h index 8c5669060f1..54859203af2 100644 --- a/sw/airborne/subsystems/sensors/baro.h +++ b/sw/airborne/subsystems/sensors/baro.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2010 The Paparazzi Team * * This file is part of paparazzi. @@ -21,9 +19,10 @@ * Boston, MA 02111-1307, USA. */ -/* +/** + * @file baro.h * - * Brief: common barometric sensor implementation + * Common barometric sensor implementation. * */ diff --git a/sw/ground_segment/cockpit/Makefile b/sw/ground_segment/cockpit/Makefile index 23e70557a08..d227ebaf5d1 100644 --- a/sw/ground_segment/cockpit/Makefile +++ b/sw/ground_segment/cockpit/Makefile @@ -36,9 +36,9 @@ FPIC=-fPIC OCAMLC=ocamlc OCAMLOPT=ocamlopt OCAMLOPTFLAGS=-thread -OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) -OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring) -INCLUDES= $(shell ocamlfind query -r -i-format lablgtk2) -I ../../lib/ocaml $(shell ocamlfind query -r -i-format xml-light) $(OCAMLNETINCLUDES) +OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient) +OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring) $(shell ocamlfind query -r -a-format -predicates byte netclient) +INCLUDES= $(shell ocamlfind query -r -i-format lablgtk2) -I ../../lib/ocaml $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format pcre) $(OCAMLNETINCLUDES) LIBS=$(OCAMLNETCMA) glibivy-ocaml.cma lablgtk.cma lablglade.cma lib-pprz.cma lablgnomecanvas.cma xlib-pprz.cma CMXA=$(LIBS:.cma=.cmxa) @@ -53,7 +53,7 @@ opt : $(MAIN).opt $(MAIN) : $(CMO) ../../lib/ocaml/xlib-pprz.cma ../../lib/ocaml/lib-pprz.cma @echo OL $@ - $(Q)$(OCAMLC) $(OCAMLCFLAGS) -custom $(INCLUDES) unix.cma str.cma xml-light.cma $(LIBS) threads.cma gtkThread.cmo myGtkInit.cmo $(CMO) -o $@ + $(Q)$(OCAMLC) $(OCAMLCFLAGS) -custom $(INCLUDES) $(OCAMLNETINCLUDES) unix.cma str.cma netstring.cma netclient.cma xml-light.cma $(LIBS) threads.cma gtkThread.cmo myGtkInit.cmo $(CMO) -o $@ $(MAIN).opt : $(CMX) @echo OOL $@ diff --git a/sw/ground_segment/tmtc/Makefile b/sw/ground_segment/tmtc/Makefile index 51bce9d2904..34daf7516f7 100644 --- a/sw/ground_segment/tmtc/Makefile +++ b/sw/ground_segment/tmtc/Makefile @@ -43,7 +43,7 @@ clean: OCAMLC = ocamlc OCAMLOPT = ocamlopt OCAMLLIB = ../../lib/ocaml -OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) +OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient) 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 @@ -172,4 +172,3 @@ ivy_serial_bridge: ivy_serial_bridge.c ifneq ($(MAKECMDGOALS),clean) -include .depend endif - diff --git a/sw/lib/ocaml/Makefile b/sw/lib/ocaml/Makefile index 8dfc1478680..409be288dde 100644 --- a/sw/lib/ocaml/Makefile +++ b/sw/lib/ocaml/Makefile @@ -30,7 +30,7 @@ else FPIC = endif -INCLUDES= $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format pcre) +INCLUDES= $(shell ocamlfind query -r -i-format xml-light) $(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient) $(shell ocamlfind query -r -i-format pcre) XINCLUDES= $(shell ocamlfind query -r -i-format lablgtk2) $(shell ocamlfind query -r -i-format xml-light) OCAMLC=ocamlc OCAMLOPT=ocamlopt diff --git a/sw/lib/ocaml/gm.ml b/sw/lib/ocaml/gm.ml index 82a564f6946..7e2ce48b674 100644 --- a/sw/lib/ocaml/gm.ml +++ b/sw/lib/ocaml/gm.ml @@ -244,20 +244,26 @@ let get_image = fun key -> if !policy = NoCache then raise Not_found; get_from_cache cache_dir key with - Not_found -> - if !policy = NoHttp then raise Not_available; - let rec loop = fun k -> - if String.length k >= 1 then - let url = url_of_tile_key !maps_source k in - let jpg_file = cache_dir // (k ^ ".jpg") in - try - ignore (Http.file_of_url ~dest:jpg_file url); - tile_of_key k, jpg_file - with - Http.Failure _ -> loop (remove_last_char k) - else - raise Not_available in - loop key + Not_found -> + if !policy = NoHttp then raise Not_available; + let rec loop = fun k -> + if String.length k >= 1 then + let url = url_of_tile_key !maps_source k in + let jpg_file = cache_dir // (k ^ ".jpg") in + try + ignore (Http.file_of_url ~dest:jpg_file url); + tile_of_key k, jpg_file + with + Http.Not_Found _ -> loop (remove_last_char k) + | Http.Blocked _ -> + begin + prerr_endline (Printf.sprintf "Seem to be temporarily blocked, '%s'" url); + raise Not_available + end + | _ -> raise Not_available + else + raise Not_available in + loop key let rec get_tile = fun wgs84 zoom -> diff --git a/sw/lib/ocaml/http.ml b/sw/lib/ocaml/http.ml index 3ca1b6db64e..63b3488da3d 100644 --- a/sw/lib/ocaml/http.ml +++ b/sw/lib/ocaml/http.ml @@ -1,5 +1,8 @@ - exception Failure of string +exception Not_Found of string +exception Blocked of string + +open Http_client let file_of_url = fun ?dest url -> if String.sub url 0 7 = "file://" then @@ -9,10 +12,28 @@ let file_of_url = fun ?dest url -> match dest with Some s -> s | None -> Filename.temp_file "fp" ".wget" in - let c = Printf.sprintf "wget -nv --cache=off -O %s '%s'" tmp_file url in - if Sys.command c = 0 then - tmp_file - else begin - Sys.remove tmp_file; - raise (Failure url) - end + let call = new Http_client.get url in + call#set_response_body_storage (`File (fun () -> tmp_file)); + let pipeline = new Http_client.pipeline in + pipeline#add call; + pipeline#run (); + match call#status with + | `Successful -> + (* prerr_endline (Printf.sprintf "file sucessfull: %s, '%s'" tmp_file url); *) + tmp_file + | `Client_error -> + begin + (* prerr_endline (Printf.sprintf "getting file '%s', client error: %d" url call#response_status_code); *) + Sys.remove tmp_file; + match call#response_status_code with + 404 -> raise (Not_Found url) + | 403 -> + begin + (* prerr_endline (Printf.sprintf "Blocked!!!"); *) + raise (Blocked url) + end + | _ -> raise (Failure url) + end + | _ -> + Sys.remove tmp_file; + raise (Failure url) diff --git a/sw/lib/ocaml/http.mli b/sw/lib/ocaml/http.mli index 96278ef376e..66a147bed5d 100644 --- a/sw/lib/ocaml/http.mli +++ b/sw/lib/ocaml/http.mli @@ -1,4 +1,6 @@ exception Failure of string +exception Not_Found of string +exception Blocked of string val file_of_url : ?dest:string -> string -> string (** [file_of_url ?dest url] Downloads a given document and returns the place where it is stored. Default [dest] is in [/tmp]. *) diff --git a/sw/tools/Makefile b/sw/tools/Makefile index 7c2161b65d5..98bcf64b5d4 100644 --- a/sw/tools/Makefile +++ b/sw/tools/Makefile @@ -25,8 +25,8 @@ Q=@ OCAML=ocaml OCAMLC=ocamlc INCLUDES=-I ../lib/ocaml $(shell ocamlfind query -r -i-format xml-light) -I . -OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) -OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring) +OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient) +OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring) $(shell ocamlfind query -r -a-format -predicates byte netclient) OCAMLLEX=ocamllex OCAMLYACC=ocamlyacc @@ -44,6 +44,10 @@ gen_flight_plan.cmo : fp_proc.cmi gen_common.cmo : gen_common.cmi +gen_srtm.out : ../lib/ocaml/lib-pprz.cma + @echo OC $@ + $(Q)$(OCAMLC) $(INCLUDES) $(OCAMLNETINCLUDES) -custom -o $@ unix.cma str.cma netstring.cma netclient.cma xml-light.cma ivy-ocaml.cma lib-pprz.cma gen_common.cmo $^ + mergelogs: mergelogs.c gcc mergelogs.c -o mergelogs diff --git a/sw/tools/wiki_gen/Makefile b/sw/tools/wiki_gen/Makefile index 3bc985ba004..766bb4b5615 100644 --- a/sw/tools/wiki_gen/Makefile +++ b/sw/tools/wiki_gen/Makefile @@ -14,7 +14,7 @@ Q=@ OCAML=ocaml OCAMLC=ocamlc INCLUDES=-I ../../lib/ocaml $(shell ocamlfind query -r -i-format xml-light) -OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) +OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient) OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring)