Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
imu_b2_common module

Common part for all Booz2 IMUs.

No detailed description...

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_b2_common">
2  <configure name="GYRO_P" value="ADC_0" />
3  <configure name="GYRO_Q" value="ADC_1" />
4  <configure name="GYRO_R" value="ADC_2" />
5  <configure name="ACCEL_X" value="ADC_5" />
6  <configure name="ACCEL_Y" value="ADC_6" />
7  <configure name="ACCEL_Z" value="ADC_7" />
8  <configure name="ADC_GYRO_NB_SAMPLES" value="16" />
9  <configure name="ADC_ACCEL_NB_SAMPLES" value="16" />
10 </module>

Module configuration options

Configure Options

  • name: GYRO_P value: ADC_0
  • name: GYRO_Q value: ADC_1
  • name: GYRO_R value: ADC_2
  • name: ACCEL_X value: ADC_5
  • name: ACCEL_Y value: ADC_6
  • name: ACCEL_Z value: ADC_7
  • name: ADC_GYRO_NB_SAMPLES value: 16
  • name: ADC_ACCEL_NB_SAMPLES value: 16

Airframe file section

  • section name: IMU prefix: IMU_
    • name GYRO_X_NEUTRAL value: 33924
    • name GYRO_Y_NEUTRAL value: 33417
    • name GYRO_Z_NEUTRAL value: 32809
    • name GYRO_X_SENS value: 1.01
    • name GYRO_Y_SENS value: 1.01
    • name GYRO_Z_SENS value: 1.01
    • name ACCEL_X_NEUTRAL value: 32081
    • name ACCEL_Y_NEUTRAL value: 33738
    • name ACCEL_Z_NEUTRAL value: 32441
    • name ACCEL_X_SENS value: 2.50411474
    • name ACCEL_Y_SENS value: 2.48126183
    • name ACCEL_Z_SENS value: 2.51396167
    • name MAG_X_NEUTRAL value: 2358
    • name MAG_Y_NEUTRAL value: 2362
    • name MAG_Z_NEUTRAL value: 2119
    • name MAG_X_SENS value: 3.4936416
    • name MAG_Y_SENS value: 3.607713
    • name MAG_Z_SENS value: 4.90788848
    • name MAG_45_HACK value: 1

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_b2_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_b2_common.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="imu_b2_common" dir="imu">
<doc>
<description>
Common part for all Booz2 IMUs.
</description>
<configure name="GYRO_P" value="ADC_0"/>
<configure name="GYRO_Q" value="ADC_1"/>
<configure name="GYRO_R" value="ADC_2"/>
<configure name="ACCEL_X" value="ADC_5"/>
<configure name="ACCEL_Y" value="ADC_6"/>
<configure name="ACCEL_Z" value="ADC_7"/>
<configure name="ADC_GYRO_NB_SAMPLES" value="16"/>
<configure name="ADC_ACCEL_NB_SAMPLES" value="16"/>
<section name="IMU" prefix="IMU_">
<define name="GYRO_X_NEUTRAL" value="33924"/>
<define name="GYRO_Y_NEUTRAL" value="33417"/>
<define name="GYRO_Z_NEUTRAL" value="32809"/>
<define name="GYRO_X_SENS" value="1.01" integer="16"/>
<define name="GYRO_Y_SENS" value="1.01" integer="16"/>
<define name="GYRO_Z_SENS" value="1.01" integer="16"/>
<define name="ACCEL_X_NEUTRAL" value="32081"/>
<define name="ACCEL_Y_NEUTRAL" value="33738"/>
<define name="ACCEL_Z_NEUTRAL" value="32441"/>
<define name="ACCEL_X_SENS" value="2.50411474" integer="16"/>
<define name="ACCEL_Y_SENS" value="2.48126183" integer="16"/>
<define name="ACCEL_Z_SENS" value="2.51396167" integer="16"/>
<define name="MAG_X_NEUTRAL" value="2358"/>
<define name="MAG_Y_NEUTRAL" value="2362"/>
<define name="MAG_Z_NEUTRAL" value="2119"/>
<define name="MAG_X_SENS" value="3.4936416" integer="16"/>
<define name="MAG_Y_SENS" value="3.607713" integer="16"/>
<define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
<define name="MAG_45_HACK" value="1"/>
</section>
</doc>
<autoload name="imu_common"/>
<autoload name="imu_nps"/>
<header>
<file name="imu_b2.h" dir="subsystems/imu"/>
</header>
<init fun="imu_b2_init()"/>
<periodic fun="imu_b2_periodic()"/>
<event fun="imu_b2_event()"/>
<makefile target="!sim|nps|fbw">
<define name="IMU_TYPE_H" value="subsystems/imu/imu_b2.h" type="string"/>
<file name="imu_b2.c" dir="subsystems/imu"/>
<file name="max1168.c" dir="peripherals"/>
<file name="max1168_arch.c" dir="$(SRC_ARCH)/peripherals"/>
<raw>
include $(CFG_SHARED)/spi_master.makefile
ifeq ($(ARCH), lpc21)
$(TARGET).CFLAGS += -DUSE_SPI_SLAVE0
$(TARGET).CFLAGS += -DUSE_SPI1
$(TARGET).CFLAGS += -DMAX1168_EOC_VIC_SLOT=11
else ifeq ($(ARCH), stm32)
#FIXME: untested
$(TARGET).CFLAGS += -DUSE_SPI2 -DMAX1168_SPI_DEV=spi2
$(TARGET).CFLAGS += -DMAX1168_SLAVE_IDX=2
# Slave select configuration
# SLAVE2 is on PB12 (NSS) (MAX1168)
# SLAVE3 is on PC13 (EEPROM)
$(TARGET).CFLAGS += -DUSE_SPI_SLAVE2 -DUSE_SPI_SLAVE3
endif
</raw>
</makefile>
</module>