diff --git a/conf/airframes/examples/easystar_ets.xml b/conf/airframes/examples/easystar_ets.xml index 3b04478b01..0fc006f3f1 100644 --- a/conf/airframes/examples/easystar_ets.xml +++ b/conf/airframes/examples/easystar_ets.xml @@ -28,6 +28,7 @@ + diff --git a/conf/airframes/examples/microjet_lisa_m.xml b/conf/airframes/examples/microjet_lisa_m.xml index 06f757145d..52c29d6572 100644 --- a/conf/airframes/examples/microjet_lisa_m.xml +++ b/conf/airframes/examples/microjet_lisa_m.xml @@ -15,8 +15,7 @@ - - + @@ -30,14 +29,11 @@ + - - - - diff --git a/conf/firmwares/subsystems/fixedwing/autopilot.makefile b/conf/firmwares/subsystems/fixedwing/autopilot.makefile index 0e91400c10..cc49e50191 100644 --- a/conf/firmwares/subsystems/fixedwing/autopilot.makefile +++ b/conf/firmwares/subsystems/fixedwing/autopilot.makefile @@ -162,9 +162,6 @@ fbw_srcs += $(SRC_FIRMWARE)/fbw_downlink.c ap_CFLAGS += -DAP ap_srcs += $(SRC_FIRMWARE)/main_ap.c -ap_CFLAGS += -DINS_TYPE_H=\"subsystems/ins/ins_float.h\" -ap_srcs += $(SRC_FIXEDWING)/subsystems/ins.c -ap_srcs += $(SRC_FIXEDWING)/subsystems/ins/ins_float.c ap_srcs += $(SRC_FIRMWARE)/ap_downlink.c ap_srcs += state.c diff --git a/conf/firmwares/subsystems/fixedwing/ins_xsens.makefile b/conf/firmwares/subsystems/fixedwing/ins_xsens.makefile index 4b3a280092..c969604bb6 100644 --- a/conf/firmwares/subsystems/fixedwing/ins_xsens.makefile +++ b/conf/firmwares/subsystems/fixedwing/ins_xsens.makefile @@ -17,7 +17,7 @@ ifeq ($(TARGET), ap) ap.CFLAGS += -DUSE_INS # AHRS Results -ap.CFLAGS += -DINS_MODULE_H=\"modules/ins/ins_xsens.h\" +ap.CFLAGS += -DINS_TYPE_H=\"modules/ins/ins_xsens.h\" ifndef XSENS_UART_BAUD XSENS_UART_BAUD = B115200 diff --git a/conf/modules/ins_chimu_uart.xml b/conf/modules/ins_chimu_uart.xml index 1968dc696f..bf014baf20 100644 --- a/conf/modules/ins_chimu_uart.xml +++ b/conf/modules/ins_chimu_uart.xml @@ -15,7 +15,7 @@ For older CHIMU v1.0 you should define CHIMU_BIG_ENDIAN - + diff --git a/conf/modules/ins_vn100.xml b/conf/modules/ins_vn100.xml index 7a2be909ac..0c6fbe3df1 100644 --- a/conf/modules/ins_vn100.xml +++ b/conf/modules/ins_vn100.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/modules/ins_xsens.xml b/conf/modules/ins_xsens.xml index 087dc6d02d..fdd3438527 100644 --- a/conf/modules/ins_xsens.xml +++ b/conf/modules/ins_xsens.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/modules/ins_xsens_MTiG_Uart0.xml b/conf/modules/ins_xsens_MTiG_Uart0.xml index 76940d652a..66ffce03c9 100644 --- a/conf/modules/ins_xsens_MTiG_Uart0.xml +++ b/conf/modules/ins_xsens_MTiG_Uart0.xml @@ -10,7 +10,7 @@ - + diff --git a/conf/modules/ins_xsens_MTi_Uart0.xml b/conf/modules/ins_xsens_MTi_Uart0.xml index 37d88bfba5..86133ff938 100644 --- a/conf/modules/ins_xsens_MTi_Uart0.xml +++ b/conf/modules/ins_xsens_MTi_Uart0.xml @@ -9,7 +9,7 @@ - + diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 7db3b69cdc..4426d1b944 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -56,11 +56,13 @@ #if USE_BAROMETER #include "subsystems/sensors/baro.h" #endif +#if USE_INS +#include "subsystems/ins.h" +#endif // autopilot & control #include "state.h" #include "firmwares/fixedwing/autopilot.h" -#include "subsystems/ins.h" #include "firmwares/fixedwing/stabilization/stabilization_attitude.h" #include CTRL_TYPE_H #include "subsystems/nav.h" @@ -182,7 +184,9 @@ void init_ap( void ) { baro_init(); #endif +#if USE_INS ins_init(); +#endif stateInit(); @@ -487,11 +491,9 @@ void navigation_task( void ) { } -#if USE_AHRS #ifdef AHRS_TRIGGERED_ATTITUDE_LOOP volatile uint8_t new_ins_attitude = 0; #endif -#endif void attitude_loop( void ) { @@ -564,7 +566,9 @@ void sensors_task( void ) { baro_periodic(); #endif +#if USE_INS ins_periodic(); +#endif } @@ -624,7 +628,8 @@ void event_task_ap( void ) { ImuEvent(on_gyro_event, on_accel_event, on_mag_event); #endif -#if USE_INS +#ifdef InsEvent +#pragma message "calling InsEvent, remove me.." InsEvent(NULL); #endif @@ -665,7 +670,9 @@ void event_task_ap( void ) { #if USE_GPS static inline void on_gps_solution( void ) { +#if USE_INS ins_update_gps(); +#endif #if USE_AHRS ahrs_update_gps(); #endif @@ -767,7 +774,9 @@ static inline void on_mag_event(void) #if USE_BAROMETER static inline void on_baro_abs_event( void ) { +#if USE_INS ins_update_baro(); +#endif } static inline void on_baro_dif_event( void ) { diff --git a/sw/airborne/modules/ins/fw_ins_vn100.c b/sw/airborne/modules/ins/fw_ins_vn100.c index fe595cbfe2..3ac16c2b94 100644 --- a/sw/airborne/modules/ins/fw_ins_vn100.c +++ b/sw/airborne/modules/ins/fw_ins_vn100.c @@ -82,7 +82,7 @@ static inline bool_t ins_configure( void ) { return FALSE; } -void ins_periodic_task( void ) { +void ins_periodic( void ) { if (!SpiCheckAvailable()) { SpiOverRun(); return; diff --git a/sw/airborne/modules/ins/ins_chimu_spi.c b/sw/airborne/modules/ins/ins_chimu_spi.c index 8674e1e039..e364e293e0 100644 --- a/sw/airborne/modules/ins/ins_chimu_spi.c +++ b/sw/airborne/modules/ins/ins_chimu_spi.c @@ -127,7 +127,7 @@ void ahrs_update_gps( void ) } //Frequency defined in conf *.xml -void ins_periodic_task( void ) +void ins_periodic( void ) { } diff --git a/sw/airborne/modules/ins/ins_chimu_uart.c b/sw/airborne/modules/ins/ins_chimu_uart.c index 7a05dde04f..76fcf976c3 100644 --- a/sw/airborne/modules/ins/ins_chimu_uart.c +++ b/sw/airborne/modules/ins/ins_chimu_uart.c @@ -98,7 +98,7 @@ void parse_ins_msg( void ) //Frequency defined in conf *.xml -void ins_periodic_task( void ) +void ins_periodic( void ) { // Downlink Send } diff --git a/sw/airborne/modules/ins/ins_module.h b/sw/airborne/modules/ins/ins_module.h index 1bab2b1181..06a516b284 100644 --- a/sw/airborne/modules/ins/ins_module.h +++ b/sw/airborne/modules/ins/ins_module.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -19,19 +17,19 @@ * 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 ins.h +/** \file ins_module.h * \brief Device independent INS code * */ -#ifndef INS_H -#define INS_H +#ifndef INS_MODULE_H +#define INS_MODULE_H #include "std.h" +#include "subsystems/ins.h" #ifndef INS_FORMAT #define INS_FORMAT float @@ -69,8 +67,6 @@ extern INS_FORMAT ins_pitch_neutral; extern volatile uint8_t ins_msg_received; extern volatile uint8_t new_ins_attitude; -extern void ins_init( void ); -extern void ins_periodic_task( void ); void handle_ins_msg( void); void parse_ins_msg( void ); void parse_ins_buffer( uint8_t ); @@ -104,4 +100,4 @@ void parse_ins_buffer( uint8_t ); } -#endif /* INS_H */ +#endif /* INS_MODULE_H */ diff --git a/sw/airborne/modules/ins/ins_vn100.c b/sw/airborne/modules/ins/ins_vn100.c index c595d49676..a4da99f2b2 100644 --- a/sw/airborne/modules/ins/ins_vn100.c +++ b/sw/airborne/modules/ins/ins_vn100.c @@ -60,7 +60,7 @@ uint32_t ins_baud; uint8_t ins_init_status; -/* ins_init and ins_periodic_task to be implemented according to the airframe type : FW or BOOZ */ +/* ins_init and ins_periodic to be implemented according to the airframe type : FW or BOOZ */ void parse_ins_msg( void ) { if (last_received_packet.ErrID != VN100_Error_None) { diff --git a/sw/airborne/modules/ins/ins_vn100.h b/sw/airborne/modules/ins/ins_vn100.h index d43630e84b..c7f90c5ca3 100644 --- a/sw/airborne/modules/ins/ins_vn100.h +++ b/sw/airborne/modules/ins/ins_vn100.h @@ -51,7 +51,6 @@ extern struct FloatVect3 ins_mag; extern volatile uint8_t ins_msg_received; extern void ins_init( void ); -extern void ins_periodic_task( void ); extern void ins_event_task( void ); extern void ins_report_task( void ); extern void parse_ins_msg( void ); diff --git a/sw/airborne/modules/ins/ins_xsens.c b/sw/airborne/modules/ins/ins_xsens.c index 343ce1cef6..211b317117 100644 --- a/sw/airborne/modules/ins/ins_xsens.c +++ b/sw/airborne/modules/ins/ins_xsens.c @@ -26,6 +26,7 @@ #include "ins_module.h" #include "ins_xsens.h" +#include "subsystems/ins.h" #include @@ -233,7 +234,7 @@ void imu_impl_init(void) { } void imu_periodic(void) { - ins_periodic_task(); + ins_periodic(); } #endif /* USE_IMU */ @@ -244,7 +245,7 @@ void gps_impl_init(void) { } #endif -void ins_periodic_task( void ) { +void ins_periodic( void ) { if (xsens_configured > 0) { switch (xsens_configured) @@ -305,6 +306,10 @@ void ins_periodic_task( void ) { RunOnceEvery(100,XSENS_ReqGPSStatus()); } +void ins_update_gps(void) { + +} + #if USE_INS #include "state.h" diff --git a/sw/airborne/subsystems/ins/ins_float.c b/sw/airborne/subsystems/ins/ins_alt_float.c similarity index 96% rename from sw/airborne/subsystems/ins/ins_float.c rename to sw/airborne/subsystems/ins/ins_alt_float.c index 263f7edb65..bbcbe6e293 100644 --- a/sw/airborne/subsystems/ins/ins_float.c +++ b/sw/airborne/subsystems/ins/ins_alt_float.c @@ -1,7 +1,5 @@ /* - * Paparazzi autopilot $Id$ - * - * Copyright (C) 2004-2010 The Paparazzi Team + * Copyright (C) 2004-2012 The Paparazzi Team * * This file is part of paparazzi. * @@ -19,24 +17,26 @@ * 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 estimator.c - * \brief State estimate, fusioning sensors +/** @file ins_float.c + * Filters altitude and climb rate. */ -#include "subsystems/ins/ins_float.h" +#include "subsystems/ins.h" #include #include #include "state.h" -#include "mcu_periph/uart.h" -#include "ap_downlink.h" #include "subsystems/gps.h" #include "subsystems/nav.h" +#ifdef DEBUG_ALT_KALMAN +#include "mcu_periph/uart.h" +#include "ap_downlink.h" +#endif + /* vertical position and speed in meters */ float estimator_z; float estimator_z_dot; @@ -168,6 +168,7 @@ void alt_kalman(float z_meas) { float R; float SIGMA2; +#if USE_BAROMETER #if USE_BARO_MS5534A if (alt_baro_enabled) { DT = BARO_DT; @@ -186,6 +187,7 @@ void alt_kalman(float z_meas) { R = baro_bmp_r; SIGMA2 = baro_bmp_sigma2; } else +#endif #endif { DT = GPS_DT; diff --git a/sw/airborne/subsystems/ins/ins_float.h b/sw/airborne/subsystems/ins/ins_alt_float.h similarity index 100% rename from sw/airborne/subsystems/ins/ins_float.h rename to sw/airborne/subsystems/ins/ins_alt_float.h