Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
imu.h File Reference

Inertial Measurement Unit interface. More...

#include "math/pprz_algebra_int.h"
#include "math/pprz_algebra_float.h"
#include "generated/airframe.h"
+ Include dependency graph for imu.h:

Go to the source code of this file.

Data Structures

struct  Imu
 abstract IMU interface providing fixed point interface More...
 
struct  ImuFloat
 abstract IMU interface providing floating point interface More...
 

Macros

#define IMU_BODY_TO_IMU_PHI   0
 
#define IMU_BODY_TO_IMU_THETA   0
 
#define IMU_BODY_TO_IMU_PSI   0
 
#define IMU_GYRO_P_NEUTRAL   0
 
#define IMU_GYRO_Q_NEUTRAL   0
 
#define IMU_GYRO_R_NEUTRAL   0
 
#define IMU_ACCEL_X_NEUTRAL   0
 
#define IMU_ACCEL_Y_NEUTRAL   0
 
#define IMU_ACCEL_Z_NEUTRAL   0
 
#define ImuScaleGyro(_imu)
 
#define ImuScaleAccel(_imu)
 
#define ImuScaleMag(_imu)
 

Functions

void imu_impl_init (void)
 
void imu_periodic (void)
 
void imu_float_init (struct ImuFloat *imuf)
 
void imu_init (void)
 

Variables

struct Imu imu
 global IMU state More...
 

Detailed Description

Inertial Measurement Unit interface.

Definition in file imu.h.

Macro Definition Documentation

#define IMU_ACCEL_X_NEUTRAL   0

Definition at line 93 of file imu.h.

#define IMU_ACCEL_Y_NEUTRAL   0

Definition at line 94 of file imu.h.

#define IMU_ACCEL_Z_NEUTRAL   0

Definition at line 95 of file imu.h.

#define IMU_BODY_TO_IMU_PHI   0

Definition at line 81 of file imu.h.

Referenced by ahrs_init(), imu_float_init(), and imu_init().

#define IMU_BODY_TO_IMU_PSI   0

Definition at line 83 of file imu.h.

Referenced by ahrs_init(), imu_float_init(), and imu_init().

#define IMU_BODY_TO_IMU_THETA   0

Definition at line 82 of file imu.h.

Referenced by ahrs_init(), imu_float_init(), and imu_init().

#define IMU_GYRO_P_NEUTRAL   0

Definition at line 87 of file imu.h.

#define IMU_GYRO_Q_NEUTRAL   0

Definition at line 88 of file imu.h.

#define IMU_GYRO_R_NEUTRAL   0

Definition at line 89 of file imu.h.

#define ImuScaleAccel (   _imu)
Value:
{ \
VECT3_COPY(_imu.accel_prev, _imu.accel); \
_imu.accel.x = ((_imu.accel_unscaled.x - _imu.accel_neutral.x)*IMU_ACCEL_X_SIGN*IMU_ACCEL_X_SENS_NUM)/IMU_ACCEL_X_SENS_DEN; \
_imu.accel.y = ((_imu.accel_unscaled.y - _imu.accel_neutral.y)*IMU_ACCEL_Y_SIGN*IMU_ACCEL_Y_SENS_NUM)/IMU_ACCEL_Y_SENS_DEN; \
_imu.accel.z = ((_imu.accel_unscaled.z - _imu.accel_neutral.z)*IMU_ACCEL_Z_SIGN*IMU_ACCEL_Z_SENS_NUM)/IMU_ACCEL_Z_SENS_DEN; \
}
#define IMU_ACCEL_X_SIGN
Definition: imu_apogee.h:46
#define IMU_ACCEL_Z_SIGN
Definition: imu_apogee.h:48
#define IMU_ACCEL_Y_SENS_DEN
Definition: imu_apogee.h:86
#define IMU_ACCEL_Y_SIGN
Definition: imu_apogee.h:47
#define IMU_ACCEL_Z_SENS_DEN
Definition: imu_apogee.h:89
#define IMU_ACCEL_X_SENS_DEN
Definition: imu_apogee.h:83
#define VECT3_COPY(_a, _b)
Definition: pprz_algebra.h:111
#define IMU_ACCEL_Y_SENS_NUM
Definition: imu_apogee.h:85
#define IMU_ACCEL_Z_SENS_NUM
Definition: imu_apogee.h:88
#define IMU_ACCEL_X_SENS_NUM
Definition: imu_apogee.h:82

