diff --git a/Makefile b/Makefile index 65e483cf43..ac929bec4c 100644 --- a/Makefile +++ b/Makefile @@ -238,7 +238,6 @@ clean: $(Q)find . -mindepth 2 -name Makefile -exec sh -c 'echo "Cleaning {}"; $(MAKE) -C `dirname {}` $@' \; $(Q)find . -name '*~' -exec rm -f {} \; $(Q)rm -f paparazzi sw/simulator/launchsitl - $(Q)rm -rf tests/results/* cleanspaces: find ./sw/airborne -name '*.[ch]' -exec sed -i {} -e 's/[ \t]*$$//' \; @@ -274,8 +273,5 @@ sw/simulator/launchsitl: chmod a+x $@ test: all replace_current_conf_xml - cd tests; $(MAKE) $(@) - -test_all_example_airframes: replace_current_conf_xml - cd tests; $(MAKE) $(@) TARGET_BOARD=examples + cd tests; $(MAKE) test diff --git a/conf/airframes/TestHardware/LisaL_v1.1_aspirin_v1.5_overo_rc.xml b/conf/airframes/TestHardware/LisaL_v1.1_aspirin_v1.5_overo_rc.xml index fe79b77174..c27f0e6d59 100644 --- a/conf/airframes/TestHardware/LisaL_v1.1_aspirin_v1.5_overo_rc.xml +++ b/conf/airframes/TestHardware/LisaL_v1.1_aspirin_v1.5_overo_rc.xml @@ -4,20 +4,282 @@ Powered via a plug 12V pack Lisa/L v1.1 board XBee connected to UART2 configured at 38400 - Aspirin v1.5 - overo + Booz2 v1.2 + GPS connected to UART1 (Since this is inside in a metal box it won't ever get a solution) --> - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+ + + + +
+ +
+ + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+ +
+ +
+ +
+ + + +
+
diff --git a/conf/boards/lisa_l_1.0.makefile b/conf/boards/lisa_l_1.0.makefile index d5ebd0ba1f..2e427d0207 100644 --- a/conf/boards/lisa_l_1.0.makefile +++ b/conf/boards/lisa_l_1.0.makefile @@ -59,8 +59,16 @@ ifndef SYS_TIME_LED SYS_TIME_LED = 1 endif + +# +# default uart configuration +# +ifndef RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT = UART3 +endif +ifndef RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT = UART5 +endif ifndef MODEM_PORT MODEM_PORT=UART2 diff --git a/conf/boards/lisa_l_1.1.makefile b/conf/boards/lisa_l_1.1.makefile index 6f15ce905f..0fdbf428ea 100644 --- a/conf/boards/lisa_l_1.1.makefile +++ b/conf/boards/lisa_l_1.1.makefile @@ -1,11 +1,115 @@ # Hey Emacs, this is a -*- makefile -*- +# +# lisa_l_1.1.makefile +# +# http://paparazzi.enac.fr/wiki/User/LisaL +# -include $(PAPARAZZI_SRC)/conf/boards/lisa_l_1.0.makefile + +# we are actually still using the Lisa/L 1.0 header file + +BOARD=lisa_l +BOARD_VERSION=1.0 +BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\" + +# ----------------------------------------------------------------------- +ifeq ($(BOARD_PROCESSOR),'omap') + + ARCH = omap + $(TARGET).LDFLAGS += -levent -lm + +# ----------------------------------------------------------------------- +else + + ARCH=stm32 + + $(TARGET).ARCHDIR = $(ARCH) +# not needed? + +endif +# ----------------------------------------------------------------------- + +ifndef FLASH_MODE +FLASH_MODE = JTAG +endif + +# +# +# some default values shared between different firmwares +# +# + +# +# default LED configuration +# +ifndef RADIO_CONTROL_LED +RADIO_CONTROL_LED = 5 +endif + +ifndef BARO_LED +BARO_LED = none +endif + +ifndef AHRS_ALIGNER_LED +AHRS_ALIGNER_LED = 7 +endif + +ifndef GPS_LED +GPS_LED = 3 +endif + +ifndef SYS_TIME_LED +SYS_TIME_LED = 1 +endif + + +# +# default uart configuration +# +ifndef RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT +RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT = UART3 +endif +ifndef RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT +RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT = UART5 +endif + +ifndef MODEM_PORT +MODEM_PORT=UART2 +endif +ifndef MODEM_BAUD +MODEM_BAUD=B57600 +endif + +ifndef GPS_PORT +GPS_PORT=UART1 +endif +ifndef GPS_BAUD +GPS_BAUD=B38400 +endif # # this is the DRDY pin of a max1168 on a booz IMU # -# v1.1 +# v 1.1 # MAX_1168_DRDY_PORT = _GPIOB MAX_1168_DRDY_PORT_SOURCE = PortSourceGPIOB +# v1.1 +#MAX_1168_DRDY_PORT = GPIOB + + +ifndef ADC_IR1 +ADC_IR1 = 1 +ADC_IR1_CHAN = 0 +endif +ifndef ADC_IR2 +ADC_IR2 = 2 +ADC_IR2_CHAN = 1 +endif +ifndef ADC_IR3 +ADC_IR_TOP = 4 +ADC_IR_TOP_CHAN = 3 +endif +ifndef ADC_IR_NB_SAMPLES +ADC_IR_NB_SAMPLES = 16 +endif diff --git a/conf/boards/lisa_m_1.0.makefile b/conf/boards/lisa_m_1.0.makefile index ce53ca3c06..b2e64f84cb 100644 --- a/conf/boards/lisa_m_1.0.makefile +++ b/conf/boards/lisa_m_1.0.makefile @@ -52,6 +52,9 @@ ifndef SYS_TIME_LED SYS_TIME_LED = 1 endif +# +# default uart configuration +# ifndef RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT = UART3 endif @@ -76,17 +79,6 @@ GPS_BAUD=B38400 endif -# -# this is the DRDY pin of a max1168 on a booz IMU -# -# v 1.0 -# -MAX_1168_DRDY_PORT = _GPIOD -MAX_1168_DRDY_PORT_SOURCE = PortSourceGPIOD -# v1.1 -#MAX_1168_DRDY_PORT = GPIOB - - ifndef ADC_IR1 ADC_IR1 = 1 diff --git a/conf/boards/lisa_m_2.0.makefile b/conf/boards/lisa_m_2.0.makefile index 2e9f366483..8040376e97 100644 --- a/conf/boards/lisa_m_2.0.makefile +++ b/conf/boards/lisa_m_2.0.makefile @@ -1,12 +1,97 @@ # Hey Emacs, this is a -*- makefile -*- +# +# lisa_m_2.0.makefile +# +# http://paparazzi.enac.fr/wiki/Lisa/M +# + +BOARD=lisa_m +BOARD_VERSION=1.0 +BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\" + +ARCH=stm32 +$(TARGET).ARCHDIR = $(ARCH) +# not needed? +$(TARGET).OOCD_INTERFACE=flossjtag +#$(TARGET).OOCD_INTERFACE=jtagkey-tiny + +# ----------------------------------------------------------------------- + +ifndef FLASH_MODE +FLASH_MODE = JTAG +#FLASH_MODE = SERIAL +endif # -# Swap GPS UART with spektrum UART # +# some default values shared between different firmwares +# +# + + +# +# default LED configuration +# +ifndef RADIO_CONTROL_LED +RADIO_CONTROL_LED = none +endif + +ifndef BARO_LED +BARO_LED = none +endif + +ifndef AHRS_ALIGNER_LED +AHRS_ALIGNER_LED = none +endif + +ifndef GPS_LED +GPS_LED = none +endif + +ifndef SYS_TIME_LED +SYS_TIME_LED = 1 +endif + +# +# default uart configuration +# +ifndef RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT = UART1 +endif + +ifndef RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT +RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT = UART5 +endif + +ifndef MODEM_PORT +MODEM_PORT=UART2 +endif +ifndef MODEM_BAUD +MODEM_BAUD=B57600 +endif + ifndef GPS_PORT GPS_PORT=UART3 endif +ifndef GPS_BAUD +GPS_BAUD=B38400 +endif -include $(PAPARAZZI_SRC)/conf/boards/lisa_m_1.0.makefile + + +ifndef ADC_IR1 +ADC_IR1 = 1 +ADC_IR1_CHAN = 0 +endif +ifndef ADC_IR2 +ADC_IR2 = 2 +ADC_IR2_CHAN = 1 +endif +ifndef ADC_IR3 +ADC_IR_TOP = 4 +ADC_IR_TOP_CHAN = 3 +endif +ifndef ADC_IR_NB_SAMPLES +ADC_IR_NB_SAMPLES = 16 +endif diff --git a/conf/boards/navgo_1.0.makefile b/conf/boards/navgo_1.0.makefile index 75b42e53f4..2fad0c60a2 100644 --- a/conf/boards/navgo_1.0.makefile +++ b/conf/boards/navgo_1.0.makefile @@ -44,7 +44,9 @@ SYS_TIME_LED = none endif -### default settings +# +# default uart settings +# ifndef GPS_PORT GPS_PORT = UART0 endif diff --git a/conf/boards/tiny_0.99.makefile b/conf/boards/tiny_0.99.makefile index f3879c0b70..64650b82a1 100644 --- a/conf/boards/tiny_0.99.makefile +++ b/conf/boards/tiny_0.99.makefile @@ -4,17 +4,81 @@ # http://paparazzi.enac.fr/wiki/Tiny_v0.99 # - -include $(PAPARAZZI_SRC)/conf/boards/tiny_2.11.makefile - +ARCH=lpc21 BOARD=tiny BOARD_VERSION=0.99 BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\" -GPS_PORT = UART1 -GPS_LED = none -MODEM_PORT = UART0 +ifndef FLASH_MODE +FLASH_MODE = IAP +endif + + +LPC21ISP_BAUD = 38400 +LPC21ISP_XTAL = 12000 + +# +# default LED configuration +# +ifndef RADIO_CONTROL_LED +RADIO_CONTROL_LED = none +endif + +ifndef BARO_LED +BARO_LED = none +endif + +ifndef AHRS_ALIGNER_LED +AHRS_ALIGNER_LED = none +endif + +ifndef GPS_LED +GPS_LED = none +endif + +ifndef SYS_TIME_LED +SYS_TIME_LED = none +endif + + +# +# default uart settings +# +ifndef GPS_PORT +GPS_PORT = UART1 +endif +ifndef GPS_BAUD +GPS_BAUD = B38400 +endif + +ifndef MODEM_PORT +MODEM_PORT = UART0 +endif +ifndef MODEM_BAUD +MODEM_BAUD = B57600 +endif + + + +ADC_IR_TOP = ADC_0 +ADC_IR1 = ADC_1 +ADC_IR2 = ADC_2 +ADC_IR_NB_SAMPLES = 16 +ADC_GYRO_NB_SAMPLES = 16 + +ADC_GENERIC_NB_SAMPLES = 16 + +# +# you can use different actuators by adding a configure option to your firmware section +# e.g. in your airframe config!) diff --git a/conf/boards/umarim_1.0.makefile b/conf/boards/umarim_1.0.makefile index c1eb9b600e..7a6a7554d8 100644 --- a/conf/boards/umarim_1.0.makefile +++ b/conf/boards/umarim_1.0.makefile @@ -11,6 +11,7 @@ BOARD_VERSION=1.0 BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\" + ifndef FLASH_MODE FLASH_MODE = IAP endif @@ -44,7 +45,9 @@ SYS_TIME_LED = none endif -### default settings +# +# default uart settings +# ifndef GPS_PORT GPS_PORT = UART0 endif @@ -59,9 +62,18 @@ ifndef MODEM_BAUD MODEM_BAUD = B57600 endif + + ADC_GENERIC_NB_SAMPLES = 16 +# +# you can use different actuators by adding a configure option to your firmware section +# e.g. + diff --git a/sw/airborne/firmwares/rotorcraft/actuators.h b/sw/airborne/firmwares/rotorcraft/actuators.h index 23d7988fa4..e8d0c056d1 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators.h +++ b/sw/airborne/firmwares/rotorcraft/actuators.h @@ -1,9 +1,32 @@ +/* + * Copyright (C) 2010-2012 The Paparazzi Team + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * 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 actuators.h + * Generic Actuators API. + */ + #ifndef ACTUATORS_H #define ACTUATORS_H //#include ACTUATORS -//#include "booz2_servos_direct_hw.h" -//#include "booz2_control_surfaces.h" #include "std.h" diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c b/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c index fc55a64aa2..3a2e203e2e 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c @@ -1,3 +1,28 @@ +/* + * Copyright (C) 2008-2009 Antoine Drouin + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * 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 actuators_asctec.c + * Actuators driver for Asctec motor controllers. + */ + #include "firmwares/rotorcraft/actuators.h" #include "firmwares/rotorcraft/actuators/actuators_asctec.h" diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.h b/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.h index 9b9dc58916..8a7ddddeef 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.h +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -21,26 +19,30 @@ * Boston, MA 02111-1307, USA. */ +/** @file actuators_asctec.h + * Actuators driver for Asctec motor controllers. + */ + #ifndef ACTUATORS_ASCTEC_H #define ACTUATORS_ASCTEC_H #include "mcu_periph/i2c.h" enum actuators_astec_cmd { NONE, - TEST, - REVERSE, - SET_ADDR }; + TEST, + REVERSE, + SET_ADDR }; enum actuators_astec_addr { FRONT, - BACK, - LEFT, - RIGHT }; + BACK, + LEFT, + RIGHT }; /* this is for the v1 protocol which does its own mixing */ enum actuators_astec_cmds { PITCH, - ROLL, - YAW, - THRUST, + ROLL, + YAW, + THRUST, CMD_NB }; struct ActuatorsAsctec { @@ -56,16 +58,16 @@ struct ActuatorsAsctec { extern struct ActuatorsAsctec actuators_asctec; #define actuators_asctec_SetCommand(_v) { \ - actuators_asctec.cmd = _v; \ -} + actuators_asctec.cmd = _v; \ + } -#define actuators_asctec_SetNewAddr(_v) { \ - actuators_asctec.new_addr = _v; \ -} +#define actuators_asctec_SetNewAddr(_v) { \ + actuators_asctec.new_addr = _v; \ + } -#define actuators_asctec_SetCurAddr(_v) { \ - actuators_asctec.cur_addr = _v; \ -} +#define actuators_asctec_SetCurAddr(_v) { \ + actuators_asctec.cur_addr = _v; \ + } #endif /* ACTUATORS_ASCTEC_H */ diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_mkk.c b/sw/airborne/firmwares/rotorcraft/actuators/actuators_mkk.c index 57289b61dc..3a037eba0d 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_mkk.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_mkk.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -21,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +/** @file actuators_mkk.c + * Actuators driver for Mikrokopter motor controllers. + */ + #include "firmwares/rotorcraft/actuators.h" #include "firmwares/rotorcraft/actuators/actuators_mkk.h" diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_mkk.h b/sw/airborne/firmwares/rotorcraft/actuators/actuators_mkk.h index 77b36eb980..a4e5e41f76 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_mkk.h +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_mkk.h @@ -1,6 +1,4 @@ /* - * $Id: actuators_mkk.h 3847 2009-08-02 21:47:31Z poine $ - * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -21,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +/** @file actuators_mkk.h + * Actuators driver for Mikrokopter motor controllers. + */ + #ifndef ACTUATORS_MKK_H #define ACTUATORS_MKK_H diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.c b/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.c index 4647b682f6..424f832ed9 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.c @@ -1,7 +1,5 @@ /* - * $Id$ - * - * Copyright (C) 2010 The Paparazzi Team + * Copyright (C) 2010-2012 The Paparazzi Team * * This file is part of paparazzi. * @@ -21,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +/** @file actuators_pwm_supervision.h + * PWM actuators with supervision. + */ + #include "firmwares/rotorcraft/actuators.h" #include "firmwares/rotorcraft/commands.h" #include "actuators_pwm_supervision.h" @@ -48,7 +50,6 @@ void actuators_init(void) void actuators_set(bool_t motors_on) { int32_t pwm_commands[COMMANDS_NB]; int32_t pwm_commands_pprz[COMMANDS_NB]; - int32_t booz2_commands[COMMANDS_NB]; pwm_commands[COMMAND_ROLL] = commands[COMMAND_ROLL] * PWM_GAIN_SCALE; pwm_commands[COMMAND_PITCH] = commands[COMMAND_PITCH] * PWM_GAIN_SCALE; diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.h b/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.h index cf10740cc2..eead17f8c9 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.h +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.h @@ -1,7 +1,5 @@ /* - * $Id: actuators_pwm_supervision$ - * - * Copyright (C) 2010 The Paparazzi Team + * Copyright (C) 2010-2012 The Paparazzi Team * * This file is part of paparazzi. * @@ -19,7 +17,10 @@ * 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 actuators_pwm_supervision.h + * PWM actuators with supervision. */ #ifndef ACTUATORS_PWM_SUPERVISION_H diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_skiron.c b/sw/airborne/firmwares/rotorcraft/actuators/actuators_skiron.c index 7948a7b5db..b7a3aec3fa 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_skiron.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_skiron.c @@ -19,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +/** @file actuators_skiron.c + * Skiron motor speed controller by Michel. + */ + #include "firmwares/rotorcraft/actuators.h" #include "firmwares/rotorcraft/actuators/actuators_skiron.h" diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_skiron.h b/sw/airborne/firmwares/rotorcraft/actuators/actuators_skiron.h index 3fc746e967..04c559b6c7 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_skiron.h +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_skiron.h @@ -19,7 +19,9 @@ * Boston, MA 02111-1307, USA. */ -/* Skiron motor speed controller by Michel */ +/** @file actuators_skiron.h + * Skiron motor speed controller by Michel. + */ #ifndef ACTUATORS_SKIRON_H #define ACTUATORS_SKIRON_H diff --git a/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c b/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c index 6007067d4b..e0335a0a11 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2010 The Paparazzi Team * * This file is part of Paparazzi. @@ -19,7 +17,10 @@ * 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 arch/stm32/actuators_pwm_arch.c + * STM32 PWM servos handling */ #include "firmwares/rotorcraft/actuators/actuators_pwm.h" diff --git a/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.h b/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.h index 867cb006e8..480dd466c6 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.h +++ b/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2010 The Paparazzi Team * * This file is part of Paparazzi. @@ -19,11 +17,10 @@ * 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. - * */ -/* - * STM32 PWM servos handling +/** @file arch/stm32/actuators_pwm_arch.h + * STM32 PWM servos handling */ #ifndef ACTUATORS_PWM_ARCH_H diff --git a/sw/airborne/firmwares/rotorcraft/actuators/supervision.c b/sw/airborne/firmwares/rotorcraft/actuators/supervision.c index 30ce41af55..a08ad59512 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/supervision.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/supervision.c @@ -1,7 +1,5 @@ /* - * $Id$ - * - * Copyright (C) 2008-2010 The Paparazzi Team + * Copyright (C) 2008-2012 The Paparazzi Team * * This file is part of Paparazzi. * @@ -19,7 +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. - * + */ + +/** @file supervision.c + * Supervision. + * Handles the mapping of roll/pitch/yaw commands + * to actual motor commands. */ #include "firmwares/rotorcraft/actuators/supervision.h" diff --git a/sw/airborne/firmwares/rotorcraft/actuators/supervision.h b/sw/airborne/firmwares/rotorcraft/actuators/supervision.h index e8aa343c0b..66621af8eb 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/supervision.h +++ b/sw/airborne/firmwares/rotorcraft/actuators/supervision.h @@ -1,3 +1,30 @@ +/* + * Copyright (C) 2008-2012 The Paparazzi Team + * + * This file is part of Paparazzi. + * + * Paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * Paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * 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 supervision.h + * Supervision. + * Handles the mapping of roll/pitch/yaw commands + * to actual motor commands. + */ + #ifndef SUPERVISION_H #define SUPERVISION_H diff --git a/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c b/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c index 35f6335d5d..3fd0beb7a4 100644 --- a/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c +++ b/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -21,6 +19,11 @@ * Boston, MA 02111-1307, USA. */ +/** @file firmware/rotorcraft/guidance/guidance_h.c + * Horizontal guidance for rotorcrafts. + * + */ + #define GUIDANCE_H_C //#define GUIDANCE_H_USE_REF 1 #include "firmwares/rotorcraft/guidance/guidance_h.h" @@ -216,6 +219,9 @@ void guidance_h_run(bool_t in_flight) { #ifndef STABILISATION_ATTITUDE_TYPE_FLOAT stab_att_sp_euler.phi = nav_roll << (REF_ANGLE_FRAC - INT32_ANGLE_FRAC); stab_att_sp_euler.theta = nav_pitch << (REF_ANGLE_FRAC - INT32_ANGLE_FRAC); +#ifdef STABILISATION_ATTITUDE_TYPE_QUAT + INT32_QUAT_OF_EULERS(stab_att_sp_quat, stab_att_sp_euler); +#endif #endif } else { @@ -302,6 +308,9 @@ __attribute__ ((always_inline)) static inline void guidance_h_hover_run(void) { #endif /* STABILISATION_ATTITUDE_TYPE_FLOAT */ EULERS_COPY(stab_att_sp_euler, guidance_h_command_body); +#ifdef STABILISATION_ATTITUDE_TYPE_QUAT + INT32_QUAT_OF_EULERS(stab_att_sp_quat, stab_att_sp_euler); +#endif } diff --git a/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.h b/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.h index 20a761d987..fdc49cb05d 100644 --- a/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.h +++ b/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -21,6 +19,11 @@ * Boston, MA 02111-1307, USA. */ +/** @file firmware/rotorcraft/guidance/guidance_h.h + * Horizontal guidance for rotorcrafts. + * + */ + #ifndef GUIDANCE_H_H #define GUIDANCE_H_H @@ -39,9 +42,12 @@ extern uint8_t guidance_h_mode; -/* horizontal setpoint in NED */ -/* Q_int32_xx_8 */ +/** horizontal position setpoint in NED. + * fixed point representation: Q23.8 + * accuracy 0.0039, range 8388km + */ extern struct Int32Vect2 guidance_h_pos_sp; + extern int32_t guidance_h_psi_sp; extern struct Int32Vect2 guidance_h_pos_ref; extern struct Int32Vect2 guidance_h_speed_ref; @@ -53,7 +59,7 @@ extern struct Int32Vect2 guidance_h_pos_err_sum; extern struct Int32Vect2 guidance_h_nav_err; extern struct Int32Eulers guidance_h_rc_sp; -extern struct Int32Vect2 guidance_h_command_earth; +extern struct Int32Vect2 guidance_h_command_earth; extern struct Int32Eulers guidance_h_command_body; extern int32_t guidance_h_pgain; diff --git a/sw/airborne/firmwares/rotorcraft/guidance/guidance_h_ref.h b/sw/airborne/firmwares/rotorcraft/guidance/guidance_h_ref.h index 1536d9c76b..93d944cf99 100644 --- a/sw/airborne/firmwares/rotorcraft/guidance/guidance_h_ref.h +++ b/sw/airborne/firmwares/rotorcraft/guidance/guidance_h_ref.h @@ -1,6 +1,4 @@ /* - * $Id: guidance_v_ref.h 4173 2009-09-18 11:57:21Z flixr $ - * * Copyright (C) 2008-2009 ENAC * * This file is part of paparazzi. @@ -21,6 +19,11 @@ * Boston, MA 02111-1307, USA. */ +/** @file firmware/rotorcraft/guidance/guidance_h_ref.h + * Reference generation for horizontal guidance. + * + */ + #ifndef GUIDANCE_H_REF_H #define GUIDANCE_H_REF_H diff --git a/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.c b/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.c index 731a660ca9..3ed6676d2a 100644 --- a/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.c +++ b/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -21,6 +19,11 @@ * Boston, MA 02111-1307, USA. */ +/** @file firmwares/rotorcraft/guidance/guidance_v.c + * Vertical guidance for rotorcrafts. + * + */ + #define GUIDANCE_V_C #define GUIDANCE_V_USE_REF 1 #include "firmwares/rotorcraft/guidance/guidance_v.h" @@ -53,7 +56,7 @@ int32_t guidance_v_delta_t; /** Direct throttle from radio control. - * range 0:200 + * range 0:#MAX_PPRZ */ int32_t guidance_v_rc_delta_t; @@ -136,8 +139,9 @@ void guidance_v_mode_changed(uint8_t new_mode) { } void guidance_v_notify_in_flight( bool_t in_flight) { - if (in_flight) + if (in_flight) { gv_adapt_init(); + } } @@ -166,8 +170,9 @@ void guidance_v_run(bool_t in_flight) { case GUIDANCE_V_MODE_CLIMB: #if USE_FMS - if (fms.enabled && fms.input.v_mode == GUIDANCE_V_MODE_CLIMB) + if (fms.enabled && fms.input.v_mode == GUIDANCE_V_MODE_CLIMB) { guidance_v_zd_sp = fms.input.v_sp.climb; + } #endif gv_update_ref_from_zd_sp(guidance_v_zd_sp); run_hover_loop(in_flight); @@ -175,7 +180,7 @@ void guidance_v_run(bool_t in_flight) { stabilization_cmd[COMMAND_THRUST] = guidance_v_delta_t; #else // saturate max authority with RC stick - stabilization_cmd[COMMAND_THRUST] = Min( guidance_v_rc_delta_t, guidance_v_delta_t); + stabilization_cmd[COMMAND_THRUST] = Min(guidance_v_rc_delta_t, guidance_v_delta_t); #endif break; @@ -190,7 +195,7 @@ void guidance_v_run(bool_t in_flight) { stabilization_cmd[COMMAND_THRUST] = guidance_v_delta_t; #else // saturate max authority with RC stick - stabilization_cmd[COMMAND_THRUST] = Min( guidance_v_rc_delta_t, guidance_v_delta_t); + stabilization_cmd[COMMAND_THRUST] = Min(guidance_v_rc_delta_t, guidance_v_delta_t); #endif break; @@ -216,7 +221,7 @@ void guidance_v_run(bool_t in_flight) { #else /* use rc limitation if available */ if (radio_control.status == RC_OK) - stabilization_cmd[COMMAND_THRUST] = Min( guidance_v_rc_delta_t, guidance_v_delta_t); + stabilization_cmd[COMMAND_THRUST] = Min(guidance_v_rc_delta_t, guidance_v_delta_t); else stabilization_cmd[COMMAND_THRUST] = guidance_v_delta_t; #endif diff --git a/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.h b/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.h index ca39608b06..ded9bd3500 100644 --- a/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.h +++ b/sw/airborne/firmwares/rotorcraft/guidance/guidance_v.h @@ -19,6 +19,11 @@ * Boston, MA 02111-1307, USA. */ +/** @file firmwares/rotorcraft/guidance/guidance_v.h + * Vertical guidance for rotorcrafts. + * + */ + #ifndef GUIDANCE_V #define GUIDANCE_V @@ -82,7 +87,12 @@ extern int32_t guidance_v_zdd_ref; extern int32_t guidance_v_z_sum_err; ///< accumulator for I-gain extern int32_t guidance_v_ff_cmd; ///< feed-forward command extern int32_t guidance_v_fb_cmd; ///< feed-back command -extern int32_t guidance_v_delta_t; ///< command output (ff+fb) + +/** thrust command. + * summation of feed-forward and feed-back commands, + * valid range 0 : #MAX_PPRZ + */ +extern int32_t guidance_v_delta_t; extern int32_t guidance_v_kp; ///< vertical control P-gain extern int32_t guidance_v_kd; ///< vertical control D-gain diff --git a/sw/airborne/firmwares/rotorcraft/guidance/guidance_v_ref.h b/sw/airborne/firmwares/rotorcraft/guidance/guidance_v_ref.h index 171acc679d..695d6f1a23 100644 --- a/sw/airborne/firmwares/rotorcraft/guidance/guidance_v_ref.h +++ b/sw/airborne/firmwares/rotorcraft/guidance/guidance_v_ref.h @@ -19,6 +19,11 @@ * Boston, MA 02111-1307, USA. */ +/** @file firwmares/rotorcraft/guidance/guidance_v_ref.h + * Reference generation for vertical guidance. + * + */ + #ifndef GUIDANCE_V_REF_H #define GUIDANCE_V_REF_H diff --git a/sw/airborne/firmwares/rotorcraft/stabilization.c b/sw/airborne/firmwares/rotorcraft/stabilization.c index 449d30eff3..e2cbfc39ef 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization.c +++ b/sw/airborne/firmwares/rotorcraft/stabilization.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -21,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +/** @file firmwares/rotorcraft/stabilization.c + * General stabilization interface for rotorcrafts. + */ + #include "firmwares/rotorcraft/stabilization.h" int32_t stabilization_cmd[COMMANDS_NB]; diff --git a/sw/airborne/firmwares/rotorcraft/stabilization.h b/sw/airborne/firmwares/rotorcraft/stabilization.h index fae6fa0b06..d693e6a1f0 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization.h +++ b/sw/airborne/firmwares/rotorcraft/stabilization.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -21,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +/** @file firmwares/rotorcraft/stabilization.h + * General stabilization interface for rotorcrafts. + */ + #ifndef STABILIZATION_H #define STABILIZATION_H @@ -35,6 +37,11 @@ extern void stabilization_init(void); +/** Stabilization commands. + * Contains the resulting stabilization commands, + * regardless of whether rate or attitude is currently used. + * Range -MAX_PPRZ:MAX_PPRZ + */ extern int32_t stabilization_cmd[COMMANDS_NB]; #endif /* STABILIZATION_H */ diff --git a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_none.c b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_none.c index 2fe20f7e1b..b896a6fd96 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_none.c +++ b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_none.c @@ -1,8 +1,5 @@ /* - * $Id$ - * - * Copyright (C) 2008-2009 Antoine Drouin - * Copyright (C) 2010 Felix Ruess + * Copyright (C) 2011-2012 The Paparazzi Team * * This file is part of paparazzi. * @@ -22,6 +19,13 @@ * Boston, MA 02111-1307, USA. */ +/** @file stabilization_none.c + * Dummy stabilization for rotorcrafts. + * + * Doesn't actually do any stabilization, + * just directly passes the RC commands along. + */ + #include "firmwares/rotorcraft/stabilization.h" #include "firmwares/rotorcraft/stabilization/stabilization_none.h" @@ -42,19 +46,13 @@ struct Int32Rates stabilization_none_rc_cmd; void stabilization_none_init(void) { - INT_RATES_ZERO(stabilization_none_rc_cmd); - } - void stabilization_none_read_rc( void ) { - stabilization_none_rc_cmd.p = (int32_t)radio_control.values[RADIO_ROLL]; - stabilization_none_rc_cmd.q = (int32_t)radio_control.values[RADIO_PITCH]; - stabilization_none_rc_cmd.r = (int32_t)radio_control.values[RADIO_YAW]; } diff --git a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_none.h b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_none.h index 515d4e844a..07ddd22aca 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_none.h +++ b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_none.h @@ -1,7 +1,5 @@ /* - * $Id$ - * - * Copyright (C) 2008-2009 Antoine Drouin + * Copyright (C) 2011-2012 The Paparazzi Team * * This file is part of paparazzi. * @@ -21,6 +19,13 @@ * Boston, MA 02111-1307, USA. */ +/** @file stabilization_none.h + * Dummy stabilization for rotorcrafts. + * + * Doesn't actually do any stabilization, + * just directly passes the RC commands along. + */ + #ifndef STABILIZATION_NONE #define STABILIZATION_NONE diff --git a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_rate.c b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_rate.c index d6119cf2c2..1ee64619a6 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_rate.c +++ b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_rate.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2008-2009 Antoine Drouin * Copyright (C) 2010 Felix Ruess * @@ -22,6 +20,12 @@ * Boston, MA 02111-1307, USA. */ +/** @file stabilization_rate.c + * Rate stabilization for rotorcrafts. + * + * Control loops for angular velocity. + */ + #include "firmwares/rotorcraft/stabilization.h" #include "subsystems/ahrs.h" diff --git a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_rate.h b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_rate.h index 741b3c4fb0..41a6eaf99b 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_rate.h +++ b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_rate.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright (C) 2008-2009 Antoine Drouin * * This file is part of paparazzi. @@ -21,6 +19,12 @@ * Boston, MA 02111-1307, USA. */ +/** @file stabilization_rate.h + * Rate stabilization for rotorcrafts. + * + * Control loops for angular velocity. + */ + #ifndef STABILIZATION_RATE #define STABILIZATION_RATE diff --git a/sw/in_progress/videolizer/wis-go7007-linux/Makefile b/sw/in_progress/videolizer/wis-go7007-linux/Makefile index abe30d3613..3f130a9785 100644 --- a/sw/in_progress/videolizer/wis-go7007-linux/Makefile +++ b/sw/in_progress/videolizer/wis-go7007-linux/Makefile @@ -89,6 +89,7 @@ endif $(MAKE) install -C apps DESTDIR=$(DESTDIR) clean: - $(MAKE) clean -C $(KSRC) M=$(shell pwd)/kernel + $(MAKE) clean -C $(KSRC) $(shell pwd)/kernel rm -f hotplug/wis-ezusb udev/wis-ezusb.rules $(MAKE) clean -C apps + diff --git a/tests/LisaL/01_upload.t b/tests/LisaL/01_With_b2_v1.2.t similarity index 81% rename from tests/LisaL/01_upload.t rename to tests/LisaL/01_With_b2_v1.2.t index 56c139579e..489517660c 100644 --- a/tests/LisaL/01_upload.t +++ b/tests/LisaL/01_With_b2_v1.2.t @@ -1,10 +1,9 @@ #!/usr/bin/perl -w -use Test::More tests => 7; +use Test::More tests => 8; use lib "$ENV{'PAPARAZZI_SRC'}/tests/lib"; use Program; use Proc::Background; -use Ivy; $|++; @@ -12,7 +11,7 @@ $|++; # Make the airframe my $make_compile_options = "AIRCRAFT=LisaLv11_Booz2v12_RC clean_ac ap.compile"; my $compile_output = run_program( - "Attempting to build and upload the firmware.", + "Attempting to build the firmware.", $ENV{'PAPARAZZI_SRC'}, "make $make_compile_options", 0,1); @@ -31,25 +30,28 @@ unlike($upload_output, '/\bError\b/i', "The upload output does not contain the w # Start the server process my $server_command = "$ENV{'PAPARAZZI_HOME'}/sw/ground_segment/tmtc/server"; -my $server_options = ""; -my $server = Proc::Background->new($server_command, $server_options); +my @server_options = qw(-n); +my $server = Proc::Background->new($server_command, @server_options); sleep 2; # The service should die in this time if there's an error -ok($server->alive(), "The server started successfully"); +ok($server->alive(), "The server process started successfully"); # Start the link process my $link_command = "$ENV{'PAPARAZZI_HOME'}/sw/ground_segment/tmtc/link"; my @link_options = qw(-d /dev/tty.usbserial-000013FD -s 57600 -transport xbee -xbee_addr 123); -#my @link_options = qw(-d /dev/tty.usbserial-000013FD -s 57600); sleep 2; # The service should die in this time if there's an error my $link = Proc::Background->new($link_command, @link_options); -ok($link->alive(), "The link started successfully"); +ok($link->alive(), "The link process started successfully"); # Open the Ivy bus and read from it... -# TODO: learn how to read and write to the Ivy bus +SKIP : { + skip "Skipping testing of the hardware since we can't load the Ivy module. Please install IO::Socket::Multicast", 1 unless eval("use Ivy; 1"); + ok(1, "We can load the Ivy module."); + # TODO: learn how to read and write to the Ivy bus +} # Shutdown the server and link processes -ok($server->die(), "The server shutdown successfully."); -ok($link->die(), "The link shutdown successfully."); +ok($server->die(), "The server process shutdown successfully."); +ok($link->die(), "The link process shutdown successfully."); ################################################################################ # functions used by this test script. diff --git a/tests/LisaL/02_With_aspirin_v1.5_and_overo.t b/tests/LisaL/02_With_aspirin_v1.5_and_overo.t new file mode 100644 index 0000000000..a1c948f670 --- /dev/null +++ b/tests/LisaL/02_With_aspirin_v1.5_and_overo.t @@ -0,0 +1,97 @@ +#!/usr/bin/perl -w + +use Test::More tests => 8; +use lib "$ENV{'PAPARAZZI_SRC'}/tests/lib"; +use Program; +use Proc::Background; + +$|++; + +#################### +# Make the airframe +my $make_compile_options = "AIRCRAFT=LisaLv11_Aspirinv15_Overo_RC clean_ac ap.compile"; +my $compile_output = run_program( + "Attempting to build the firmware.", + $ENV{'PAPARAZZI_SRC'}, + "make $make_compile_options", + 0,1); +unlike($compile_output, '/Aircraft \'LisaLv11_Aspirinv15_Overo_RC\' not found in/', "The compile output does not contain the message \"Aircraft \'LisaLv11_Aspirinv15_Overo_RC\' not found in\""); +unlike($compile_output, '/\bError\b/i', "The compile output does not contain the word \"Error\""); + +#################### +# Upload the airframe +my $make_upload_options = "AIRCRAFT=LisaLv11_Aspirinv15_Overo_RC BOARD_SERIAL=LISA-L-000154 ap.upload"; +my $upload_output = run_program( + "Attempting to build and upload the firmware.", + $ENV{'PAPARAZZI_SRC'}, + "make $make_upload_options", + 0,1); +unlike($upload_output, '/\bError\b/i', "The upload output does not contain the word \"Error\""); + +# Start the server process +my $server_command = "$ENV{'PAPARAZZI_HOME'}/sw/ground_segment/tmtc/server"; +my @server_options = qw(-n); +my $server = Proc::Background->new($server_command, @server_options); +sleep 2; # The service should die in this time if there's an error +ok($server->alive(), "The server process started successfully"); + +# Start the link process +my $link_command = "$ENV{'PAPARAZZI_HOME'}/sw/ground_segment/tmtc/link"; +my @link_options = qw(-d /dev/tty.usbserial-000013FD -s 57600 -transport xbee -xbee_addr 123); +sleep 2; # The service should die in this time if there's an error +my $link = Proc::Background->new($link_command, @link_options); +ok($link->alive(), "The link process started successfully"); + +# Open the Ivy bus and read from it... +SKIP : { + skip "Skipping testing of the hardware since we can't load the Ivy module. Please install IO::Socket::Multicast", 1 unless eval("use Ivy; 1"); + ok(1, "We can load the Ivy module."); + # TODO: learn how to read and write to the Ivy bus +} + +# Shutdown the server and link processes +ok($server->die(), "The server process shutdown successfully."); +ok($link->die(), "The link process shutdown successfully."); + +################################################################################ +# functions used by this test script. +sub run_program +{ + my $message = shift; + my $dir = shift; + my $command = shift; + my $verbose = shift; + my $dont_fail_on_error = shift; + + warn "$message\n" if $verbose; + if (defined $dir) + { + $command = "cd $dir;" . $command; + } + my $prog = new Program("bash"); + my $fh = $prog->open("-c \"$command\""); + warn "Running command: \"". $prog->last_command() ."\"\n" if $verbose; + $fh->autoflush(1); + my @output; + while (<$fh>) + { + warn $_ if $verbose; + chomp $_; + push @output, $_; + } + $fh->close; + my $exit_status = $?/256; + unless ($exit_status == 0) + { + if ($dont_fail_on_error) + { + warn "Error: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n" if $verbose; + } + else + { + die "Error: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n"; + } + } + return wantarray ? @output : join "\n", @output; +} + diff --git a/tests/Makefile b/tests/Makefile index f6eb2bd4b5..bdbbfa35c6 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,10 +1,20 @@ Q = @ PERL = /usr/bin/perl TEST_VERBOSE = 0 -ifeq ($(TARGET_BOARD),) - TARGET_BOARD = * +NON_TEST_DIRS = lib|results +HARDWARE_REGEX = Lisa|Tiny|Umarim +HARDWARE_TEST_DIRS = $(shell find -L * -maxdepth 1 -type d | grep -Ev "$(NON_TEST_DIRS)" | grep -E "$(HARDWARE_REGEX)") +NON_HARDWARE_TEST_DIRS = $(shell find -L * -maxdepth 1 -type d | grep -Ev "$(NON_TEST_DIRS)" | grep -Ev "$(HARDWARE_REGEX)") +ifneq ($(TARGET_BOARD),) + TEST_DIRECTORIES = $(TARGET_BOARD) +else +ifeq ($(TEST_HARDWARE),) + TEST_DIRECTORIES = $(NON_HARDWARE_TEST_DIRS) +else + TEST_DIRECTORIES = $(NON_HARDWARE_TEST_DIRS) $(HARDWARE_TEST_DIRS) endif -TEST_FILES := $(shell ls $(TARGET_BOARD)/*.t) +endif +TEST_FILES := $(shell ls $(TEST_DIRECTORIES:%=%/*.t)) ifneq ($(JUNIT),) PERLENV=PERL_TEST_HARNESS_DUMP_TAP=$(PAPARAZZI_SRC)/tests/results @@ -17,3 +27,6 @@ endif test: $(Q)$(PERLENV) $(PERL) "-e" "$(RUNTESTS)" +clean: + rm -rf results/* + diff --git a/tests/examples/01_compile_all_example_targets.t b/tests/examples/01_compile_all_example_targets.t index 275a370384..71f4484928 100644 --- a/tests/examples/01_compile_all_example_targets.t +++ b/tests/examples/01_compile_all_example_targets.t @@ -28,16 +28,16 @@ foreach my $example (sort keys%{$examples->{'aircraft'}}) next unless scalar $airframe_config->{'firmware'}->{$process}->{'target'}->{$target}->{'board'}; # Exclude some builds on Mac as they are currently broken. - next if ( ($Config{'osname'} =~ m#darwin#i) and ($example =~ m#LISA_ASCTEC_PIOTR|LisaLv11_Booz2v12_RC|BOOZ2_A1#i) and ($target =~ m#sim#i) ); + next if ( ($Config{'osname'} =~ m#darwin#i) and ($example =~ m#LISA_ASCTEC_PIOTR|LisaLv11_Booz2v12_RC|BOOZ2_A1|LisaLv11_Aspirinv15_Overo_RC#i) and ($target =~ m#sim#i) ); #warn "EXAMPLE: [$example] TARGET: [$target]\n"; - my $make_upload_options = "AIRCRAFT=$example clean_ac $target.compile"; - my $upload_output = run_program( + my $make_options = "AIRCRAFT=$example clean_ac $target.compile"; + my $output = run_program( "Attempting to build the firmware $target for the airframe $example.", $ENV{'PAPARAZZI_SRC'}, - "make $make_upload_options", + "make $make_options", $ENV->{'TEST_VERBOSE'},1); - unlike($upload_output, '/\bError\b/i', "The upload output does not contain the word \"Error\""); + unlike($output, '/\bError\b/i', "The make output for the $example target $target does not contain the word \"Error\""); } } elsif ($process =~ m#target#) @@ -48,16 +48,16 @@ foreach my $example (sort keys%{$examples->{'aircraft'}}) next unless scalar $airframe_config->{'firmware'}->{$process}->{$target}->{'board'}; # Exclude some builds on Mac as they are currently broken. - next if ( ($Config{'osname'} =~ m#darwin#i) and ($example =~ m#LISA_ASCTEC_PIOTR|LisaLv11_Booz2v12_RC|BOOZ2_A1#i) and ($target =~ m#sim#i) ); + next if ( ($Config{'osname'} =~ m#darwin#i) and ($example =~ m#LISA_ASCTEC_PIOTR|LisaLv11_Booz2v12_RC|BOOZ2_A1|LisaLv11_Aspirinv15_Overo_RC#i) and ($target =~ m#sim#i) ); #warn "EXAMPLET: [$example] TARGET: [$target]\n"; - my $make_upload_options = "AIRCRAFT=$example clean_ac $target.compile"; - my $upload_output = run_program( + my $make_options = "AIRCRAFT=$example clean_ac $target.compile"; + my $output = run_program( "Attempting to build the firmware $target for the airframe $example.", $ENV{'PAPARAZZI_SRC'}, - "make $make_upload_options", + "make $make_options", $ENV->{'TEST_VERBOSE'},1); - unlike($upload_output, '/\bError\b/i', "The upload output does not contain the word \"Error\""); + unlike($output, '/\bError\b/i', "The make output for the $example target $target does not contain the word \"Error\""); } } } diff --git a/tests/sim/01_Microjet.t b/tests/sim/01_Microjet.t new file mode 100644 index 0000000000..13d04f89c0 --- /dev/null +++ b/tests/sim/01_Microjet.t @@ -0,0 +1,87 @@ +#!/usr/bin/perl -w + +use Test::More tests => 7; +use lib "$ENV{'PAPARAZZI_SRC'}/tests/lib"; +use Program; +use Proc::Background; + +$|++; + +#################### +# Make the airframe +my $make_compile_options = "AIRCRAFT=Microjet clean_ac sim"; +my $compile_output = run_program( + "Attempting to build the sim firmware.", + $ENV{'PAPARAZZI_SRC'}, + "make $make_compile_options", + 0,1); +unlike($compile_output, '/Aircraft \'Microjet\' not found in/', "The compile output does not contain the message \"Aircraft \'Microjet\' not found in\""); +unlike($compile_output, '/\bError\b/i', "The compile output does not contain the word \"Error\""); + +# Start the server process +my $server_command = "$ENV{'PAPARAZZI_HOME'}/sw/ground_segment/tmtc/server"; +my @server_options = qw(-n); +my $server = Proc::Background->new($server_command, @server_options); +sleep 2; # The service should die in this time if there's an error +ok($server->alive(), "The server process started successfully"); + +# Start the launchsitl process +my $launchsitl_command = "$ENV{'PAPARAZZI_HOME'}/sw/simulator/launchsitl"; +my @launchsitl_options = qw(-a Microjet -boot -norc); +sleep 2; # The service should die in this time if there's an error +my $launchsitl = Proc::Background->new($launchsitl_command, @launchsitl_options); +ok($launchsitl->alive(), "The launchsitl process started successfully"); + +# Open the Ivy bus and read from it... +SKIP : { + skip "Skipping testing of the simulator since we can't load the Ivy module. Please install IO::Socket::Multicast", 1 unless eval("use Ivy; 1"); + ok(1, "We can load the Ivy module."); + # TODO: learn how to read and write to the Ivy bus +} + +# Shutdown the server and launchsitl processes +ok($server->die(), "The server process shutdown successfully."); +ok($launchsitl->die(), "The launchsitl process shutdown successfully."); + +################################################################################ +# functions used by this test script. +sub run_program +{ + my $message = shift; + my $dir = shift; + my $command = shift; + my $verbose = shift; + my $dont_fail_on_error = shift; + + warn "$message\n" if $verbose; + if (defined $dir) + { + $command = "cd $dir;" . $command; + } + my $prog = new Program("bash"); + my $fh = $prog->open("-c \"$command\""); + warn "Running command: \"". $prog->last_command() ."\"\n" if $verbose; + $fh->autoflush(1); + my @output; + while (<$fh>) + { + warn $_ if $verbose; + chomp $_; + push @output, $_; + } + $fh->close; + my $exit_status = $?/256; + unless ($exit_status == 0) + { + if ($dont_fail_on_error) + { + warn "Error: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n" if $verbose; + } + else + { + die "Error: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n"; + } + } + return wantarray ? @output : join "\n", @output; +} +