diff --git a/conf/airframes/example_twog_analogimu.xml b/conf/airframes/example_twog_analogimu.xml index 6d7a26e89f..8b9264005a 100644 --- a/conf/airframes/example_twog_analogimu.xml +++ b/conf/airframes/example_twog_analogimu.xml @@ -210,7 +210,7 @@ - + @@ -218,6 +218,8 @@ + + diff --git a/conf/autopilot/subsystems/fixedwing/attitude_analogimu.makefile b/conf/autopilot/subsystems/fixedwing/attitude_analogimu.makefile deleted file mode 100644 index 426da8c8e8..0000000000 --- a/conf/autopilot/subsystems/fixedwing/attitude_analogimu.makefile +++ /dev/null @@ -1,35 +0,0 @@ -# attitude via analog imu - - -ifeq ($(ARCH), lpc21) -ap.CFLAGS += -DUSE_ANALOG_IMU -DADC -ap.CFLAGS += -DUSE_$(GYRO_P) -DUSE_$(GYRO_Q) -DUSE_ADC_$(GYRO_R) -ap.CFLAGS += -DUSE_$(ACCEL_X) -DUSE_$(ACCEL_y) -DUSE_$(ACCEL_Z) - -ap.CFLAGS += -DADC_CHANNEL_GYRO_P=$(GYRO_P) -DADC_CHANNEL_GYRO_Q=$(GYRO_Q) -DADC_CHANNEL_GYRO_R=$(GYRO_R) -ap.CFLAGS += -DADC_CHANNEL_ACCEL_X=$(ACCEL_X) -DADC_CHANNEL_ACCEL_Y=$(ACCEL_Y) -DADC_CHANNEL_ACCEL_Z=$(ACCEL_Z) - -ap.srcs += $(SRC_SUBSYSTEMS)/ahrs/dcm/dcm.c -ap.srcs += $(SRC_SUBSYSTEMS)/ahrs/dcm/analogimu.c -ap.srcs += $(SRC_SUBSYSTEMS)/imu/imu_analog.c -ap.srcs += $(SRC_SUBSYSTEMS)/imu.c - - -endif - -# since there is currently no SITL sim for the Analog IMU, we use the infrared sim - -ifeq ($(TARGET), sim) - -sim.CFLAGS += -DIR_ROLL_NEUTRAL_DEFAULT=0 -sim.CFLAGS += -DIR_PITCH_NEUTRAL_DEFAULT=0 - -$(TARGET).CFLAGS += -DUSE_INFRARED -$(TARGET).srcs += subsystems/sensors/infrared.c - -sim.srcs += $(SRC_ARCH)/sim_ir.c -sim.srcs += $(SRC_ARCH)/sim_analogimu.c - -endif - -jsbsim.srcs += $(SRC_ARCH)/jsbsim_ir.c diff --git a/conf/autopilot/subsystems/fixedwing/attitude_dcm.makefile b/conf/autopilot/subsystems/fixedwing/attitude_dcm.makefile new file mode 100644 index 0000000000..0af7123028 --- /dev/null +++ b/conf/autopilot/subsystems/fixedwing/attitude_dcm.makefile @@ -0,0 +1,27 @@ +# attitude estimation for fixedwings via dcm algorithm + + +ifeq ($(ARCH), lpc21) +ap.CFLAGS += -DUSE_ANALOG_IMU + +ap.srcs += $(SRC_SUBSYSTEMS)/ahrs/dcm/dcm.c +ap.srcs += $(SRC_SUBSYSTEMS)/ahrs/dcm/analogimu.c + +endif + +# since there is currently no SITL sim for the Analog IMU, we use the infrared sim + +ifeq ($(TARGET), sim) + +sim.CFLAGS += -DIR_ROLL_NEUTRAL_DEFAULT=0 +sim.CFLAGS += -DIR_PITCH_NEUTRAL_DEFAULT=0 + +sim.CFLAGS += -DUSE_INFRARED +sim.srcs += subsystems/sensors/infrared.c + +sim.srcs += $(SRC_ARCH)/sim_ir.c +sim.srcs += $(SRC_ARCH)/sim_analogimu.c + +endif + +jsbsim.srcs += $(SRC_ARCH)/jsbsim_ir.c diff --git a/conf/autopilot/subsystems/fixedwing/imu_analog.makefile b/conf/autopilot/subsystems/fixedwing/imu_analog.makefile new file mode 100644 index 0000000000..b319b6d507 --- /dev/null +++ b/conf/autopilot/subsystems/fixedwing/imu_analog.makefile @@ -0,0 +1,62 @@ +# +# Analog IMU connected to MCU ADC ports +# +# +# +# +# +# +# +# +# +# +# +# required xml: +#
+# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +#
+# + + +ifeq ($(ARCH), lpc21) +imu_CFLAGS += -DADC +imu_CFLAGS += -DUSE_$(GYRO_P) -DUSE_$(GYRO_Q) -DUSE_ADC_$(GYRO_R) +imu_CFLAGS += -DUSE_$(ACCEL_X) -DUSE_$(ACCEL_y) -DUSE_$(ACCEL_Z) + +imu_CFLAGS += -DADC_CHANNEL_GYRO_P=$(GYRO_P) -DADC_CHANNEL_GYRO_Q=$(GYRO_Q) -DADC_CHANNEL_GYRO_R=$(GYRO_R) +imu_CFLAGS += -DADC_CHANNEL_ACCEL_X=$(ACCEL_X) -DADC_CHANNEL_ACCEL_Y=$(ACCEL_Y) -DADC_CHANNEL_ACCEL_Z=$(ACCEL_Z) + +imu_srcs += $(SRC_SUBSYSTEMS)/imu.c +imu_srcs += $(SRC_SUBSYSTEMS)/imu/imu_analog.c +imu_srcs += math/pprz_trig_int.c + +endif + +# Keep CFLAGS/Srcs for imu in separate expression so we can assign it to other targets +# see: conf/autopilot/subsystems/lisa_passthrough/imu_b2_v1.1.makefile for example +ap.CFLAGS += $(imu_CFLAGS) +ap.srcs += $(imu_srcs)