Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
imu_openpilot_revo_nano module

IMU driver for OpenPilot Revo Nano.

MPU9250 via SPI2. Reads the internal AK8963 mag as I2C slave of the MPU.

Example for airframe file

Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!

<module name="imu_openpilot_revo_nano">
b'<define name="IMU_MPU9250_GYRO_LOWPASS_FILTER" value="MPU9250_DLPF_GYRO_250HZ" />\n '
b'<define name="IMU_MPU9250_ACCEL_LOWPASS_FILTER" value="MPU9250_DLPF_ACCEL_184HZ" />\n '
b'<define name="IMU_MPU9250_SMPLRT_DIV" value="3" />\n '
b'<define name="IMU_MPU9250_GYRO_RANGE" value="MPU9250_GYRO_RANGE_1000" />\n '
b'<define name="IMU_MPU9250_ACCEL_RANGE" value="MPU9250_ACCEL_RANGE_8G" />\n '
b'<define name="IMU_MPU9250_READ_MAG" value="TRUE" />\n '
b'<define name="IMU_MPU9250_STARTUP_DELAY" value="1.0" />\n\n '
b'<define name="IMU_MPU9250_CHAN_X" value="0" />\n '
b'<define name="IMU_MPU9250_CHAN_Y" value="1" />\n '
b'<define name="IMU_MPU9250_CHAN_Z" value="2" />\n '
b'<define name="IMU_MPU9250_X_SIGN" value="1" />\n '
b'<define name="IMU_MPU9250_Y_SIGN" value="1" />\n '
b'<define name="IMU_MPU9250_Z_SIGN" value="1" />\n '
</module>

Module configuration options

Define Options

  • name: IMU_MPU9250_GYRO_LOWPASS_FILTER value: MPU9250_DLPF_GYRO_250HZ
    Description: gyro DigitalLowPassFilter setting of the MPU
  • name: IMU_MPU9250_ACCEL_LOWPASS_FILTER value: MPU9250_DLPF_ACCEL_184HZ
    Description: accelerometer DigitalLowPassFilter setting of the MPU
  • name: IMU_MPU9250_SMPLRT_DIV value: 3
    Description: sample rate divider setting of the MPU
  • name: IMU_MPU9250_GYRO_RANGE value: MPU9250_GYRO_RANGE_1000
    Description: gyroscope range setting of the MPU
  • name: IMU_MPU9250_ACCEL_RANGE value: MPU9250_ACCEL_RANGE_8G
    Description: accelerometer range setting of the MPU
  • name: IMU_MPU9250_READ_MAG value: TRUE
    Description: set to FALSE to disable mag
  • name: IMU_MPU9250_STARTUP_DELAY value: 1.0
    Description: startup delay in seconds until mag slave is configured
  • name: IMU_MPU9250_CHAN_X value: 0
    Description: channel index
  • name: IMU_MPU9250_CHAN_Y value: 1
    Description: channel index
  • name: IMU_MPU9250_CHAN_Z value: 2
    Description: channel index
  • name: IMU_MPU9250_X_SIGN value: 1
    Description: axis sign
  • name: IMU_MPU9250_Y_SIGN value: 1
    Description: axis sign
  • name: IMU_MPU9250_Z_SIGN value: 1
    Description: axis sign

Module functions

Init Functions

These initialization functions are called once on startup.

Event Functions

These event functions are called in each cycle of the module event loop.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • imu_mpu9250_periodic()
    • Running at maximum module frequency.
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw imu_openpilot_revo_nano.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="imu_openpilot_revo_nano" dir="imu" task="sensors">
<doc>
<description>
IMU driver for OpenPilot Revo Nano.
MPU9250 via SPI2.
Reads the internal AK8963 mag as I2C slave of the MPU.
</description>
<define name="IMU_MPU9250_GYRO_LOWPASS_FILTER" value="MPU9250_DLPF_GYRO_250HZ" description="gyro DigitalLowPassFilter setting of the MPU"/>
<define name="IMU_MPU9250_ACCEL_LOWPASS_FILTER" value="MPU9250_DLPF_ACCEL_184HZ" description="accelerometer DigitalLowPassFilter setting of the MPU"/>
<define name="IMU_MPU9250_SMPLRT_DIV" value="3" description="sample rate divider setting of the MPU"/>
<define name="IMU_MPU9250_GYRO_RANGE" value="MPU9250_GYRO_RANGE_1000" description="gyroscope range setting of the MPU"/>
<define name="IMU_MPU9250_ACCEL_RANGE" value="MPU9250_ACCEL_RANGE_8G" description="accelerometer range setting of the MPU"/>
<define name="IMU_MPU9250_READ_MAG" value="TRUE" description="set to FALSE to disable mag"/>
<define name="IMU_MPU9250_STARTUP_DELAY" value="1.0" description="startup delay in seconds until mag slave is configured"/>
<define name="IMU_MPU9250_CHAN_X" value="0" description="channel index"/>
<define name="IMU_MPU9250_CHAN_Y" value="1" description="channel index"/>
<define name="IMU_MPU9250_CHAN_Z" value="2" description="channel index"/>
<define name="IMU_MPU9250_X_SIGN" value="1" description="axis sign"/>
<define name="IMU_MPU9250_Y_SIGN" value="1" description="axis sign"/>
<define name="IMU_MPU9250_Z_SIGN" value="1" description="axis sign"/>
</doc>
<dep>
<depends>spi_master,imu_common</depends>
<provides>imu,mag</provides>
</dep>
<header>
<file name="imu_mpu9250_spi.h"/>
</header>
<init fun="imu_mpu9250_init()"/>
<periodic fun="imu_mpu9250_periodic()"/>
<event fun="imu_mpu9250_event()"/>
<makefile target="!sim|nps|fbw">
<define name="IMU_MPU9250_SPI_DEV" value="spi2"/>
<define name="USE_SPI2"/>
<define name="IMU_MPU9250_SPI_SLAVE_IDX" value="SPI_SLAVE0"/>
<define name="USE_SPI_SLAVE0"/>
<file name="mpu9250.c" dir="peripherals"/>
<file name="mpu9250_spi.c" dir="peripherals"/>
<file name="imu_mpu9250_spi.c"/>
</makefile>
</module>