Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
imu_px4fmu_v2.4 module

PX4 Pixhawk IMU via SPI.

Consists of two (internal) IMU's and one internal magneto. Also an optional external magneto. L3GD20 + LSM303D

Example for airframe file

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

1 <module name="imu_px4fmu_v2.4">
2  <define name="IMU_PX4_DISABLE_MAG" value="FALSE" />
3  <configure name="IMU_PX4FMU_SPI_DEV" value="spi1" />
4  <configure name="IMU_L3G_SPI_SLAVE_IDX" value="SPI_SLAVE0" />
5  <configure name="IMU_LSM_SPI_SLAVE_IDX" value="SPI_SLAVE1" />
6 </module>

Module configuration options

Configure Options

  • name: IMU_PX4FMU_SPI_DEV value: spi1
    Description: SPI device to use
  • name: IMU_L3G_SPI_SLAVE_IDX value: SPI_SLAVE0
    Description: slave select pin for the L3GD20
    Description: slave select pin for the LSM303D

Define Options

  • name: IMU_PX4_DISABLE_MAG value: FALSE
    Description: define to TRUE to disable the mag on the Pixhawk

Auto-loaded modules

The following modules are automatically loaded (just as if you had added them in the airframe file)

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_px4_periodic()
    • Running at maximum module frequency.
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.


Header Files

The following headers are automatically included in modules.h

  • imu_px4fmu_v2.4.h

Source Files

<!DOCTYPE module SYSTEM "module.dtd">
<module name="imu_px4fmu_v2.4" dir="imu">
PX4 Pixhawk IMU via SPI.
Consists of two (internal) IMU's and one internal magneto. Also an optional external magneto.
L3GD20 + LSM303D
<configure name="IMU_PX4FMU_SPI_DEV" value="spi1" description="SPI device to use"/>
<configure name="IMU_L3G_SPI_SLAVE_IDX" value="SPI_SLAVE0" description="slave select pin for the L3GD20"/>
<configure name="IMU_LSM_SPI_SLAVE_IDX" value="SPI_SLAVE1" description="slave select pin for the LSM303D"/>
<define name="IMU_PX4_DISABLE_MAG" value="FALSE" description="define to TRUE to disable the mag on the Pixhawk"/>
<autoload name="imu_common"/>
<autoload name="imu_nps"/>
<file name="imu_px4fmu_v2.4.h" dir="subsystems/imu"/>
<init fun="imu_px4_init()"/>
<periodic fun="imu_px4_periodic()"/>
<event fun="imu_px4_event()"/>
<makefile target="!sim|nps|fbw">
<configure name="IMU_PX4FMU_SPI_DEV" default="spi1" case="lower|upper"/>
<define name="IMU_PX4FMU_SPI_DEV" value="$(IMU_PX4FMU_SPI_DEV_LOWER)"/>
<define name="USE_$(IMU_PX4FMU_SPI_DEV_UPPER)"/>
<!-- L3GD20 -->
<configure name="IMU_L3G_SPI_SLAVE_IDX" default="SPI_SLAVE0"/>
<define name="USE_$(IMU_L3G_SPI_SLAVE_IDX)"/>
<define name="IMU_L3G_SPI_SLAVE_IDX" value="$(IMU_L3G_SPI_SLAVE_IDX)"/>
<!-- LSM303d -->
<configure name="IMU_LSM_SPI_SLAVE_IDX" default="SPI_SLAVE1"/>
<define name="USE_$(IMU_LSM_SPI_SLAVE_IDX)"/>
<define name="IMU_LSM_SPI_SLAVE_IDX" value="$(IMU_LSM_SPI_SLAVE_IDX)"/>
<define name="IMU_TYPE_H" value="imu/imu_px4fmu_v2.4.h" type="string"/>
<file name="l3gd20_spi.c" dir="peripherals"/>
<file name="lsm303d_spi.c" dir="peripherals"/>
<file name="hmc58xx.c" dir="peripherals"/>
<file name="imu_px4fmu_v2.4.c" dir="subsystems/imu"/>
include $(CFG_SHARED)/spi_master.makefile