diff --git a/conf/airframes/ENAC/quadrotor/blender.xml b/conf/airframes/ENAC/quadrotor/blender.xml index 8001cd5ac66..a71b809f98c 100644 --- a/conf/airframes/ENAC/quadrotor/blender.xml +++ b/conf/airframes/ENAC/quadrotor/blender.xml @@ -17,7 +17,7 @@ - + diff --git a/conf/airframes/ENAC/quadrotor/booz2_g1.xml b/conf/airframes/ENAC/quadrotor/booz2_g1.xml index 5c546789044..4edc153027e 100644 --- a/conf/airframes/ENAC/quadrotor/booz2_g1.xml +++ b/conf/airframes/ENAC/quadrotor/booz2_g1.xml @@ -22,7 +22,7 @@ - + diff --git a/conf/airframes/ENAC/quadrotor/navgo.xml b/conf/airframes/ENAC/quadrotor/navgo.xml index 06f971bcc3c..3b64ce701ee 100644 --- a/conf/airframes/ENAC/quadrotor/navgo.xml +++ b/conf/airframes/ENAC/quadrotor/navgo.xml @@ -17,7 +17,7 @@ - + diff --git a/conf/airframes/Poine/booz2_a1.xml b/conf/airframes/Poine/booz2_a1.xml index 08ca88b9d5f..ea9b298445a 100644 --- a/conf/airframes/Poine/booz2_a1.xml +++ b/conf/airframes/Poine/booz2_a1.xml @@ -196,7 +196,7 @@ - + diff --git a/conf/airframes/Poine/booz2_a7.xml b/conf/airframes/Poine/booz2_a7.xml index 33ad581dfed..7d3d2db322b 100644 --- a/conf/airframes/Poine/booz2_a7.xml +++ b/conf/airframes/Poine/booz2_a7.xml @@ -220,7 +220,7 @@ - + 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 72a77e955ee..b455885d329 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 @@ -14,18 +14,17 @@ - - - - + + - + - + + @@ -84,13 +83,11 @@ -
-
@@ -268,7 +265,7 @@
- +
diff --git a/conf/airframes/TestHardware/LisaL_v1.1_b2_v1.2_rc.xml b/conf/airframes/TestHardware/LisaL_v1.1_b2_v1.2_rc.xml index da606215dd4..06c7642f920 100644 --- a/conf/airframes/TestHardware/LisaL_v1.1_b2_v1.2_rc.xml +++ b/conf/airframes/TestHardware/LisaL_v1.1_b2_v1.2_rc.xml @@ -8,23 +8,6 @@ GPS connected to UART1 (Since this is inside in a metal box it won't ever get a solution) --> - @@ -32,18 +15,17 @@ - - - - + + - + - + + diff --git a/conf/airframes/booz2_flixr.xml b/conf/airframes/booz2_flixr.xml index c8366f5b2fd..fe190c5893d 100644 --- a/conf/airframes/booz2_flixr.xml +++ b/conf/airframes/booz2_flixr.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/airframes/esden/lisa_asctec.xml b/conf/airframes/esden/lisa_asctec.xml index 2742f97266d..34b90eb86bf 100644 --- a/conf/airframes/esden/lisa_asctec.xml +++ b/conf/airframes/esden/lisa_asctec.xml @@ -183,18 +183,17 @@ - - - + - + + diff --git a/conf/airframes/esden/lisa_asctec_aspirin.xml b/conf/airframes/esden/lisa_asctec_aspirin.xml index 353d7794253..f8e702ef252 100644 --- a/conf/airframes/esden/lisa_asctec_aspirin.xml +++ b/conf/airframes/esden/lisa_asctec_aspirin.xml @@ -191,7 +191,7 @@ - + diff --git a/conf/airframes/esden/lisa_m_2_asp_2_pwm.xml b/conf/airframes/esden/lisa_m_2_asp_2_pwm.xml index 786b063e127..2b996d33c7f 100644 --- a/conf/airframes/esden/lisa_m_2_asp_2_pwm.xml +++ b/conf/airframes/esden/lisa_m_2_asp_2_pwm.xml @@ -39,13 +39,6 @@ - -
- - -
- -
@@ -187,19 +180,19 @@ - - - + - + + + diff --git a/conf/airframes/esden/lisa_m_pwm.xml b/conf/airframes/esden/lisa_m_pwm.xml index 4cb95d11fe6..c5d8181dc9c 100644 --- a/conf/airframes/esden/lisa_m_pwm.xml +++ b/conf/airframes/esden/lisa_m_pwm.xml @@ -30,13 +30,6 @@ - -
- - -
- -
@@ -206,19 +199,20 @@ - - - - + - + + + + + diff --git a/conf/airframes/esden/lisa_pwm_aspirin.xml b/conf/airframes/esden/lisa_pwm_aspirin.xml index 3367a225031..ba20f5f612f 100644 --- a/conf/airframes/esden/lisa_pwm_aspirin.xml +++ b/conf/airframes/esden/lisa_pwm_aspirin.xml @@ -192,7 +192,7 @@ - + diff --git a/conf/airframes/examples/booz2.xml b/conf/airframes/examples/booz2.xml index 08ca88b9d5f..1358e373ac2 100644 --- a/conf/airframes/examples/booz2.xml +++ b/conf/airframes/examples/booz2.xml @@ -14,12 +14,10 @@ -
-
@@ -196,7 +194,7 @@ - + diff --git a/conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml b/conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml index 0782b9d328f..3e6c0b3020c 100644 --- a/conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml +++ b/conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml @@ -7,6 +7,10 @@ + + + + @@ -174,6 +178,12 @@
+
+ + + +
+
diff --git a/conf/airframes/examples/quadrotor_lisa_m_mkk.xml b/conf/airframes/examples/quadrotor_lisa_m_mkk.xml index 606606bf5bf..5df1e1e91b8 100644 --- a/conf/airframes/examples/quadrotor_lisa_m_mkk.xml +++ b/conf/airframes/examples/quadrotor_lisa_m_mkk.xml @@ -8,7 +8,7 @@ - + @@ -171,7 +171,7 @@
- +
diff --git a/conf/airframes/fraser_lisa_m_rotorcraft.xml b/conf/airframes/fraser_lisa_m_rotorcraft.xml index 508b7f93429..74364564a8a 100644 --- a/conf/airframes/fraser_lisa_m_rotorcraft.xml +++ b/conf/airframes/fraser_lisa_m_rotorcraft.xml @@ -11,7 +11,7 @@ - + @@ -207,7 +207,7 @@
- +
diff --git a/conf/airframes/mm/rotor/qmk1.xml b/conf/airframes/mm/rotor/qmk1.xml index a764708ed50..7e68014115b 100644 --- a/conf/airframes/mm/rotor/qmk1.xml +++ b/conf/airframes/mm/rotor/qmk1.xml @@ -16,7 +16,6 @@ -
@@ -191,7 +190,7 @@ - + diff --git a/conf/airframes/mm/rotor/quadrotor_lisa_l_mkk.xml b/conf/airframes/mm/rotor/quadrotor_lisa_l_mkk.xml index 2a33d4606fd..9b6368bfea6 100644 --- a/conf/airframes/mm/rotor/quadrotor_lisa_l_mkk.xml +++ b/conf/airframes/mm/rotor/quadrotor_lisa_l_mkk.xml @@ -8,7 +8,7 @@ - + diff --git a/conf/airframes/mm/rotor/quadrotor_lisa_m_1_pwm.xml b/conf/airframes/mm/rotor/quadrotor_lisa_m_1_pwm.xml index 049f24cde74..5c82a07e1b5 100644 --- a/conf/airframes/mm/rotor/quadrotor_lisa_m_1_pwm.xml +++ b/conf/airframes/mm/rotor/quadrotor_lisa_m_1_pwm.xml @@ -4,16 +4,14 @@ - - - - - + - + + + @@ -41,13 +39,6 @@ - -
- - - -
-
diff --git a/conf/airframes/mm/rotor/quadrotor_lisa_m_2_pwm.xml b/conf/airframes/mm/rotor/quadrotor_lisa_m_2_pwm.xml index 60b9ba120cd..513331c1c28 100644 --- a/conf/airframes/mm/rotor/quadrotor_lisa_m_2_pwm.xml +++ b/conf/airframes/mm/rotor/quadrotor_lisa_m_2_pwm.xml @@ -4,15 +4,14 @@ - - - - + - + + + diff --git a/conf/firmwares/subsystems/rotorcraft/actuators_asctec.makefile b/conf/firmwares/subsystems/rotorcraft/actuators_asctec.makefile index 167ccc30682..d1d1c1137de 100644 --- a/conf/firmwares/subsystems/rotorcraft/actuators_asctec.makefile +++ b/conf/firmwares/subsystems/rotorcraft/actuators_asctec.makefile @@ -13,6 +13,6 @@ endif # Simulator -sim.srcs += $(SRC_FIRMWARE)/actuators/actuators_asctec.c -sim.CFLAGS += -DUSE_I2C0 -DACTUATORS_ASCTEC_DEVICE=i2c0 +nps.srcs += $(SRC_FIRMWARE)/actuators/actuators_asctec.c +nps.CFLAGS += -DUSE_I2C0 -DACTUATORS_ASCTEC_DEVICE=i2c0 diff --git a/conf/firmwares/subsystems/rotorcraft/actuators_asctec_v2.makefile b/conf/firmwares/subsystems/rotorcraft/actuators_asctec_v2.makefile index 6aa20bc4fc5..eaa8e486c8c 100644 --- a/conf/firmwares/subsystems/rotorcraft/actuators_asctec_v2.makefile +++ b/conf/firmwares/subsystems/rotorcraft/actuators_asctec_v2.makefile @@ -31,6 +31,6 @@ ap.CFLAGS += -DUSE_I2C1 endif # Simulator -sim.srcs += $(SRC_FIRMWARE)/actuators/supervision.c -sim.srcs += $(SRC_FIRMWARE)/actuators/actuators_asctec.c -sim.CFLAGS += -DUSE_I2C0 -DACTUATORS_ASCTEC_DEVICE=i2c0 +nps.srcs += $(SRC_FIRMWARE)/actuators/supervision.c +nps.srcs += $(SRC_FIRMWARE)/actuators/actuators_asctec.c +nps.CFLAGS += -DUSE_I2C0 -DACTUATORS_ASCTEC_DEVICE=i2c0 diff --git a/conf/firmwares/subsystems/rotorcraft/actuators_mkk.makefile b/conf/firmwares/subsystems/rotorcraft/actuators_mkk.makefile index 874c998a31b..440c947fd8b 100644 --- a/conf/firmwares/subsystems/rotorcraft/actuators_mkk.makefile +++ b/conf/firmwares/subsystems/rotorcraft/actuators_mkk.makefile @@ -52,6 +52,6 @@ ap.CFLAGS += -DUSE_I2C1 endif # Simulator -sim.srcs += $(SRC_FIRMWARE)/actuators/supervision.c -sim.srcs += $(SRC_FIRMWARE)/actuators/actuators_mkk.c -sim.CFLAGS += -DUSE_I2C0 -DACTUATORS_MKK_DEVICE=i2c0 +nps.srcs += $(SRC_FIRMWARE)/actuators/supervision.c +nps.srcs += $(SRC_FIRMWARE)/actuators/actuators_mkk.c +nps.CFLAGS += -DUSE_I2C0 -DACTUATORS_MKK_DEVICE=i2c0 diff --git a/conf/firmwares/subsystems/rotorcraft/actuators_pwm_supervision.makefile b/conf/firmwares/subsystems/rotorcraft/actuators_pwm_supervision.makefile index d092a2ff9a8..0a20b316885 100644 --- a/conf/firmwares/subsystems/rotorcraft/actuators_pwm_supervision.makefile +++ b/conf/firmwares/subsystems/rotorcraft/actuators_pwm_supervision.makefile @@ -7,6 +7,6 @@ ap.srcs += $(SRC_FIRMWARE)/actuators/actuators_pwm_supervision.c ap.srcs += $(SRC_FIRMWARE)/actuators/arch/$(ARCH)/actuators_pwm_arch.c # Simulator -sim.srcs += $(SRC_FIRMWARE)/actuators/supervision.c -sim.srcs += $(SRC_FIRMWARE)/actuators/actuators_pwm_supervision.c -sim.srcs += $(SRC_FIRMWARE)/actuators/arch/$(ARCH)/actuators_pwm_arch.c +nps.srcs += $(SRC_FIRMWARE)/actuators/supervision.c +nps.srcs += $(SRC_FIRMWARE)/actuators/actuators_pwm_supervision.c +nps.srcs += $(SRC_FIRMWARE)/actuators/arch/$(ARCH)/actuators_pwm_arch.c diff --git a/conf/firmwares/subsystems/rotorcraft/actuators_skiron.makefile b/conf/firmwares/subsystems/rotorcraft/actuators_skiron.makefile index b46487f8759..6365fbbfbb2 100644 --- a/conf/firmwares/subsystems/rotorcraft/actuators_skiron.makefile +++ b/conf/firmwares/subsystems/rotorcraft/actuators_skiron.makefile @@ -47,7 +47,7 @@ ap.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=$(SKIRON_I2C_SCL_TIME) -DI2C0_SCLH=$(SKIRON_ endif # Simulator -sim.srcs += $(SRC_FIRMWARE)/actuators/supervision.c -sim.srcs += $(SRC_FIRMWARE)/actuators/actuators_skiron.c -sim.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=$(SKIRON_I2C_SCL_TIME) -DI2C0_SCLH=$(SKIRON_I2C_SCL_TIME) -DI2C0_VIC_SLOT=10 -DACTUATORS_MKK_DEVICE=i2c0 +nps.srcs += $(SRC_FIRMWARE)/actuators/supervision.c +nps.srcs += $(SRC_FIRMWARE)/actuators/actuators_skiron.c +nps.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=$(SKIRON_I2C_SCL_TIME) -DI2C0_SCLH=$(SKIRON_I2C_SCL_TIME) -DI2C0_VIC_SLOT=10 -DACTUATORS_MKK_DEVICE=i2c0 diff --git a/conf/firmwares/subsystems/rotorcraft/ahrs_float_cmpl_quat.makefile b/conf/firmwares/subsystems/rotorcraft/ahrs_float_cmpl_quat.makefile index 2b1c2f6ef37..b3d9af5c68c 100644 --- a/conf/firmwares/subsystems/rotorcraft/ahrs_float_cmpl_quat.makefile +++ b/conf/firmwares/subsystems/rotorcraft/ahrs_float_cmpl_quat.makefile @@ -30,5 +30,5 @@ AHRS_SRCS += subsystems/ahrs/ahrs_aligner.c ap.CFLAGS += $(AHRS_CFLAGS) ap.srcs += $(AHRS_SRCS) -sim.CFLAGS += $(AHRS_CFLAGS) -sim.srcs += $(AHRS_SRCS) +nps.CFLAGS += $(AHRS_CFLAGS) +nps.srcs += $(AHRS_SRCS) diff --git a/conf/firmwares/subsystems/rotorcraft/ahrs_float_cmpl_rmat.makefile b/conf/firmwares/subsystems/rotorcraft/ahrs_float_cmpl_rmat.makefile index 96d668d3460..3a240cc2af3 100644 --- a/conf/firmwares/subsystems/rotorcraft/ahrs_float_cmpl_rmat.makefile +++ b/conf/firmwares/subsystems/rotorcraft/ahrs_float_cmpl_rmat.makefile @@ -30,5 +30,5 @@ AHRS_SRCS += subsystems/ahrs/ahrs_aligner.c ap.CFLAGS += $(AHRS_CFLAGS) ap.srcs += $(AHRS_SRCS) -sim.CFLAGS += $(AHRS_CFLAGS) -sim.srcs += $(AHRS_SRCS) +nps.CFLAGS += $(AHRS_CFLAGS) +nps.srcs += $(AHRS_SRCS) diff --git a/conf/firmwares/subsystems/rotorcraft/ahrs_int_cmpl_euler.makefile b/conf/firmwares/subsystems/rotorcraft/ahrs_int_cmpl_euler.makefile index f5d6fca89a3..2be240c0b04 100644 --- a/conf/firmwares/subsystems/rotorcraft/ahrs_int_cmpl_euler.makefile +++ b/conf/firmwares/subsystems/rotorcraft/ahrs_int_cmpl_euler.makefile @@ -26,5 +26,5 @@ AHRS_SRCS += subsystems/ahrs/ahrs_aligner.c ap.CFLAGS += $(AHRS_CFLAGS) ap.srcs += $(AHRS_SRCS) -sim.CFLAGS += $(AHRS_CFLAGS) -sim.srcs += $(AHRS_SRCS) +nps.CFLAGS += $(AHRS_CFLAGS) +nps.srcs += $(AHRS_SRCS) diff --git a/conf/firmwares/subsystems/rotorcraft/ahrs_int_cmpl_quat.makefile b/conf/firmwares/subsystems/rotorcraft/ahrs_int_cmpl_quat.makefile index 6db584eb6ab..1325776ead1 100644 --- a/conf/firmwares/subsystems/rotorcraft/ahrs_int_cmpl_quat.makefile +++ b/conf/firmwares/subsystems/rotorcraft/ahrs_int_cmpl_quat.makefile @@ -29,5 +29,5 @@ AHRS_SRCS += subsystems/ahrs/ahrs_aligner.c ap.CFLAGS += $(AHRS_CFLAGS) ap.srcs += $(AHRS_SRCS) -sim.CFLAGS += $(AHRS_CFLAGS) -sim.srcs += $(AHRS_SRCS) +nps.CFLAGS += $(AHRS_CFLAGS) +nps.srcs += $(AHRS_SRCS) diff --git a/conf/firmwares/subsystems/rotorcraft/ahrs_lkf.makefile b/conf/firmwares/subsystems/rotorcraft/ahrs_lkf.makefile index 0d580e6e560..2c942a23cf0 100644 --- a/conf/firmwares/subsystems/rotorcraft/ahrs_lkf.makefile +++ b/conf/firmwares/subsystems/rotorcraft/ahrs_lkf.makefile @@ -7,7 +7,7 @@ ap.srcs += $(SRC_SUBSYSTEMS)/ahrs.c ap.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_aligner.c ap.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_float_lkf.c -sim.CFLAGS += -DUSE_AHRS_LKF -DAHRS_ALIGNER_LED=$(AHRS_ALIGNER_LED) -sim.srcs += $(SRC_SUBSYSTEMS)/ahrs.c -sim.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_aligner.c -sim.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_float_lkf.c +nps.CFLAGS += -DUSE_AHRS_LKF -DAHRS_ALIGNER_LED=$(AHRS_ALIGNER_LED) +nps.srcs += $(SRC_SUBSYSTEMS)/ahrs.c +nps.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_aligner.c +nps.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_float_lkf.c diff --git a/conf/firmwares/subsystems/rotorcraft/ahrs_mlkf.makefile b/conf/firmwares/subsystems/rotorcraft/ahrs_mlkf.makefile index 1410a9913ba..b9ff3b07018 100644 --- a/conf/firmwares/subsystems/rotorcraft/ahrs_mlkf.makefile +++ b/conf/firmwares/subsystems/rotorcraft/ahrs_mlkf.makefile @@ -8,9 +8,9 @@ ap.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_aligner.c ap.srcs += $(SRC_BOOZ_PRIV)/ahrs/booz_ahrs_mlkf.c ap.srcs += $(SRC_BOOZ_PRIV)/ahrs/booz_ahrs_opt.c -sim.CFLAGS += -I$(SRC_BOOZ_PRIV) -sim.CFLAGS += -DAHRS_ALIGNER_LED=3 -sim.srcs += $(SRC_SUBSYSTEMS)/ahrs.c -sim.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_aligner.c -sim.srcs += $(SRC_BOOZ_PRIV)/ahrs/booz_ahrs_mlkf.c -sim.srcs += $(SRC_BOOZ_PRIV)/ahrs/booz_ahrs_mlkf_opt.c +nps.CFLAGS += -I$(SRC_BOOZ_PRIV) +nps.CFLAGS += -DAHRS_ALIGNER_LED=3 +nps.srcs += $(SRC_SUBSYSTEMS)/ahrs.c +nps.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_aligner.c +nps.srcs += $(SRC_BOOZ_PRIV)/ahrs/booz_ahrs_mlkf.c +nps.srcs += $(SRC_BOOZ_PRIV)/ahrs/booz_ahrs_mlkf_opt.c diff --git a/conf/firmwares/subsystems/rotorcraft/fdm_nps.makefile b/conf/firmwares/subsystems/rotorcraft/fdm_nps.makefile index 169d0ee8c34..cf819b28532 100644 --- a/conf/firmwares/subsystems/rotorcraft/fdm_nps.makefile +++ b/conf/firmwares/subsystems/rotorcraft/fdm_nps.makefile @@ -17,28 +17,28 @@ SRC_BOARD=boards/$(BOARD) NPSDIR = $(SIMDIR)/nps -sim.ARCHDIR = $(ARCH) +nps.ARCHDIR = sim -sim.CFLAGS += -DSITL -DUSE_NPS -sim.CFLAGS += `pkg-config glib-2.0 --cflags` -sim.LDFLAGS += `pkg-config glib-2.0 --libs` -lm -lglibivy -lgsl -lgslcblas -sim.CFLAGS += -I$(NPSDIR) -I$(SRC_FIRMWARE) -I$(SRC_BOARD) -I../simulator -I$(PAPARAZZI_HOME)/conf/simulator/nps +nps.CFLAGS += -DSITL -DUSE_NPS +nps.CFLAGS += `pkg-config glib-2.0 --cflags` +nps.LDFLAGS += `pkg-config glib-2.0 --libs` -lm -lglibivy -lgsl -lgslcblas +nps.CFLAGS += -I$(NPSDIR) -I$(SRC_FIRMWARE) -I$(SRC_BOARD) -I../simulator -I$(PAPARAZZI_HOME)/conf/simulator/nps # use the paparazzi-jsbsim package if it is installed, otherwise look for JSBsim under /opt/jsbsim ifndef JSBSIM_PKG JSBSIM_PKG = $(shell pkg-config JSBSim --exists && echo 'yes') endif ifeq ($(JSBSIM_PKG), yes) - sim.CFLAGS += `pkg-config JSBSim --cflags` - sim.LDFLAGS += `pkg-config JSBSim --libs` + nps.CFLAGS += `pkg-config JSBSim --cflags` + nps.LDFLAGS += `pkg-config JSBSim --libs` else JSBSIM_PKG = no - sim.CFLAGS += -I$(JSBSIM_INC) - sim.LDFLAGS += -L$(JSBSIM_LIB) -lJSBSim + nps.CFLAGS += -I$(JSBSIM_INC) + nps.LDFLAGS += -L$(JSBSIM_LIB) -lJSBSim endif -sim.srcs += $(NPSDIR)/nps_main.c \ +nps.srcs += $(NPSDIR)/nps_main.c \ $(NPSDIR)/nps_fdm_jsbsim.c \ $(NPSDIR)/nps_random.c \ $(NPSDIR)/nps_sensors.c \ @@ -57,53 +57,53 @@ sim.srcs += $(NPSDIR)/nps_main.c \ -sim.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) +nps.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -sim.srcs += firmwares/rotorcraft/main.c -sim.srcs += mcu.c -sim.srcs += $(SRC_ARCH)/mcu_arch.c +nps.srcs += firmwares/rotorcraft/main.c +nps.srcs += mcu.c +nps.srcs += $(SRC_ARCH)/mcu_arch.c -ifeq ($(TARGET), sim) +ifeq ($(TARGET), nps) include $(CFG_SHARED)/i2c_select.makefile endif -sim.CFLAGS += -DPERIODIC_FREQUENCY=512 -#sim.CFLAGS += -DUSE_LED -sim.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c +nps.CFLAGS += -DPERIODIC_FREQUENCY=512 +#nps.CFLAGS += -DUSE_LED +nps.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c -sim.srcs += subsystems/settings.c -sim.srcs += $(SRC_ARCH)/subsystems/settings_arch.c +nps.srcs += subsystems/settings.c +nps.srcs += $(SRC_ARCH)/subsystems/settings_arch.c -sim.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport -sim.srcs += $(SRC_FIRMWARE)/telemetry.c \ +nps.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport +nps.srcs += $(SRC_FIRMWARE)/telemetry.c \ subsystems/datalink/downlink.c \ $(SRC_ARCH)/ivy_transport.c -sim.srcs += $(SRC_FIRMWARE)/commands.c +nps.srcs += $(SRC_FIRMWARE)/commands.c -sim.srcs += $(SRC_FIRMWARE)/datalink.c +nps.srcs += $(SRC_FIRMWARE)/datalink.c # # Math functions # -sim.srcs += math/pprz_geodetic_int.c math/pprz_geodetic_float.c math/pprz_geodetic_double.c math/pprz_trig_int.c +nps.srcs += math/pprz_geodetic_int.c math/pprz_geodetic_float.c math/pprz_geodetic_double.c math/pprz_trig_int.c -sim.CFLAGS += -DROTORCRAFT_BARO_LED=2 -sim.srcs += $(SRC_BOARD)/baro_board.c +nps.CFLAGS += -DROTORCRAFT_BARO_LED=2 +nps.srcs += $(SRC_BOARD)/baro_board.c -sim.CFLAGS += -DUSE_ADC -sim.srcs += $(SRC_ARCH)/mcu_periph/adc_arch.c -sim.srcs += subsystems/electrical.c +nps.CFLAGS += -DUSE_ADC +nps.srcs += $(SRC_ARCH)/mcu_periph/adc_arch.c +nps.srcs += subsystems/electrical.c # baro has variable offset amplifier on booz board -#sim.CFLAGS += -DUSE_DAC -#sim.srcs += $(SRC_ARCH)/mcu_periph/dac_arch.c +#nps.CFLAGS += -DUSE_DAC +#nps.srcs += $(SRC_ARCH)/mcu_periph/dac_arch.c -#sim.CFLAGS += -DIMU_TYPE_H=\"imu/imu_b2.h\" -#sim.CFLAGS += -DIMU_B2_VERSION_1_1 +#nps.CFLAGS += -DIMU_TYPE_H=\"imu/imu_b2.h\" +#nps.CFLAGS += -DIMU_B2_VERSION_1_1 -sim.srcs += $(SRC_FIRMWARE)/autopilot.c +nps.srcs += $(SRC_FIRMWARE)/autopilot.c # # in makefile section of airframe xml @@ -112,9 +112,9 @@ sim.srcs += $(SRC_FIRMWARE)/autopilot.c # include $(CFG_BOOZ)/subsystems/booz2_ahrs_cmpl.makefile # -sim.srcs += $(SRC_FIRMWARE)/stabilization.c -sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_rate.c -sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_none.c +nps.srcs += $(SRC_FIRMWARE)/stabilization.c +nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_rate.c +nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_none.c NUM_TYPE=integer @@ -124,39 +124,39 @@ STAB_TYPE=euler #STAB_TYPE=quaternion ifeq ($(NUM_TYPE), integer) - sim.CFLAGS += -DSTABILISATION_ATTITUDE_TYPE_INT - sim.CFLAGS += -DSTABILISATION_ATTITUDE_H=\"stabilization/stabilization_attitude_int.h\" + nps.CFLAGS += -DSTABILISATION_ATTITUDE_TYPE_INT + nps.CFLAGS += -DSTABILISATION_ATTITUDE_H=\"stabilization/stabilization_attitude_int.h\" ifeq ($(STAB_TYPE), euler) - sim.CFLAGS += -DSTABILISATION_ATTITUDE_REF_H=\"stabilization/stabilization_attitude_ref_euler_int.h\" - sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_ref_euler_int.c - sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_euler_int.c + nps.CFLAGS += -DSTABILISATION_ATTITUDE_REF_H=\"stabilization/stabilization_attitude_ref_euler_int.h\" + nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_ref_euler_int.c + nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_euler_int.c else ifeq ($(STAB_TYPE), quaternion) - sim.CFLAGS += -DSTABILISATION_ATTITUDE_REF_H=\"stabilization/stabilization_attitude_ref_quat_int.h\" - sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_ref_quat_int.c - sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_quat_int.c + nps.CFLAGS += -DSTABILISATION_ATTITUDE_REF_H=\"stabilization/stabilization_attitude_ref_quat_int.h\" + nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_ref_quat_int.c + nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_quat_int.c endif else ifeq ($(NUM_TYPE), float) - sim.CFLAGS += -DSTABILISATION_ATTITUDE_TYPE_FLOAT - sim.CFLAGS += -DSTABILISATION_ATTITUDE_H=\"stabilization/stabilization_attitude_float.h\" + nps.CFLAGS += -DSTABILISATION_ATTITUDE_TYPE_FLOAT + nps.CFLAGS += -DSTABILISATION_ATTITUDE_H=\"stabilization/stabilization_attitude_float.h\" ifeq ($(STAB_TYPE), euler) - sim.CFLAGS += -DSTABILISATION_ATTITUDE_REF_H=\"stabilization/stabilization_attitude_ref_euler_float.h\" - sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_ref_euler_float.c - sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_euler_float.c + nps.CFLAGS += -DSTABILISATION_ATTITUDE_REF_H=\"stabilization/stabilization_attitude_ref_euler_float.h\" + nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_ref_euler_float.c + nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_euler_float.c else ifeq ($(STAB_TYPE), quaternion) - sim.CFLAGS += -DSTABILISATION_ATTITUDE_REF_H=\"stabilization/stabilization_attitude_ref_quat_float.h\" - sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_ref_quat_float.c - sim.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_quat_float.c + nps.CFLAGS += -DSTABILISATION_ATTITUDE_REF_H=\"stabilization/stabilization_attitude_ref_quat_float.h\" + nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_ref_quat_float.c + nps.srcs += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_quat_float.c endif endif -sim.CFLAGS += -DUSE_NAVIGATION -sim.srcs += $(SRC_FIRMWARE)/guidance/guidance_h.c -sim.srcs += $(SRC_FIRMWARE)/guidance/guidance_v.c -sim.srcs += $(SRC_SUBSYSTEMS)/ins.c +nps.CFLAGS += -DUSE_NAVIGATION +nps.srcs += $(SRC_FIRMWARE)/guidance/guidance_h.c +nps.srcs += $(SRC_FIRMWARE)/guidance/guidance_v.c +nps.srcs += $(SRC_SUBSYSTEMS)/ins.c # vertical filter float version -sim.srcs += $(SRC_SUBSYSTEMS)/ins/vf_float.c -sim.CFLAGS += -DUSE_VFF -DDT_VFILTER='(1./512.)' +nps.srcs += $(SRC_SUBSYSTEMS)/ins/vf_float.c +nps.CFLAGS += -DUSE_VFF -DDT_VFILTER='(1./512.)' # # INS choice @@ -167,5 +167,5 @@ sim.CFLAGS += -DUSE_VFF -DDT_VFILTER='(1./512.)' # -sim.srcs += $(SRC_FIRMWARE)/navigation.c -sim.srcs += $(SRC_SUBSYSTEMS)/navigation/common_flight_plan.c +nps.srcs += $(SRC_FIRMWARE)/navigation.c +nps.srcs += $(SRC_SUBSYSTEMS)/navigation/common_flight_plan.c diff --git a/conf/firmwares/subsystems/rotorcraft/gps_nmea.makefile b/conf/firmwares/subsystems/rotorcraft/gps_nmea.makefile index 766b4d00ffe..f90c2aa2bd3 100644 --- a/conf/firmwares/subsystems/rotorcraft/gps_nmea.makefile +++ b/conf/firmwares/subsystems/rotorcraft/gps_nmea.makefile @@ -17,7 +17,7 @@ ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_nmea.c $(TARGET).srcs += $(SRC_SUBSYSTEMS)/gps.c -sim.CFLAGS += -DUSE_GPS -sim.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim.h\" -sim.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c +nps.CFLAGS += -DUSE_GPS +nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim.h\" +nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c diff --git a/conf/firmwares/subsystems/rotorcraft/gps_skytraq.makefile b/conf/firmwares/subsystems/rotorcraft/gps_skytraq.makefile index 9d4560cfcea..57ee37fb205 100644 --- a/conf/firmwares/subsystems/rotorcraft/gps_skytraq.makefile +++ b/conf/firmwares/subsystems/rotorcraft/gps_skytraq.makefile @@ -14,5 +14,5 @@ ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_skytraq.h\" ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_skytraq.c -sim.CFLAGS += -DUSE_GPS -sim.srcs += $(SRC_SUBSYSTEMS)/gps.c +nps.CFLAGS += -DUSE_GPS +nps.srcs += $(SRC_SUBSYSTEMS)/gps.c diff --git a/conf/firmwares/subsystems/rotorcraft/gps_ublox.makefile b/conf/firmwares/subsystems/rotorcraft/gps_ublox.makefile index c875eebb7f0..c99d67ba375 100644 --- a/conf/firmwares/subsystems/rotorcraft/gps_ublox.makefile +++ b/conf/firmwares/subsystems/rotorcraft/gps_ublox.makefile @@ -11,7 +11,7 @@ ifneq ($(GPS_LED),none) ap.CFLAGS += -DGPS_LED=$(GPS_LED) endif -sim.CFLAGS += -DUSE_GPS -sim.srcs += $(SRC_SUBSYSTEMS)/gps.c -sim.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" -sim.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c +nps.CFLAGS += -DUSE_GPS +nps.srcs += $(SRC_SUBSYSTEMS)/gps.c +nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\" +nps.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim_nps.c diff --git a/conf/firmwares/subsystems/rotorcraft/imu_crista.makefile b/conf/firmwares/subsystems/rotorcraft/imu_crista.makefile index aa1dfb9cc95..14f275b05c2 100644 --- a/conf/firmwares/subsystems/rotorcraft/imu_crista.makefile +++ b/conf/firmwares/subsystems/rotorcraft/imu_crista.makefile @@ -83,12 +83,4 @@ ap.srcs += $(imu_srcs) # # Simulator # - -sim.CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_crista.h\" -sim.srcs += $(SRC_SUBSYSTEMS)/imu.c -sim.srcs += $(SRC_SUBSYSTEMS)/imu/imu_crista.c -sim.srcs += $(SRC_ARCH)/subsystems/imu/imu_crista_arch.c - -sim.CFLAGS += -DUSE_AMI601 -sim.srcs += peripherals/ami601.c -sim.CFLAGS += -DUSE_I2C1 +include $(CFG_SHARED)/imu_nps.makefile diff --git a/conf/firmwares/subsystems/rotorcraft/imu_crista_hmc5843.makefile b/conf/firmwares/subsystems/rotorcraft/imu_crista_hmc5843.makefile index 9a5faee8fd1..e4bb57a2f55 100644 --- a/conf/firmwares/subsystems/rotorcraft/imu_crista_hmc5843.makefile +++ b/conf/firmwares/subsystems/rotorcraft/imu_crista_hmc5843.makefile @@ -84,12 +84,4 @@ ap.srcs += $(imu_srcs) # # Simulator # - -sim.CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_crista.h\" -sim.srcs += $(SRC_SUBSYSTEMS)/imu.c -sim.srcs += $(SRC_SUBSYSTEMS)/imu/imu_crista.c -sim.srcs += $(SRC_ARCH)/subsystems/imu/imu_crista_arch.c - -sim.CFLAGS += -DUSE_AMI601 -sim.srcs += peripherals/ami601.c -sim.CFLAGS += -DUSE_I2C1 +include $(CFG_SHARED)/imu_nps.makefile diff --git a/conf/firmwares/subsystems/shared/imu_aspirin_common.makefile b/conf/firmwares/subsystems/shared/imu_aspirin_common.makefile index a0341516a78..1abf49f628e 100644 --- a/conf/firmwares/subsystems/shared/imu_aspirin_common.makefile +++ b/conf/firmwares/subsystems/shared/imu_aspirin_common.makefile @@ -2,26 +2,12 @@ # # Common part for all Aspirin IMUs # +# if ACCEL and GYRO SENS/NEUTRAL are not defined, +# the defaults from the datasheet will be used # # required xml: #
# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# # # # @@ -34,8 +20,6 @@ # # -# imu aspirin - # for fixedwing firmware and ap only ifeq ($(TARGET), ap) IMU_ASPIRIN_CFLAGS = -DUSE_IMU @@ -60,5 +44,4 @@ IMU_ASPIRIN_CFLAGS += -DUSE_EXTI2_IRQ # Accel Int on PD2 IMU_ASPIRIN_CFLAGS += -DUSE_DMA1_C4_IRQ # SPI2 Rx DMA endif -sim.CFLAGS += $(IMU_ASPIRIN_CFLAGS) -DHMC5843_NO_IRQ -sim.srcs += $(IMU_ASPIRIN_SRCS) +include $(CFG_SHARED)/imu_nps.makefile diff --git a/conf/firmwares/subsystems/shared/imu_aspirin_v1.0.makefile b/conf/firmwares/subsystems/shared/imu_aspirin_v1.0.makefile index 3e2e8a7c266..d58fbb5a0e1 100644 --- a/conf/firmwares/subsystems/shared/imu_aspirin_v1.0.makefile +++ b/conf/firmwares/subsystems/shared/imu_aspirin_v1.0.makefile @@ -3,25 +3,12 @@ # Aspirin IMU v1.0 # # +# if ACCEL and GYRO SENS/NEUTRAL are not defined, +# the defaults from the datasheet will be used +# # required xml: #
# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# # # # @@ -32,9 +19,6 @@ # #
# -# - -# imu aspirin include $(CFG_SHARED)/imu_aspirin_common.makefile diff --git a/conf/firmwares/subsystems/shared/imu_aspirin_v1.5.makefile b/conf/firmwares/subsystems/shared/imu_aspirin_v1.5.makefile index 2686e949054..6be651292cf 100644 --- a/conf/firmwares/subsystems/shared/imu_aspirin_v1.5.makefile +++ b/conf/firmwares/subsystems/shared/imu_aspirin_v1.5.makefile @@ -3,25 +3,12 @@ # Aspirin IMU v1.5 # # +# if ACCEL and GYRO SENS/NEUTRAL are not defined, +# the defaults from the datasheet will be used +# # required xml: #
# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# # # # @@ -32,9 +19,6 @@ # #
# -# - -# imu aspirin include $(CFG_SHARED)/imu_aspirin_common.makefile diff --git a/conf/firmwares/subsystems/shared/imu_aspirin_v2.1.makefile b/conf/firmwares/subsystems/shared/imu_aspirin_v2.1.makefile index 338aee380a6..aea2834ac48 100644 --- a/conf/firmwares/subsystems/shared/imu_aspirin_v2.1.makefile +++ b/conf/firmwares/subsystems/shared/imu_aspirin_v2.1.makefile @@ -1,30 +1,32 @@ # Hey Emacs, this is a -*- makefile -*- # -# Aspirin IMU v2.0 +# Aspirin IMU v2.1 # # # required xml: #
# -# -# -# +# +# +# +# # -# -# -# +# +# +# # -# -# -# +# +# +# # -# -# -# +# +# +# # -# -# -# +# +# +# +# # # # @@ -34,13 +36,11 @@ # # -# imu aspirin IMU_ASPIRIN_CFLAGS = -DUSE_IMU IMU_ASPIRIN_CFLAGS += -DIMU_TYPE_H=\"imu/imu_aspirin2.h\" -DIMU_OVERRIDE_CHANNELS IMU_ASPIRIN_SRCS = $(SRC_SUBSYSTEMS)/imu.c \ $(SRC_SUBSYSTEMS)/imu/imu_aspirin2.c \ - $(SRC_ARCH)/subsystems/imu/imu_aspirin2_arch.c \ $(SRC_ARCH)/mcu_periph/spi_arch.c \ mcu_periph/spi.c @@ -48,9 +48,8 @@ IMU_ASPIRIN_CFLAGS += -DUSE_SPI -DSPI_MASTER ifeq ($(ARCH), lpc21) #TODO -$(error Not implemented for the LCP21x yet. Not hard, just needs to be done. Patches welcome!) +$(error Not implemented for the LCP21x yet. Needs the new SPI mcu_periph. See issue 147!) else ifeq ($(ARCH), stm32) -# IMU_ASPIRIN_CFLAGS += -DUSE_EXTI15_10_IRQ # Gyro Int on PC14 IMU_ASPIRIN_CFLAGS += -DUSE_DMA1_C4_IRQ # SPI2 Rx DMA IMU_ASPIRIN_CFLAGS += -DUSE_SPI2 endif @@ -63,5 +62,7 @@ IMU_ASPIRIN_CFLAGS += -DIMU_ASPIRIN_VERSION_2_1 ap.CFLAGS += $(IMU_ASPIRIN_CFLAGS) ap.srcs += $(IMU_ASPIRIN_SRCS) -sim.CFLAGS += $(IMU_ASPIRIN_CFLAGS) -sim.srcs += $(IMU_ASPIRIN_SRCS) +# +# NPS simulator +# +include $(CFG_SHARED)/imu_nps.makefile diff --git a/conf/firmwares/subsystems/shared/imu_b2_common.makefile b/conf/firmwares/subsystems/shared/imu_b2_common.makefile index a9c22832b70..17040309790 100644 --- a/conf/firmwares/subsystems/shared/imu_b2_common.makefile +++ b/conf/firmwares/subsystems/shared/imu_b2_common.makefile @@ -65,17 +65,18 @@ endif # # Simulator # +include $(CFG_SHARED)/imu_nps.makefile -sim.CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_b2.h\" -sim.CFLAGS += -DIMU_B2_MAG_TYPE=IMU_B2_MAG_AMI601 -sim.CFLAGS += -DIMU_B2_VERSION_1_0 -sim.srcs += $(SRC_SUBSYSTEMS)/imu.c -sim.srcs += $(SRC_SUBSYSTEMS)/imu/imu_b2.c +#sim.CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_b2.h\" +#sim.CFLAGS += -DIMU_B2_MAG_TYPE=IMU_B2_MAG_AMI601 +#sim.CFLAGS += -DIMU_B2_VERSION_1_0 +#sim.srcs += $(SRC_SUBSYSTEMS)/imu.c +#sim.srcs += $(SRC_SUBSYSTEMS)/imu/imu_b2.c #sim.srcs += $(SRC_ARCH)/subsystems/imu/imu_b2_arch.c - -sim.srcs += peripherals/max1168.c -sim.srcs += $(SRC_ARCH)/peripherals/max1168_arch.c - -sim.CFLAGS += -DUSE_AMI601 -sim.srcs += peripherals/ami601.c -sim.CFLAGS += -DUSE_I2C1 +# +#sim.srcs += peripherals/max1168.c +#sim.srcs += $(SRC_ARCH)/peripherals/max1168_arch.c +# +#sim.CFLAGS += -DUSE_AMI601 +#sim.srcs += peripherals/ami601.c +#sim.CFLAGS += -DUSE_I2C1 diff --git a/conf/firmwares/subsystems/shared/imu_nps.makefile b/conf/firmwares/subsystems/shared/imu_nps.makefile new file mode 100644 index 00000000000..e26d035cd44 --- /dev/null +++ b/conf/firmwares/subsystems/shared/imu_nps.makefile @@ -0,0 +1,24 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# simulated IMU for NPS (NewPaparazziSim) +# +# If ACCEL and GYRO SENS/NEUTRAL are not defined, +# the defaults of aspirin v1.5 are used. +# This fits the nps_sensors_params_default.h +# +# required xml: +#
+# +# +# +# +# +# +# +# +# +#
+# + +nps.CFLAGS += -DIMU_TYPE_H=\"imu/imu_nps.h\" +nps.srcs += $(SRC_SUBSYSTEMS)/imu.c $(SRC_SUBSYSTEMS)/imu/imu_nps.c diff --git a/conf/simulator/nps/nps_sensors_params_default.h b/conf/simulator/nps/nps_sensors_params_default.h new file mode 100644 index 00000000000..1874378859c --- /dev/null +++ b/conf/simulator/nps/nps_sensors_params_default.h @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2012 Felix Ruess + * + * 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. + */ + +#ifndef NPS_SENSORS_PARAMS_H +#define NPS_SENSORS_PARAMS_H + +#include "generated/airframe.h" +#include "subsystems/imu.h" + + +#define NPS_BODY_TO_IMU_PHI IMU_BODY_TO_IMU_PHI +#define NPS_BODY_TO_IMU_THETA IMU_BODY_TO_IMU_THETA +#define NPS_BODY_TO_IMU_PSI IMU_BODY_TO_IMU_PSI + +/* + * Accelerometer + */ +/* ADXL345 configured to +-16g with 13bit resolution */ +#define NPS_ACCEL_MIN -4095 +#define NPS_ACCEL_MAX 4095 +/* ms-2 */ +/* aka 2^10/ACCEL_X_SENS */ +#define NPS_ACCEL_SENSITIVITY_XX ACCEL_BFP_OF_REAL(1./IMU_ACCEL_X_SENS) +#define NPS_ACCEL_SENSITIVITY_YY ACCEL_BFP_OF_REAL(1./IMU_ACCEL_Y_SENS) +#define NPS_ACCEL_SENSITIVITY_ZZ ACCEL_BFP_OF_REAL(1./IMU_ACCEL_Z_SENS) + +#define NPS_ACCEL_NEUTRAL_X IMU_ACCEL_X_NEUTRAL +#define NPS_ACCEL_NEUTRAL_Y IMU_ACCEL_Y_NEUTRAL +#define NPS_ACCEL_NEUTRAL_Z IMU_ACCEL_Z_NEUTRAL +/* m2s-4 */ +#define NPS_ACCEL_NOISE_STD_DEV_X 5.e-2 +#define NPS_ACCEL_NOISE_STD_DEV_Y 5.e-2 +#define NPS_ACCEL_NOISE_STD_DEV_Z 5.e-2 +/* ms-2 */ +#define NPS_ACCEL_BIAS_X 0 +#define NPS_ACCEL_BIAS_Y 0 +#define NPS_ACCEL_BIAS_Z 0 +/* s */ +#define NPS_ACCEL_DT (1./512.) + + + +/* + * Gyrometer + */ +/* IMU-3000 has 16 bit resolution */ +#define NPS_GYRO_MIN -32767 +#define NPS_GYRO_MAX 32767 + +/* 2^12/GYRO_X_SENS */ +#define NPS_GYRO_SENSITIVITY_PP RATE_BFP_OF_REAL(1./IMU_GYRO_P_SENS) +#define NPS_GYRO_SENSITIVITY_QQ RATE_BFP_OF_REAL(1./IMU_GYRO_Q_SENS) +#define NPS_GYRO_SENSITIVITY_RR RATE_BFP_OF_REAL(1./IMU_GYRO_R_SENS) + +#define NPS_GYRO_NEUTRAL_P IMU_GYRO_P_NEUTRAL +#define NPS_GYRO_NEUTRAL_Q IMU_GYRO_Q_NEUTRAL +#define NPS_GYRO_NEUTRAL_R IMU_GYRO_R_NEUTRAL + +#define NPS_GYRO_NOISE_STD_DEV_P RadOfDeg(0.) +#define NPS_GYRO_NOISE_STD_DEV_Q RadOfDeg(0.) +#define NPS_GYRO_NOISE_STD_DEV_R RadOfDeg(0.) + +#define NPS_GYRO_BIAS_INITIAL_P RadOfDeg( 0.0) +#define NPS_GYRO_BIAS_INITIAL_Q RadOfDeg( 0.0) +#define NPS_GYRO_BIAS_INITIAL_R RadOfDeg( 0.0) + +#define NPS_GYRO_BIAS_RANDOM_WALK_STD_DEV_P RadOfDeg(0.5) +#define NPS_GYRO_BIAS_RANDOM_WALK_STD_DEV_Q RadOfDeg(0.5) +#define NPS_GYRO_BIAS_RANDOM_WALK_STD_DEV_R RadOfDeg(0.5) +/* s */ +#define NPS_GYRO_DT (1./512.) + + + +/* + * Magnetometer + */ + /* HMC5843 has 12 bit resolution */ +#define NPS_MAG_MIN -2047 +#define NPS_MAG_MAX 2047 + +#define NPS_MAG_IMU_TO_SENSOR_PHI 0. +#define NPS_MAG_IMU_TO_SENSOR_THETA 0. +#define NPS_MAG_IMU_TO_SENSOR_PSI 0. + +#define NPS_MAG_SENSITIVITY_XX MAG_BFP_OF_REAL(1./IMU_MAG_X_SENS) +#define NPS_MAG_SENSITIVITY_YY MAG_BFP_OF_REAL(1./IMU_MAG_Y_SENS) +#define NPS_MAG_SENSITIVITY_ZZ MAG_BFP_OF_REAL(1./IMU_MAG_Z_SENS) + +#define NPS_MAG_NEUTRAL_X IMU_MAG_X_NEUTRAL +#define NPS_MAG_NEUTRAL_Y IMU_MAG_Y_NEUTRAL +#define NPS_MAG_NEUTRAL_Z IMU_MAG_Z_NEUTRAL + +#define NPS_MAG_NOISE_STD_DEV_X 2e-3 +#define NPS_MAG_NOISE_STD_DEV_Y 2e-3 +#define NPS_MAG_NOISE_STD_DEV_Z 2e-3 + +#define NPS_MAG_DT (1./100.) + + +/* + * Range meter + */ +#define BSM_RANGEMETER_RESOLUTION (1024) +#define BSM_RANGEMETER_SENSITIVITY (1024. / 12.) +#define BSM_RANGEMETER_MAX_RANGE (6. * BSM_RANGEMETER_SENSITIVITY) +#define BSM_RANGEMETER_DT (1./20.) + + +/* + * Barometer + */ +/* m */ +/* aka 2^8/INS_BARO_SENS */ +#define NPS_BARO_QNH 900. +#define NPS_BARO_SENSITIVITY 17.066667 +#define NPS_BARO_DT (1./100.) +#define NPS_BARO_NOISE_STD_DEV 5.e-2 + +/* + * GPS + */ + +#ifndef GPS_PERFECT +#define GPS_PERFECT 1 +#endif + +#if GPS_PERFECT + +#define NPS_GPS_SPEED_NOISE_STD_DEV 0. +#define NPS_GPS_SPEED_LATENCY 0. +#define NPS_GPS_POS_NOISE_STD_DEV 0.001 +#define NPS_GPS_POS_BIAS_INITIAL_X 0. +#define NPS_GPS_POS_BIAS_INITIAL_Y 0. +#define NPS_GPS_POS_BIAS_INITIAL_Z 0. +#define NPS_GPS_POS_BIAS_RANDOM_WALK_STD_DEV_X 0. +#define NPS_GPS_POS_BIAS_RANDOM_WALK_STD_DEV_Y 0. +#define NPS_GPS_POS_BIAS_RANDOM_WALK_STD_DEV_Z 0. +#define NPS_GPS_POS_LATENCY 0. + +#else + +#define NPS_GPS_SPEED_NOISE_STD_DEV 0.5 +#define NPS_GPS_SPEED_LATENCY 0.2 +#define NPS_GPS_POS_NOISE_STD_DEV 2 +#define NPS_GPS_POS_BIAS_INITIAL_X 0e-1 +#define NPS_GPS_POS_BIAS_INITIAL_Y -0e-1 +#define NPS_GPS_POS_BIAS_INITIAL_Z -0e-1 +#define NPS_GPS_POS_BIAS_RANDOM_WALK_STD_DEV_X 1e-3 +#define NPS_GPS_POS_BIAS_RANDOM_WALK_STD_DEV_Y 1e-3 +#define NPS_GPS_POS_BIAS_RANDOM_WALK_STD_DEV_Z 1e-3 +#define NPS_GPS_POS_LATENCY 0.2 + +#endif /* GPS_PERFECT */ + +#define NPS_GPS_DT (1./4.) + +#endif /* NPS_SENSORS_PARAMS_H */ diff --git a/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.c b/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.c deleted file mode 100644 index 9d2192f553e..00000000000 --- a/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * $Id$ - * - * 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. - */ - -#include "subsystems/imu.h" - -#include "generated/airframe.h" - -void imu_aspirin_arch_init(void) { - imu_aspirin.status = AspirinStatusIdle; -} - - -#if USE_NPS -#include "nps_sensors.h" - -void imu_feed_gyro_accel(void) { - -#if 0 - // the high byte is in buf[0], low byte in buf[1], etc. - imu_aspirin.i2c_trans_gyro.buf[0] = ((int16_t)sensors.gyro.value.x) >> 8; - imu_aspirin.i2c_trans_gyro.buf[1] = ((int16_t)sensors.gyro.value.x) & 0xff; - imu_aspirin.i2c_trans_gyro.buf[2] = ((int16_t)sensors.gyro.value.y) >> 8; - imu_aspirin.i2c_trans_gyro.buf[3] = ((int16_t)sensors.gyro.value.y) & 0xff; - imu_aspirin.i2c_trans_gyro.buf[4] = ((int16_t)sensors.gyro.value.z) >> 8; - imu_aspirin.i2c_trans_gyro.buf[5] = ((int16_t)sensors.gyro.value.z) & 0xff; - - // low byte in buf[1], high byte in buf[2], etc... - imu_aspirin.accel_rx_buf[1] = ((int16_t)sensors.accel.value.x) & 0xff; - imu_aspirin.accel_rx_buf[2] = ((int16_t)sensors.accel.value.x) >> 8; - imu_aspirin.accel_rx_buf[3] = ((int16_t)sensors.accel.value.y) & 0xff; - imu_aspirin.accel_rx_buf[4] = ((int16_t)sensors.accel.value.y) >> 8; - imu_aspirin.accel_rx_buf[5] = ((int16_t)sensors.accel.value.z) & 0xff; - imu_aspirin.accel_rx_buf[6] = ((int16_t)sensors.accel.value.z) >> 8; - - // set availability flags... - imu_aspirin.accel_available = true; - -#else - - RATES_ASSIGN(imu.gyro_unscaled, sensors.gyro.value.x, sensors.gyro.value.y, sensors.gyro.value.z); - VECT3_ASSIGN(imu.accel_unscaled, sensors.accel.value.x, sensors.accel.value.y, sensors.accel.value.z); - - // set availability flags... - imu_aspirin.accel_available = true; - imu_aspirin.gyro_available_blaaa = true; - -#endif - -} - - -void imu_feed_mag(void) { - hmc5843.data.value[IMU_MAG_X_CHAN] = sensors.mag.value.x; - hmc5843.data.value[IMU_MAG_Y_CHAN] = sensors.mag.value.y; - hmc5843.data.value[IMU_MAG_Z_CHAN] = sensors.mag.value.z; - hmc5843.data_available = TRUE; -} -#endif diff --git a/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.h b/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.h deleted file mode 100644 index 967dec2494d..00000000000 --- a/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id$ - * - * 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. - */ - -/* - * - * simulator plug for the booz2 v1 imu arch dependant functions - * - */ -#ifndef IMU_ASPIRIN_ARCH_H -#define IMU_ASPIRIN_ARCH_H - - -extern void imu_feed_gyro_accel(void); -extern void imu_feed_mag(void); - -#define imu_aspirin_arch_int_enable() {} -#define imu_aspirin_arch_int_disable() {} -#define adxl345_write_to_reg(foo, bar) {} -#define adxl345_clear_rx_buf() {} -#define adxl345_start_reading_data() {} - -static inline int imu_aspirin_eoc(void) -{ - return 1; -} - - -#endif /* IMU_ASPIRIN_ARCH_H */ diff --git a/sw/airborne/arch/sim/subsystems/imu/imu_b2_arch.c b/sw/airborne/arch/sim/subsystems/imu/imu_b2_arch.c deleted file mode 100644 index deb32021cb3..00000000000 --- a/sw/airborne/arch/sim/subsystems/imu/imu_b2_arch.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * $Id$ - * - * 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. - */ - -#include "subsystems/imu.h" - -#include "generated/airframe.h" - -int imu_overrun = 0; - -void imu_b2_arch_init(void) { - -} - -void imu_periodic(void) { - -} - -#if USE_NPS -#include "nps_sensors.h" - -void imu_feed_gyro_accel(void) { - max1168_values[IMU_GYRO_P_CHAN] = sensors.gyro.value.x; - max1168_values[IMU_GYRO_Q_CHAN] = sensors.gyro.value.y; - max1168_values[IMU_GYRO_R_CHAN] = sensors.gyro.value.z; - max1168_values[IMU_ACCEL_X_CHAN] = sensors.accel.value.x; - max1168_values[IMU_ACCEL_Y_CHAN] = sensors.accel.value.y; - max1168_values[IMU_ACCEL_Z_CHAN] = sensors.accel.value.z; - max1168_status = STA_MAX1168_DATA_AVAILABLE; -} - - -void imu_feed_mag(void) { -#if defined IMU_B2_MAG_TYPE && IMU_B2_MAG_TYPE == IMU_B2_MAG_MS2100 - ms2100_values[IMU_MAG_X_CHAN] = sensors.mag.value.x; - ms2100_values[IMU_MAG_Y_CHAN] = sensors.mag.value.y; - ms2100_values[IMU_MAG_Z_CHAN] = sensors.mag.value.z; - ms2100_status = MS2100_DATA_AVAILABLE; -#elif defined IMU_B2_MAG_TYPE && IMU_B2_MAG_TYPE == IMU_B2_MAG_AMI601 - ami601_values[IMU_MAG_X_CHAN] = sensors.mag.value.x; - ami601_values[IMU_MAG_Y_CHAN] = sensors.mag.value.y; - ami601_values[IMU_MAG_Z_CHAN] = sensors.mag.value.z; - ami601_status = AMI601_DATA_AVAILABLE; -#endif -} -#endif //USE_NPS diff --git a/sw/airborne/arch/sim/subsystems/imu/imu_b2_arch.h b/sw/airborne/arch/sim/subsystems/imu/imu_b2_arch.h deleted file mode 100644 index 2944460181c..00000000000 --- a/sw/airborne/arch/sim/subsystems/imu/imu_b2_arch.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * $Id$ - * - * 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. - */ - -/* - * - * simulator plug for the booz2 v1 imu arch dependant functions - * - */ -#ifndef IMU_B2_ARCH_H -#define IMU_B2_ARCH_H - -extern int imu_overrun; - -#if USE_NPS -extern void imu_feed_gyro_accel(void); -extern void imu_feed_mag(void); -#endif - -#endif /* IMU_B2_HW_H */ diff --git a/sw/airborne/arch/sim/subsystems/imu/imu_crista_arch.c b/sw/airborne/arch/sim/subsystems/imu/imu_crista_arch.c deleted file mode 100644 index 4d78cef36ab..00000000000 --- a/sw/airborne/arch/sim/subsystems/imu/imu_crista_arch.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * simulator ARCH for rotorcraft imu crista - */ - -#include "subsystems/imu.h" - -#include "generated/airframe.h" - -void imu_crista_arch_init(void) { - -} - -#if USE_NPS -#include "nps_sensors.h" - -void imu_feed_gyro_accel(void) { - ADS8344_values[IMU_GYRO_P_CHAN] = sensors.gyro.value.x; - ADS8344_values[IMU_GYRO_Q_CHAN] = sensors.gyro.value.y; - ADS8344_values[IMU_GYRO_R_CHAN] = sensors.gyro.value.z; - ADS8344_values[IMU_ACCEL_X_CHAN] = sensors.accel.value.x; - ADS8344_values[IMU_ACCEL_Y_CHAN] = sensors.accel.value.y; - ADS8344_values[IMU_ACCEL_Z_CHAN] = sensors.accel.value.z; - ADS8344_available = TRUE; -} - -void imu_feed_mag(void) { - ami601_values[IMU_MAG_X_CHAN] = sensors.mag.value.x; - ami601_values[IMU_MAG_Y_CHAN] = sensors.mag.value.y; - ami601_values[IMU_MAG_Z_CHAN] = sensors.mag.value.z; - ami601_status = AMI601_DATA_AVAILABLE; -} -#endif diff --git a/sw/airborne/arch/sim/subsystems/imu/imu_crista_arch.h b/sw/airborne/arch/sim/subsystems/imu/imu_crista_arch.h deleted file mode 100644 index e699ce9b4d1..00000000000 --- a/sw/airborne/arch/sim/subsystems/imu/imu_crista_arch.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2010 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. - */ - -/* - * - * simulator plug for the crista imu arch dependant functions - * - */ -#ifndef IMU_CRISTA_ARCH_H -#define IMU_CRISTA_ARCH_H - -#include "subsystems/imu.h" - - -#define ImuCristaArchPeriodic() {} - -extern void imu_feed_gyro_accel(void); -extern void imu_feed_mag(void); - - -#endif /* IMU_CRISTA_HW_H */ diff --git a/sw/airborne/arch/stm32/mcu_periph/uart_arch.c b/sw/airborne/arch/stm32/mcu_periph/uart_arch.c index 42688bfdb9f..130601e581e 100644 --- a/sw/airborne/arch/stm32/mcu_periph/uart_arch.c +++ b/sw/airborne/arch/stm32/mcu_periph/uart_arch.c @@ -38,7 +38,6 @@ void uart_periph_set_baudrate(struct uart_periph* p, uint32_t baud) { usart_set_parity((u32)p->reg_addr, USART_PARITY_NONE); usart_set_flow_control((u32)p->reg_addr, USART_FLOWCONTROL_NONE); usart_set_mode((u32)p->reg_addr, USART_MODE_TX_RX); - /* Enable USART1 Receive interrupts */ USART_CR1((u32)p->reg_addr) |= USART_CR1_RXNEIE; @@ -129,7 +128,6 @@ void uart1_init( void ) { /* Configure USART */ uart_periph_set_baudrate(&uart1, UART1_BAUD); - } void usart1_isr(void) { usart_isr(&uart1); } @@ -158,7 +156,6 @@ void uart2_init( void ) { /* Configure USART */ uart_periph_set_baudrate(&uart2, UART2_BAUD); - } void usart2_isr(void) { usart_isr(&uart2); } @@ -189,7 +186,6 @@ void uart3_init( void ) { /* Configure USART */ uart_periph_set_baudrate(&uart3, UART3_BAUD); - } void usart3_isr(void) { usart_isr(&uart3); } @@ -219,7 +215,6 @@ void uart5_init( void ) { /* Configure USART */ uart_periph_set_baudrate(&uart5, UART5_BAUD); - } void uart5_isr(void) { usart_isr(&uart5); } diff --git a/sw/airborne/arch/stm32/subsystems/imu/imu_aspirin2_arch.c b/sw/airborne/arch/stm32/subsystems/imu/imu_aspirin2_arch.c deleted file mode 100644 index 87374d394a3..00000000000 --- a/sw/airborne/arch/stm32/subsystems/imu/imu_aspirin2_arch.c +++ /dev/null @@ -1,90 +0,0 @@ -#include "subsystems/imu.h" - -#include -#include -#include -#include -#include - - - - -// gyro interupt handler -void exti15_10_irq_handler(void); - -void imu_aspirin2_arch_int_enable(void) { -/* - NVIC_InitTypeDef NVIC_InitStructure; - - NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); -*/ -} - -void imu_aspirin2_arch_int_disable(void) { -/* - NVIC_InitTypeDef NVIC_InitStructure; - - NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; - NVIC_InitStructure.NVIC_IRQChannelCmd = DISABLE; - NVIC_Init(&NVIC_InitStructure); -*/ -} - -void imu_aspirin2_arch_init(void) { -/* - GPIO_InitTypeDef GPIO_InitStructure; - EXTI_InitTypeDef EXTI_InitStructure; - SPI_InitTypeDef SPI_InitStructure; - - // Set "mag ss" and "mag reset" as floating inputs ------------------------ - // "mag ss" (PC12) is shorted to I2C2 SDA - // "mag reset" (PC13) is shorted to I2C2 SCL - RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12|GPIO_Pin_13; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_Init(GPIOC, &GPIO_InitStructure); - - // Gyro -------------------------------------------------------------------- - // set "eeprom ss" as floating input (on PC14) = gyro int --------- - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_Init(GPIOC, &GPIO_InitStructure); - // configure external interrupt exti15_10 on PC14( gyro int ) - RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE); - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_Init(GPIOC, &GPIO_InitStructure); - - // ifdef ASPIRIN_USE_GYRO_INT - GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource14); - EXTI_InitStructure.EXTI_Line = EXTI_Line14; - EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; - EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; - EXTI_InitStructure.EXTI_LineCmd = ENABLE; - EXTI_Init(&EXTI_InitStructure); -*/ - -} - - - -// Gyro data ready -//void exti15_10_isr(void) { -// // clear EXTI -// -// exti_reset_request(EXTI14); -// -///* -// imu_aspirin.gyro_eoc = TRUE; -// imu_aspirin.status = AspirinStatusReadingGyro; -//*/ -//} diff --git a/sw/airborne/arch/stm32/subsystems/imu/imu_aspirin2_arch.h b/sw/airborne/arch/stm32/subsystems/imu/imu_aspirin2_arch.h deleted file mode 100644 index 0c64c13dd1c..00000000000 --- a/sw/airborne/arch/stm32/subsystems/imu/imu_aspirin2_arch.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef IMU_ASPIRIN2_ARCH_H -#define IMU_ASPIRIN2_ARCH_H - -#include "subsystems/imu.h" -#include - - - -extern void imu_aspirin2_arch_int_enable(void); -extern void imu_aspirin2_arch_int_disable(void); - -/* -static inline int imu_aspirin2_eoc(void) -{ - return !GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_14); -} -*/ - - -#endif diff --git a/sw/airborne/subsystems/imu/imu_aspirin.c b/sw/airborne/subsystems/imu/imu_aspirin.c index ba9fe0a0416..3d3784f2ffd 100644 --- a/sw/airborne/subsystems/imu/imu_aspirin.c +++ b/sw/airborne/subsystems/imu/imu_aspirin.c @@ -14,7 +14,6 @@ static void configure_accel(void); #define ASPIRIN_ACCEL_RATE ADXL345_RATE_800 #endif -#if !SITL // FIXME: there should be no arch dependent code here! static void send_i2c_msg_with_retry(struct i2c_transaction* t) { uint8_t max_retry = 8; @@ -29,9 +28,6 @@ static void send_i2c_msg_with_retry(struct i2c_transaction* t) { } while (t->status != I2CTransSuccess && nb_retry < max_retry); } -#else -static void send_i2c_msg_with_retry(struct i2c_transaction* t __attribute__ ((unused))) {} -#endif void imu_impl_init(void) { diff --git a/sw/airborne/subsystems/imu/imu_aspirin.h b/sw/airborne/subsystems/imu/imu_aspirin.h index f048e545280..7cc0554c7da 100644 --- a/sw/airborne/subsystems/imu/imu_aspirin.h +++ b/sw/airborne/subsystems/imu/imu_aspirin.h @@ -253,22 +253,8 @@ static inline void imu_aspirin_event(void (* _gyro_handler)(void), void (* _acce } -#ifndef SITL #define ImuEvent(_gyro_handler, _accel_handler, _mag_handler) do { \ imu_aspirin_event(_gyro_handler, _accel_handler, _mag_handler); \ } while(0); -#else -#define ImuEvent(_gyro_handler, _accel_handler, _mag_handler) { \ - if (imu_aspirin.accel_available) { \ - imu_aspirin.accel_available = FALSE; \ - _accel_handler(); \ - } \ - if (imu_aspirin.gyro_available_blaaa) { \ - imu_aspirin.gyro_available_blaaa = FALSE; \ - _gyro_handler(); \ - } \ - ImuMagEvent(_mag_handler); \ - } -#endif #endif /* IMU_ASPIRIN_H */ diff --git a/sw/airborne/subsystems/imu/imu_aspirin2.c b/sw/airborne/subsystems/imu/imu_aspirin2.c index 66bfcc5d6bf..813a7440122 100644 --- a/sw/airborne/subsystems/imu/imu_aspirin2.c +++ b/sw/airborne/subsystems/imu/imu_aspirin2.c @@ -1,3 +1,23 @@ +/* + * Copyright (C) 2012 Christophe DeWagter + * + * 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. + */ #include "subsystems/imu.h" #include "led.h" @@ -15,12 +35,8 @@ struct spi_transaction aspirin2_mpu60x0; // initialize peripherals -static void configure(void); -/* -static void configure_accel(void); -//static void configure_mag(void); +static void mpu_configure(void); -*/ void imu_impl_init(void) { @@ -36,7 +52,6 @@ void imu_impl_init(void) { aspirin2_mpu60x0.length = 2; aspirin2_mpu60x0.slave_idx = 0; -// imu_aspirin2_arch_init(); } @@ -44,36 +59,24 @@ void imu_impl_init(void) { void imu_periodic(void) { - if (imu_aspirin2.status == Aspirin2StatusUninit) - { - configure(); + if (imu_aspirin2.status == Aspirin2StatusUninit) { + mpu_configure(); // imu_aspirin_arch_int_enable(); imu_aspirin2.status = Aspirin2StatusIdle; aspirin2_mpu60x0.length = 22; aspirin2_mpu60x0.output_buf[0] = MPU60X0_REG_INT_STATUS + MPU60X0_SPI_READ; - { - for (int i=1;i ASPIRIN_ACCEL_TIMEOUT) - { - configure_accel(); - imu_aspirin.time_since_last_accel_reading=0; - } -*/ } } @@ -84,7 +87,7 @@ static inline void mpu_set(uint8_t _reg, uint8_t _val) spi_submit(&spi2,&aspirin2_mpu60x0); // FIXME: no busy waiting! if really needed add a timeout!!!! - while(aspirin2_mpu60x0.status != SPITransSuccess); + while(aspirin2_mpu60x0.status != SPITransSuccess); } static inline void mpu_wait_slave4_ready(void) @@ -97,7 +100,7 @@ static inline void mpu_wait_slave4_ready(void) spi_submit(&spi2,&aspirin2_mpu60x0); // FIXME: no busy waiting! if really needed add a timeout!!!! - while(aspirin2_mpu60x0.status != SPITransSuccess); + while(aspirin2_mpu60x0.status != SPITransSuccess); ret = aspirin2_mpu60x0.input_buf[1]; } @@ -105,7 +108,7 @@ static inline void mpu_wait_slave4_ready(void) -static void configure(void) +static void mpu_configure(void) { aspirin2_mpu60x0.length = 2; diff --git a/sw/airborne/subsystems/imu/imu_aspirin2.h b/sw/airborne/subsystems/imu/imu_aspirin2.h index 928bab8d5c7..6892df5fcf9 100644 --- a/sw/airborne/subsystems/imu/imu_aspirin2.h +++ b/sw/airborne/subsystems/imu/imu_aspirin2.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Antoine Drouin + * Copyright (C) 2012 Christophe DeWagter * * This file is part of paparazzi. * @@ -19,8 +19,8 @@ * Boston, MA 02111-1307, USA. */ -#ifndef IMU_ASPIRIN_H -#define IMU_ASPIRIN_H +#ifndef IMU_ASPIRIN_2_H +#define IMU_ASPIRIN_2_H #include "generated/airframe.h" #include "subsystems/imu.h" @@ -100,40 +100,18 @@ struct ImuAspirin2 { volatile enum Aspirin2Status status; volatile uint8_t imu_available; volatile uint8_t *input_buf_p; - uint32_t time_since_last_reading; }; extern struct ImuAspirin2 imu_aspirin2; -#define ASPIRIN2_TIMEOUT 3 -/* - -#define foo_handler() {} -#define ImuMagEvent(_mag_handler) { \ - MagEvent(foo_handler); \ -} - - - if (hmc5843.data_available) { \ - imu.mag_unscaled.x = hmc5843.data.value[IMU_MAG_X_CHAN]; \ - imu.mag_unscaled.y = hmc5843.data.value[IMU_MAG_Y_CHAN]; \ - imu.mag_unscaled.z = hmc5843.data.value[IMU_MAG_Z_CHAN]; \ - _mag_handler(); \ - hmc5843.data_available = FALSE; \ - } \ -*/ - -/* underlying architecture */ -#include "subsystems/imu/imu_aspirin2_arch.h" -/* must be implemented by underlying architecture */ -extern void imu_aspirin2_arch_init(void); static inline void imu_from_buff(volatile uint8_t *buf) { int32_t x, y, z, p, q, r, Mx, My, Mz; + #define MPU_OFFSET_GYRO 10 p = (int16_t) ((buf[0+MPU_OFFSET_GYRO] << 8) | buf[1+MPU_OFFSET_GYRO]); q = (int16_t) ((buf[2+MPU_OFFSET_GYRO] << 8) | buf[3+MPU_OFFSET_GYRO]); @@ -160,6 +138,8 @@ static inline void imu_from_buff(volatile uint8_t *buf) #endif + //FIXME, remove it or use it... +#if 0 // Is this is new data #define MPU_OFFSET_STATUS 1 if (buf[MPU_OFFSET_STATUS] & 0x01) @@ -167,9 +147,9 @@ static inline void imu_from_buff(volatile uint8_t *buf) //gyr_valid = TRUE; //acc_valid = TRUE; } - else - { + else { } +#endif } @@ -177,11 +157,7 @@ static inline void imu_aspirin2_event(void (* _gyro_handler)(void), void (* _acc { if (imu_aspirin2.status == Aspirin2StatusUninit) return; - // imu_aspirin2_arch_int_disable(); - - if (imu_aspirin2.imu_available) - { - imu_aspirin2.time_since_last_reading = 0; + if (imu_aspirin2.imu_available) { imu_aspirin2.imu_available = FALSE; imu_from_buff(imu_aspirin2.input_buf_p); @@ -189,13 +165,6 @@ static inline void imu_aspirin2_event(void (* _gyro_handler)(void), void (* _acc _accel_handler(); _mag_handler(); } - // imu_aspirin2_arch_int_enable(); - - // Reset everything if we've been waiting too long - //if (imu_aspirin2.time_since_last_reading > ASPIRIN2_TIMEOUT) { - // imu_aspirin2.time_since_last_reading = 0; - // return; - //} } @@ -203,4 +172,4 @@ static inline void imu_aspirin2_event(void (* _gyro_handler)(void), void (* _acc imu_aspirin2_event(_gyro_handler, _accel_handler, _mag_handler); \ } -#endif /* IMU_ASPIRIN_H */ +#endif /* IMU_ASPIRIN_2_H */ diff --git a/sw/airborne/subsystems/imu/imu_nps.c b/sw/airborne/subsystems/imu/imu_nps.c new file mode 100644 index 00000000000..1e3aeaaf785 --- /dev/null +++ b/sw/airborne/subsystems/imu/imu_nps.c @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2012 Felix Ruess