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
ahrs_int_cmpl_euler module

AHRS using complementary filter in fixed point.

Propagation is done in euler angles representation. Not recommended for fixedwings, as this filter doesn't compensate for centrifugal force when flying turns. Magnetometer is always only used for heading (yaw). Does not handle the accel and mag updates correctly if BODY_TO_IMU is used for more than just adjustment by a few degrees. In general, rather use int_cmpl_quat

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="ahrs_int_cmpl_euler">
2  <define name="AHRS_MAG_OFFSET" value="0.0" />
3  <define name="USE_NOISE_FILTER" />
4  <define name="USE_NOISE_CUT" />
5  <define name="AHRS_ICE_IMU_ID" value="ABI_BROADCAST" />
6  <define name="AHRS_ICE_MAG_ID" value="ABI_BROADCAST" />
7  <configure name="USE_MAGNETOMETER" value="TRUE" />
8  <configure name="AHRS_ALIGNER_LED" value="1" />
9 </module>

Module configuration options

Configure Options

  • name: USE_MAGNETOMETER value: TRUE
    Description: set to FALSE to disable magnetometer
  • name: AHRS_ALIGNER_LED value: 1
    Description: LED number to indicate AHRS alignment, none to disable (default is board dependent)

Define Options

  • name: AHRS_MAG_OFFSET value: 0.0
    Description: offset in radians to subtract from the heading calculated by the magnetometer
  • name: USE_NOISE_FILTER value: None
    Description: apply a simple filter on the rate and accel inputs
  • name: USE_NOISE_CUT value: None
    Description: cut rate input at 1 rad/s and accel input at 20m/s2
  • name: AHRS_ICE_IMU_ID value: ABI_BROADCAST
    Description: ABI sender id of IMU to use
  • name: AHRS_ICE_MAG_ID value: ABI_BROADCAST
    Description: ABI sender id of magnetometer to use

Auto-loaded modules

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

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw ahrs_int_cmpl_euler.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="ahrs_int_cmpl_euler" dir="ahrs">
<doc>
<description>
AHRS using complementary filter in fixed point.
Propagation is done in euler angles representation.
Not recommended for fixedwings, as this filter doesn't compensate for centrifugal force when flying turns.
Magnetometer is always only used for heading (yaw).
Does not handle the accel and mag updates correctly if BODY_TO_IMU is used for more than just adjustment by a few degrees.
In general, rather use int_cmpl_quat
</description>
<configure name="USE_MAGNETOMETER" value="TRUE" description="set to FALSE to disable magnetometer"/>
<configure name="AHRS_ALIGNER_LED" value="1" description="LED number to indicate AHRS alignment, none to disable (default is board dependent)"/>
<define name="AHRS_MAG_OFFSET" value="0.0" description="offset in radians to subtract from the heading calculated by the magnetometer"/>
<define name="USE_NOISE_FILTER" description="apply a simple filter on the rate and accel inputs"/>
<define name="USE_NOISE_CUT" description="cut rate input at 1 rad/s and accel input at 20m/s2"/>
<define name="AHRS_ICE_IMU_ID" value="ABI_BROADCAST" description="ABI sender id of IMU to use"/>
<define name="AHRS_ICE_MAG_ID" value="ABI_BROADCAST" description="ABI sender id of magnetometer to use"/>
</doc>
<settings>
<dl_settings>
<dl_settings NAME="Filter">
<dl_setting var="ahrs_ice.reinj_1" min="512" step="512" max="262144" module="subsystems/ahrs/ahrs_int_cmpl_euler" shortname="reinj_1" type="int32" persistent="true"/>
</dl_settings>
</dl_settings>
</settings>
<autoload name="ahrs_sim"/>
<header>
<file name="ahrs.h" dir="subsystems"/>
</header>
<makefile target="!sim|fbw">
<configure name="USE_MAGNETOMETER" default="1"/>
<configure name="AHRS_ALIGNER_LED" default="none"/>
<define name="USE_MAGNETOMETER" cond="ifeq (,$(findstring $(USE_MAGNETOMETER),0 FALSE))"/>
<define name="AHRS_ALINGER_LED" value="$(AHRS_ALIGNER_LED)" cond="ifneq ($(AHRS_ALIGNER_LED),none)"/>
<define name="USE_AHRS"/>
<define name="USE_AHRS_ALIGNER"/>
<file name="ahrs.c" dir="subsystems"/>
<file name="ahrs_aligner.c" dir="subsystems/ahrs"/>
<file name="ahrs_int_cmpl_euler.c" dir="subsystems/ahrs"/>
<file name="ahrs_int_cmpl_euler_wrapper.c" dir="subsystems/ahrs"/>
<raw>
ifdef SECONDARY_AHRS
ifneq (,$(findstring $(SECONDARY_AHRS), ice int_cmpl_euler))
# this is the secondary AHRS
$(TARGET).CFLAGS += -DAHRS_SECONDARY_TYPE_H=\"subsystems/ahrs/ahrs_int_cmpl_euler_wrapper.h\"
$(TARGET).CFLAGS += -DSECONDARY_AHRS=ahrs_ice
else
# this is the primary AHRS
$(TARGET).CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_int_cmpl_euler_wrapper.h\"
$(TARGET).CFLAGS += -DPRIMARY_AHRS=ahrs_ice
endif
else
# plain old single AHRS usage
$(TARGET).CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_int_cmpl_euler_wrapper.h\"
endif
</raw>
</makefile>
</module>