diff --git a/conf/airframes/TUDelft/MicrojetCDW.xml b/conf/airframes/TUDelft/MicrojetCDW.xml new file mode 100644 index 0000000000..9d7e43451a --- /dev/null +++ b/conf/airframes/TUDelft/MicrojetCDW.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ +
+ + + + +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/conf/autopilot/subsystems/fixedwing/imu_analog.makefile b/conf/autopilot/subsystems/fixedwing/imu_analog.makefile index 31fe680501..c8c6cae3cd 100644 --- a/conf/autopilot/subsystems/fixedwing/imu_analog.makefile +++ b/conf/autopilot/subsystems/fixedwing/imu_analog.makefile @@ -43,6 +43,9 @@ ifeq ($(ARCH), lpc21) + +imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_analog.h\" + imu_CFLAGS += -DADC imu_CFLAGS += -DUSE_$(GYRO_P) -DUSE_$(GYRO_Q) -DUSE_$(GYRO_R) imu_CFLAGS += -DUSE_$(ACCEL_X) -DUSE_$(ACCEL_y) -DUSE_$(ACCEL_Z) diff --git a/conf/autopilot/subsystems/fixedwing/imu_booz.makefile b/conf/autopilot/subsystems/fixedwing/imu_booz.makefile new file mode 100644 index 0000000000..5de6f0bf69 --- /dev/null +++ b/conf/autopilot/subsystems/fixedwing/imu_booz.makefile @@ -0,0 +1,86 @@ +# +# Booz2 IMU booz2v1.2 +# +# +# required xml: +#
+# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +# +#
+# +# + +# +# param: MAX_1168_DRDY_PORT + + + +# imu Booz2 v1.0, v1.1, v1.2, YAI v1.0 + +imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_b2.h\" +imu_srcs += $(SRC_SUBSYSTEMS)/imu.c +imu_srcs += $(SRC_SUBSYSTEMS)/imu/imu_b2.c +imu_srcs += $(SRC_ARCH)/subsystems/imu/imu_b2_arch.c + +imu_srcs += peripherals/max1168.c +imu_srcs += $(SRC_ARCH)/peripherals/max1168_arch.c + +#ifeq ($(ARCH), lpc21) +imu_CFLAGS += -DSSP_VIC_SLOT=9 +imu_CFLAGS += -DMAX1168_EOC_VIC_SLOT=8 +#FIXME ms2001 not used on this imu +#else ifeq ($(ARCH), stm32) +#imu_CFLAGS += -DUSE_SPI2 -DUSE_DMA1_C4_IRQ -DUSE_EXTI2_IRQ -DUSE_SPI2_IRQ +#imu_CFLAGS += -DMAX_1168_DRDY_PORT=$(MAX_1168_DRDY_PORT) +#imu_CFLAGS += -DMAX_1168_DRDY_PORT_SOURCE=$(MAX_1168_DRDY_PORT_SOURCE) +#imu_CFLAGS += -DUSE_I2C2 -DUSE_EXTI9_5_IRQ +#endif + +ap.srcs += $(imu_srcs) +ap.CFLAGS += $(imu_CFLAGS) + +imu_srcs += math/pprz_trig_int.c + +# +# Simulator +# + +sim.CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_b2.h\" +#FIXME, should be HMC5843 +sim.CFLAGS += -DIMU_B2_MAG_TYPE=IMU_B2_MAG_AMI601 +#FIXME, should be verision 1.2 +sim.CFLAGS += -DIMU_B2_VERSION_1_1 +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 diff --git a/conf/telemetry/default_fixedwing_imu.xml b/conf/telemetry/default_fixedwing_imu.xml new file mode 100644 index 0000000000..53b7089b05 --- /dev/null +++ b/conf/telemetry/default_fixedwing_imu.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/airborne/ap_downlink.h b/sw/airborne/ap_downlink.h index 776f8d260a..a45945cf33 100644 --- a/sw/airborne/ap_downlink.h +++ b/sw/airborne/ap_downlink.h @@ -138,6 +138,19 @@ #define PERIODIC_SEND_SEGMENT(_chan) if (nav_in_segment) { DOWNLINK_SEND_SEGMENT(_chan, &nav_segment_x_1, &nav_segment_y_1, &nav_segment_x_2, &nav_segment_y_2); } +#ifdef IMU_TYPE_H +#include "subsystems/imu.h" +#define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) { DOWNLINK_SEND_IMU_ACCEL_RAW(_chan, &imu.accel_unscaled.x, &imu.accel_unscaled.y, &imu.accel_unscaled.z)} +#define PERIODIC_SEND_IMU_GYRO_RAW(_chan) { DOWNLINK_SEND_IMU_GYRO_RAW(_chan, &imu.gyro_unscaled.p, &imu.gyro_unscaled.q, &imu.gyro_unscaled.r)} +#define PERIODIC_SEND_IMU_ACCEL(_chan) { DOWNLINK_SEND_IMU_ACCEL_RAW(_chan, &imu.accel.x, &imu.accel.y, &imu.accel.z)} +#define PERIODIC_SEND_IMU_GYRO(_chan) { DOWNLINK_SEND_IMU_GYRO_RAW(_chan, &imu.gyro.p, &imu.gyro.q, &imu.gyro.r)} +#else +#define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) {} +#define PERIODIC_SEND_IMU_GYRO_RAW(_chan) {} +#define PERIODIC_SEND_IMU_ACCEL(_chan) {} +#define PERIODIC_SEND_IMU_GYRO(_chan) {} +#endif + #ifdef IMU_ANALOG #define PERIODIC_SEND_IMU(_chan) { int16_t dummy = 42; DOWNLINK_SEND_IMU(_chan, &(from_fbw.euler_dot[0]), &(from_fbw.euler_dot[1]), &(from_fbw.euler_dot[2]), &dummy, &dummy, &dummy); } #else diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index faf12e3fe6..deb1512a6e 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -66,10 +66,10 @@ #ifdef USE_ANALOG_IMU +#include "subsystems/imu.h" #include "subsystems/ahrs.h" #include "subsystems/ahrs/ahrs_aligner.h" #include "subsystems/ahrs/ahrs_float_dcm.h" -#include "subsystems/imu/imu_analog.h" static inline void on_gyro_accel_event( void ); static inline void on_mag_event( void ); #endif diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c index 70268a0100..f88125ea39 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c +++ b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c @@ -378,8 +378,8 @@ void Matrix_update(void) void Euler_angles(void) { #if (OUTPUTMODE==2) // Only accelerometer info (debugging purposes) - ahrs_float.ltp_to_imu_euler.phi = atan2(Accel_Vector[1],Accel_Vector[2]); // atan2(acc_y,acc_z) - ahrs_float.ltp_to_imu_euler.theta = -asin((Accel_Vector[0])/GRAVITY); // asin(acc_x) + ahrs_float.ltp_to_imu_euler.phi = atan2(accel_float.y,accel_float.z); // atan2(acc_y,acc_z) + ahrs_float.ltp_to_imu_euler.theta = -asin((accel_float.x)/GRAVITY); // asin(acc_x) ahrs_float.ltp_to_imu_euler.psi = 0; #else ahrs_float.ltp_to_imu_euler.phi = atan2(DCM_Matrix[2][1],DCM_Matrix[2][2]);