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

IMU driver for the sensors inside the Pixhawk 6X autopilots

  • IMU1: ICM42670
  • IMU2: ???
  • IMU3: ???

Example for airframe file

Add to your firmware section:

<module name="imu_pixhawk6x"/>

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_pixhawk6x_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_pixhawk6x.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="imu_pixhawk6x" dir="imu" task="sensors">
<doc>
<description>
IMU driver for the sensors inside the Pixhawk 6X autopilots
- IMU1: ICM42670
- IMU2: ???
- IMU3: ???
</description>
</doc>
<dep>
<depends>spi_master,i2c,imu_common,imu_heater</depends>
<provides>imu</provides>
</dep>
<header>
<file name="imu_pixhawk6x.h"/>
</header>
<init fun="imu_pixhawk6x_init()"/>
<periodic fun="imu_pixhawk6x_periodic()"/>
<event fun="imu_pixhawk6x_event()"/>
<makefile target="!sim|nps|fbw">
<!-- Files -->
<file name="invensense2.c" dir="peripherals"/>
<file name="invensense3.c" dir="peripherals"/>
<file name="imu_pixhawk6x.c"/>
<!-- IMU1: ICM42670 -->
<configure name="PIXHAWK6X_IMU1_SPI_DEV" default="spi1" case="lower|upper"/>
<configure name="PIXHAWK6X_IMU1_SPI_SLAVE_IDX" default="SPI_SLAVE1"/>
<define name="PIXHAWK6X_IMU1_SPI_DEV" value="$(PIXHAWK6X_IMU1_SPI_DEV_LOWER)"/>
<define name="USE_$(PIXHAWK6X_IMU1_SPI_DEV_UPPER)"/>
<define name="PIXHAWK6X_IMU1_SPI_SLAVE_IDX" value="$(PIXHAWK6X_IMU1_SPI_SLAVE_IDX)"/>
<define name="USE_$(PIXHAWK6X_IMU1_SPI_SLAVE_IDX)"/>
<!-- IMU2: ICM42688-->
<configure name="PIXHAWK6X_IMU2_SPI_DEV" default="spi2" case="lower|upper"/>
<configure name="PIXHAWK6X_IMU2_SPI_SLAVE_IDX" default="SPI_SLAVE2"/>
<define name="PIXHAWK6X_IMU2_SPI_DEV" value="$(PIXHAWK6X_IMU2_SPI_DEV_LOWER)"/>
<define name="USE_$(PIXHAWK6X_IMU2_SPI_DEV_UPPER)"/>
<define name="PIXHAWK6X_IMU2_SPI_SLAVE_IDX" value="$(PIXHAWK6X_IMU2_SPI_SLAVE_IDX)"/>
<define name="USE_$(PIXHAWK6X_IMU2_SPI_SLAVE_IDX)"/>
<!-- IMU3: BMI088 / ICM20649 -->
<configure name="PIXHAWK6X_IMU3_SPI_DEV" default="spi3" case="lower|upper"/>
<configure name="PIXHAWK6X_IMU3_SPI_SLAVE_IDX" default="SPI_SLAVE3"/>
<define name="PIXHAWK6X_IMU3_SPI_DEV" value="$(PIXHAWK6X_IMU3_SPI_DEV_LOWER)"/>
<define name="USE_$(PIXHAWK6X_IMU3_SPI_DEV_UPPER)"/>
<define name="PIXHAWK6X_IMU3_SPI_SLAVE_IDX" value="$(PIXHAWK6X_IMU3_SPI_SLAVE_IDX)"/>
<define name="USE_$(PIXHAWK6X_IMU3_SPI_SLAVE_IDX)"/>
<!-- Configure the heater (ICM42688) -->
<define name="IMU_HEATER_GYRO_ID" value="IMU_PIXHAWK2_ID"/>
<define name="IMU_HEATER_TARGET_TEMP" value="45.0"/>
<define name="IMU_HEATER_P_GAIN" value="50.0"/>
<define name="IMU_HEATER_I_GAIN" value="0.07"/>
<test>
<define name="SPI_MASTER"/>
<define name="PIXHAWK6X_IMU1_SPI_DEV" value="spi1"/>
<define name="PIXHAWK6X_IMU1_SPI_SLAVE_IDX" value="1"/>
<define name="PIXHAWK6X_IMU2_SPI_DEV" value="spi2"/>
<define name="PIXHAWK6X_IMU2_SPI_SLAVE_IDX" value="2"/>
<define name="PIXHAWK6X_IMU3_SPI_DEV" value="spi3"/>
<define name="PIXHAWK6X_IMU3_SPI_SLAVE_IDX" value="3"/>
<define name="USE_SPI1"/>
<define name="USE_SPI2"/>
<define name="USE_SPI3"/>
<define name="USE_SPI_SLAVE1"/>
<define name="USE_SPI_SLAVE2"/>
<define name="USE_SPI_SLAVE3"/>
<define name="PERIODIC_FREQUENCY" value="512"/>
<define name="IMU_PIXHAWK6X_PERIODIC_FREQ" value="512"/>
</test>
</makefile>
</module>