Definition at line 110 of file imu.h.

#define ImuScaleGyro (   _imu)
Value:
{ \
RATES_COPY(_imu.gyro_prev, _imu.gyro); \
_imu.gyro.p = ((_imu.gyro_unscaled.p - _imu.gyro_neutral.p)*IMU_GYRO_P_SIGN*IMU_GYRO_P_SENS_NUM)/IMU_GYRO_P_SENS_DEN; \
_imu.gyro.q = ((_imu.gyro_unscaled.q - _imu.gyro_neutral.q)*IMU_GYRO_Q_SIGN*IMU_GYRO_Q_SENS_NUM)/IMU_GYRO_Q_SENS_DEN; \
_imu.gyro.r = ((_imu.gyro_unscaled.r - _imu.gyro_neutral.r)*IMU_GYRO_R_SIGN*IMU_GYRO_R_SENS_NUM)/IMU_GYRO_R_SENS_DEN; \
}
#define IMU_GYRO_Q_SENS_DEN
Definition: imu_apogee.h:63
#define IMU_GYRO_P_SIGN
Definition: imu_apogee.h:41
#define RATES_COPY(_a, _b)
Definition: pprz_algebra.h:301
#define IMU_GYRO_Q_SENS_NUM
Definition: imu_apogee.h:62
#define IMU_GYRO_P_SENS_NUM
Definition: imu_apogee.h:59
#define IMU_GYRO_R_SENS_NUM
Definition: imu_apogee.h:65
#define IMU_GYRO_P_SENS_DEN
Definition: imu_apogee.h:60
#define IMU_GYRO_R_SIGN
Definition: imu_apogee.h:43
#define IMU_GYRO_R_SENS_DEN
Definition: imu_apogee.h:66
#define IMU_GYRO_Q_SIGN
Definition: imu_apogee.h:42

Definition at line 100 of file imu.h.

#define ImuScaleMag (   _imu)
Value:
{ \
_imu.mag.x = ((_imu.mag_unscaled.x - _imu.mag_neutral.x) * IMU_MAG_X_SIGN * IMU_MAG_X_SENS_NUM) / IMU_MAG_X_SENS_DEN; \
_imu.mag.y = ((_imu.mag_unscaled.y - _imu.mag_neutral.y) * IMU_MAG_Y_SIGN * IMU_MAG_Y_SENS_NUM) / IMU_MAG_Y_SENS_DEN; \
_imu.mag.z = ((_imu.mag_unscaled.z - _imu.mag_neutral.z) * IMU_MAG_Z_SIGN * IMU_MAG_Z_SENS_NUM) / IMU_MAG_Z_SENS_DEN; \
}
#define IMU_MAG_X_SIGN
Definition: imu_navgo.h:56
#define IMU_MAG_Z_SIGN
Definition: imu_navgo.h:58
#define IMU_MAG_Y_SIGN
Definition: imu_navgo.h:57

Definition at line 138 of file imu.h.

Function Documentation

void imu_impl_init ( void  )
Todo:
drdy int handling for adxl345
Todo:
eoc interrupt for itg3200, polling for now (including status reg)
Todo:
drdy int handling for adxl345
Todo:
eoc interrupt for itg3200, polling for now (including status reg)

Definition at line 64 of file imu_apogee.c.

