void imu_aspirin_i2c_event(void) { adxl345_i2c_event(&imu_aspirin.acc_adxl); if (imu_aspirin.acc_adxl.data_available) { VECT3_COPY(imu.accel_unscaled, imu_aspirin.acc_adxl.data.vect); imu_aspirin.acc_adxl.data_available = FALSE; imu_aspirin.accel_valid = TRUE; } /* If the itg3200 I2C transaction has succeeded: convert the data */ itg3200_event(&imu_aspirin.gyro_itg); if (imu_aspirin.gyro_itg.data_available) { RATES_COPY(imu.gyro_unscaled, imu_aspirin.gyro_itg.data.rates); imu_aspirin.gyro_itg.data_available = FALSE; imu_aspirin.gyro_valid = TRUE; } /* HMC58XX event task */ hmc58xx_event(&imu_aspirin.mag_hmc); if (imu_aspirin.mag_hmc.data_available) { #ifdef IMU_ASPIRIN_VERSION_1_0 VECT3_COPY(imu.mag_unscaled, imu_aspirin.mag_hmc.data.vect); #else // aspirin 1.5 with hmc5883 imu.mag_unscaled.x = imu_aspirin.mag_hmc.data.vect.y; imu.mag_unscaled.y = -imu_aspirin.mag_hmc.data.vect.x; imu.mag_unscaled.z = imu_aspirin.mag_hmc.data.vect.z; #endif imu_aspirin.mag_hmc.data_available = FALSE; imu_aspirin.mag_valid = TRUE; } }
void imu_umarim_event(void) { // If the itg3200 I2C transaction has succeeded: convert the data itg3200_event(&imu_umarim.itg); if (imu_umarim.itg.data_available) { RATES_COPY(imu.gyro_unscaled, imu_umarim.itg.data.rates); imu_umarim.itg.data_available = FALSE; imu_umarim.gyr_valid = TRUE; } // If the adxl345 I2C transaction has succeeded: convert the data adxl345_i2c_event(&imu_umarim.adxl); if (imu_umarim.adxl.data_available) { VECT3_ASSIGN(imu.accel_unscaled, imu_umarim.adxl.data.vect.y, -imu_umarim.adxl.data.vect.x, imu_umarim.adxl.data.vect.z); imu_umarim.adxl.data_available = FALSE; imu_umarim.acc_valid = TRUE; } }
void imu_umarim_event(void) { uint32_t now_ts = get_sys_time_usec(); // If the itg3200 I2C transaction has succeeded: convert the data itg3200_event(&imu_umarim.itg); if (imu_umarim.itg.data_available) { RATES_COPY(imu.gyro_unscaled, imu_umarim.itg.data.rates); imu_umarim.itg.data_available = FALSE; imu_scale_gyro(&imu); AbiSendMsgIMU_GYRO_INT32(IMU_BOARD_ID, now_ts, &imu.gyro); } // If the adxl345 I2C transaction has succeeded: convert the data adxl345_i2c_event(&imu_umarim.adxl); if (imu_umarim.adxl.data_available) { VECT3_ASSIGN(imu.accel_unscaled, imu_umarim.adxl.data.vect.y, -imu_umarim.adxl.data.vect.x, imu_umarim.adxl.data.vect.z); imu_umarim.adxl.data_available = FALSE; imu_scale_accel(&imu); AbiSendMsgIMU_ACCEL_INT32(IMU_BOARD_ID, now_ts, &imu.accel); } }
void imu_navgo_event( void ) { // If the itg3200 I2C transaction has succeeded: convert the data itg3200_event(&imu_navgo.itg); if (imu_navgo.itg.data_available) { RATES_ASSIGN(imu.gyro_unscaled, -imu_navgo.itg.data.rates.q, imu_navgo.itg.data.rates.p, imu_navgo.itg.data.rates.r); #if NAVGO_USE_MEDIAN_FILTER UpdateMedianFilterRatesInt(median_gyro, imu.gyro_unscaled); #endif imu_navgo.itg.data_available = FALSE; imu_navgo.gyr_valid = TRUE; } // If the adxl345 I2C transaction has succeeded: convert the data adxl345_i2c_event(&imu_navgo.adxl); if (imu_navgo.adxl.data_available) { VECT3_ASSIGN(imu.accel_unscaled, imu_navgo.adxl.data.vect.y, -imu_navgo.adxl.data.vect.x, imu_navgo.adxl.data.vect.z); #if NAVGO_USE_MEDIAN_FILTER UpdateMedianFilterVect3Int(median_accel, imu.accel_unscaled); #endif imu_navgo.adxl.data_available = FALSE; imu_navgo.acc_valid = TRUE; } // HMC58XX event task hmc58xx_event(&imu_navgo.hmc); if (imu_navgo.hmc.data_available) { VECT3_COPY(imu.mag_unscaled, imu_navgo.hmc.data.vect); #if NAVGO_USE_MEDIAN_FILTER UpdateMedianFilterVect3Int(median_mag, imu.mag_unscaled); #endif imu_navgo.hmc.data_available = FALSE; imu_navgo.mag_valid = TRUE; } }
void imu_ppzuav_event(void) { uint32_t now_ts = get_sys_time_usec(); adxl345_i2c_event(&imu_ppzuav.acc_adxl); if (imu_ppzuav.acc_adxl.data_available) { imu.accel_unscaled.x = -imu_ppzuav.acc_adxl.data.vect.x; imu.accel_unscaled.y = imu_ppzuav.acc_adxl.data.vect.y; imu.accel_unscaled.z = -imu_ppzuav.acc_adxl.data.vect.z; imu_ppzuav.acc_adxl.data_available = false; imu_scale_accel(&imu); AbiSendMsgIMU_ACCEL_INT32(IMU_PPZUAV_ID, now_ts, &imu.accel); } /* If the itg3200 I2C transaction has succeeded: convert the data */ itg3200_event(&imu_ppzuav.gyro_itg); if (imu_ppzuav.gyro_itg.data_available) { imu.gyro_unscaled.p = -imu_ppzuav.gyro_itg.data.rates.p; imu.gyro_unscaled.q = imu_ppzuav.gyro_itg.data.rates.q; imu.gyro_unscaled.r = -imu_ppzuav.gyro_itg.data.rates.r; imu_ppzuav.gyro_itg.data_available = false; imu_scale_gyro(&imu); AbiSendMsgIMU_GYRO_INT32(IMU_PPZUAV_ID, now_ts, &imu.gyro); } /* HMC58XX event task */ hmc58xx_event(&imu_ppzuav.mag_hmc); if (imu_ppzuav.mag_hmc.data_available) { imu.mag_unscaled.x = -imu_ppzuav.mag_hmc.data.vect.y; imu.mag_unscaled.y = -imu_ppzuav.mag_hmc.data.vect.x; imu.mag_unscaled.z = -imu_ppzuav.mag_hmc.data.vect.z; imu_ppzuav.mag_hmc.data_available = false; imu_scale_mag(&imu); AbiSendMsgIMU_MAG_INT32(IMU_PPZUAV_ID, now_ts, &imu.mag); } }
void imu_aspirin_i2c_event(void) { uint32_t now_ts = get_sys_time_usec(); adxl345_i2c_event(&imu_aspirin.acc_adxl); if (imu_aspirin.acc_adxl.data_available) { VECT3_COPY(imu.accel_unscaled, imu_aspirin.acc_adxl.data.vect); imu_aspirin.acc_adxl.data_available = FALSE; imu_scale_accel(&imu); AbiSendMsgIMU_ACCEL_INT32(IMU_ASPIRIN_ID, now_ts, &imu.accel); } /* If the itg3200 I2C transaction has succeeded: convert the data */ itg3200_event(&imu_aspirin.gyro_itg); if (imu_aspirin.gyro_itg.data_available) { RATES_COPY(imu.gyro_unscaled, imu_aspirin.gyro_itg.data.rates); imu_aspirin.gyro_itg.data_available = FALSE; imu_scale_gyro(&imu); AbiSendMsgIMU_GYRO_INT32(IMU_ASPIRIN_ID, now_ts, &imu.gyro); } /* HMC58XX event task */ hmc58xx_event(&imu_aspirin.mag_hmc); if (imu_aspirin.mag_hmc.data_available) { #ifdef IMU_ASPIRIN_VERSION_1_0 VECT3_COPY(imu.mag_unscaled, imu_aspirin.mag_hmc.data.vect); #else // aspirin 1.5 with hmc5883 imu.mag_unscaled.x = imu_aspirin.mag_hmc.data.vect.y; imu.mag_unscaled.y = -imu_aspirin.mag_hmc.data.vect.x; imu.mag_unscaled.z = imu_aspirin.mag_hmc.data.vect.z; #endif imu_aspirin.mag_hmc.data_available = FALSE; imu_scale_mag(&imu); AbiSendMsgIMU_MAG_INT32(IMU_ASPIRIN_ID, now_ts, &imu.mag); } }