References ImuAspirin::acc_adxl, ImuAspirinI2c::acc_adxl, ImuPpzuav::acc_adxl, ACC_FILT_DIV, ImuNavgo::acc_valid, ImuApogee::acc_valid, ImuUmarim::acc_valid, ImuXsens::accel_available, ImuNps::accel_available, Mpu60x0Config::accel_range, ImuAspirin::accel_valid, ImuAspirinI2c::accel_valid, ImuAspirin2Spi::accel_valid, ImuPpzuav::accel_valid, ImuDrotek2::accel_valid, adc_buf_channel(), ADS8344_available, ImuNavgo::adxl, ImuUmarim::adxl, ADXL345_ADDR, ADXL345_ADDR_ALT, adxl345_i2c_init(), adxl345_spi_init(), spi_transaction::after_cb, ahrs_align(), ami601_init(), analog_imu_adc_buf, analog_imu_available, APOGEE_ACCEL_RANGE, APOGEE_GYRO_RANGE, APOGEE_LOWPASS_FILTER, APOGEE_SMPLRT_DIV, aspirin2_mpu60x0, ASPIRIN_2_ACCEL_RANGE, ASPIRIN_2_GYRO_RANGE, ASPIRIN_2_SPI_DEV, ASPIRIN_2_SPI_SLAVE_IDX, ASPIRIN_ACCEL_RATE, ASPIRIN_GYRO_LOWPASS, ASPIRIN_GYRO_SMPLRT_DIV, ASPIRIN_I2C_DEV, ASPIRIN_SPI_DEV, ASPIRIN_SPI_SLAVE_IDX, spi_transaction::before_cb, spi_transaction::bitorder, i2c_transaction::buf, buf_out, spi_transaction::cdiv, GX3_packet::chksm_error, UM6Packet::chksm_error, Adxl345_I2c::config, Adxl345_Spi::config, Mpu60x0_Spi::config, Mpu60x0_I2c::config, Itg3200::config, Mpu60x0I2cSlave::configure, spi_transaction::cpha, spi_transaction::cpol, data_chk, Itg3200Config::dlpf_cfg, Mpu60x0Config::dlpf_cfg, DROTEK_2_ACCEL_RANGE, DROTEK_2_GYRO_RANGE, DROTEK_2_HMC_I2C_ADDR, DROTEK_2_LOWPASS_FILTER, DROTEK_2_MPU_I2C_ADDR, DROTEK_2_SMPLRT_DIV, spi_transaction::dss, FALSE, gpio_output_high(), gpio_setup_output(), GX3_status, GX3Link, GX3PacketWaiting, GX3Uninit, ImuNavgo::gyr_valid, ImuApogee::gyr_valid, ImuUmarim::gyr_valid, ImuXsens::gyro_available, ImuNps::gyro_available, ImuAspirin::gyro_itg, ImuAspirinI2c::gyro_itg, ImuPpzuav::gyro_itg, Mpu60x0Config::gyro_range, ImuAspirin::gyro_valid, ImuAspirinI2c::gyro_valid, ImuAspirin2Spi::gyro_valid, ImuPpzuav::gyro_valid, ImuDrotek2::gyro_valid, GX3_packet::hdr_error, UM6Packet::hdr_error, ImuNavgo::hmc, ImuDrotek2::hmc, hmc5843_init(), HMC58XX_ADDR, hmc58xx_init(), HMC_TYPE_5843, Mpu60x0Config::i2c_bypass, Mpu60x0Config::i2c_mst_clk, Mpu60x0Config::i2c_mst_delay, i2c_transmit(), I2CTransPending, imu_aspirin2, imu_aspirin2_configure_mag_slave(), imu_aspirin_arch_init(), imu_b2, imu_crista_arch_init(), imu_data_available, IMU_DIV1, IMU_DIV2, imu_drotek2_configure_mag_slave(), IMU_GX3_LONG_DELAY, imu_navgo, imu_nps, imu_overrun, IMU_PPZUAV_ACCEL_RATE, IMU_PPZUAV_GYRO_LOWPASS, IMU_PPZUAV_GYRO_SMPLRT_DIV, IMU_PPZUAV_I2C_DEV, IMU_UM6_COMMUNICATION_REG, IMU_UM6_MISC_CONFIG_REG, imu_xsens, InitMedianFilterRatesInt, InitMedianFilterVect3Int, spi_transaction::input_buf, spi_transaction::input_length, ImuNavgo::itg, ImuUmarim::itg, ITG3200_ADDR, ITG3200_ADDR_ALT, itg3200_init(), ImuXsens::mag_available, ImuNps::mag_available, MAG_FILT_DIV, ImuAspirin::mag_hmc, ImuAspirinI2c::mag_hmc, ImuPpzuav::mag_hmc, ImuAspirin::mag_valid, ImuAspirinI2c::mag_valid, ImuAspirin2Spi::mag_valid, ImuNavgo::mag_valid, ImuPpzuav::mag_valid, ImuDrotek2::mag_valid, max1168_init(), ImuAspirin2Spi::mpu, ImuApogee::mpu, ImuDrotek2::mpu, MPU60X0_ADDR, MPU60X0_ADDR_ALT, mpu60x0_i2c_init(), MPU60X0_MST_CLK_400KHZ, MPU60X0_REG_ACCEL_CONFIG, MPU60X0_REG_CONFIG, MPU60X0_REG_GYRO_CONFIG, MPU60X0_REG_PWR_MGMT_1, MPU60X0_REG_SMPLRT_DIV, mpu60x0_spi_init(), mpu_wait_slave4_ready_cb(), ms2100, ms2100_init(), GX3_packet::msg_available, UM6Packet::msg_available, GX3_packet::msg_idx, UM6Packet::msg_idx, navdata_init(), NAVGO_ACCEL_RATE, NAVGO_GYRO_LOWPASS, NAVGO_GYRO_SMPLRT_DIV, Mpu60x0Config::nb_bytes, Mpu60x0Config::nb_slaves, spi_transaction::output_buf, spi_transaction::output_length, Adxl345Config::rate, spi_transaction::select, ImuAspirin2Spi::slave4_ready, spi_transaction::slave_idx, Mpu60x0Config::slaves, Itg3200Config::smplrt_div, Mpu60x0Config::smplrt_div, SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, i2c_transaction::status, GX3_packet::status, UM6Packet::status, spi_transaction::status, TRUE, Hmc58xx::type, UM6_calculate_checksum(), UM6_imu_align(), UM6_packet, UM6_send_packet(), UM6_status, UM6PacketWaiting, UM6Uninit, UMARIM_ACCEL_RATE, UMARIM_GYRO_LOWPASS, UMARIM_GYRO_SMPLRT_DIV, ImuAspirin2Spi::wait_slave4_rx_buf, ImuAspirin2Spi::wait_slave4_trans, ImuAspirin2Spi::wait_slave4_tx_buf, and xsens_init().

Referenced by imu_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void imu_periodic ( void  )

Definition at line 79 of file imu_apogee.c.

References ImuAspirin::acc_adxl, ImuAspirinI2c::acc_adxl, ImuPpzuav::acc_adxl, Imu::accel_unscaled, ImuNavgo::adxl, ImuUmarim::adxl, adxl345_i2c_periodic(), adxl345_spi_periodic(), ami601_read(), analog_imu_adc_buf, analog_imu_available, aspirin2_mpu60x0, measures_t::ax, measures_t::ay, measures_t::az, i2c_transaction::buf, Mpu60x0_I2c::config, FALSE, ImuAspirin::gyro_itg, ImuAspirinI2c::gyro_itg, ImuPpzuav::gyro_itg, Imu::gyro_unscaled, adc_buf::head, ImuNavgo::hmc, ImuDrotek2::hmc, hmc5843_periodic(), hmc58xx_periodic(), hmc58xx_read(), i2c_transceive(), imu, imu_apogee, imu_aspirin, imu_aspirin2, imu_b2, imu_data_available, imu_drotek2, imu_navgo, imu_overrun, imu_ppzuav, imu_umarim, ImuCristaArchPeriodic, Mpu60x0Config::initialized, ins, ins_periodic_task(), ImuNavgo::itg, ImuUmarim::itg, itg3200_periodic(), ImuAspirin::mag_hmc, ImuAspirinI2c::mag_hmc, ImuPpzuav::mag_hmc, Imu::mag_unscaled, Max1168Periodic, ImuAspirin2Spi::mpu, ImuApogee::mpu, ImuDrotek2::mpu, MPU60X0_ADDR, mpu60x0_i2c_periodic(), MPU60X0_REG_INT_STATUS, mpu60x0_spi_periodic(), ms2100, ms2100_periodic(), measures_t::mx, measures_t::my, measures_t::mz, navdata, navdata_imu_available, navdata_update(), NAVGO_ACCEL_RATE, Int32Rates::p, PERIODIC_FREQUENCY, Int32Rates::q, Int32Rates::r, RATES_ASSIGN, adc_buf::sum, TRUE, UM6_imu_align(), VECT3_ASSIGN, Ins::vf_realign, measures_t::vx, measures_t::vy, measures_t::vz, Int32Vect3::x, xsens_periodic(), Int32Vect3::y, and Int32Vect3::z.

Referenced by main_periodic(), main_periodic_task(), and sensors_task().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation