Common part for all IMUs.
This takes the IMU_GYRO_RAW, IMU_ACCEL_RAW and IMU_MAG_RAW ABI messages as input.
Example for airframe file
Add to your firmware section:
<module name="imu_common"/>
Module configuration options
Airframe file section
- section name:
IMU
prefix: IMU_
- name
INTEGRATION
value: FALSE
Description: Enable gyro/accel integration calculations (enabled for the ekf2)
- name
GYRO_CALIB
value: {}
Description: Gyroscope calibration structures list (see struct imu_gyro_t)
- name
ACCEL_CALIB
value: {}
Description: Accelerometer calibration structures list (see struct imu_accel_t)
- name
MAG_CALIB
value: {}
Description: Magnetometer calibration structures list (see struct imu_mag_t)
- name
GYRO_ABI_SEND_ID
value: ABI_BROADCAST
Description: The gyro ABI ID which is send over telemetry/logging
- name
ACCEL_ABI_SEND_ID
value: ABI_BROADCAST
Description: The accel ABI ID which is send over telemetry/logging
- name
MAG_ABI_SEND_ID
value: ABI_BROADCAST
Description: The mag ABI ID which is send over telemetry/logging
- name
LOG_HIGHSPEED
value: FALSE
Description: Log all the accel/gyro measurements at the IMU sampling rates in floats
- name
LOG_HIGHSPEED_DEVICE
value: flightrecorder_sdlog
Description: The device to log all the highspeeds measurements
Module functions
Init Functions
These initialization functions are called once on startup.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw imu_common.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="imu_common" dir="imu" task="sensors">
<doc>
<description>
Common part for all IMUs.
This takes the IMU_GYRO_RAW, IMU_ACCEL_RAW and IMU_MAG_RAW ABI messages as input.
</description>
<section name="IMU" prefix="IMU_">
<define name="INTEGRATION" value="FALSE" description="Enable gyro/accel integration calculations (enabled for the ekf2)"/>
<define name="GYRO_CALIB" value="{}" description="Gyroscope calibration structures list (see struct imu_gyro_t)"/>
<define name="ACCEL_CALIB" value="{}" description="Accelerometer calibration structures list (see struct imu_accel_t)"/>
<define name="MAG_CALIB" value="{}" description="Magnetometer calibration structures list (see struct imu_mag_t)"/>
<define name="GYRO_ABI_SEND_ID" value="ABI_BROADCAST" description="The gyro ABI ID which is send over telemetry/logging"/>
<define name="ACCEL_ABI_SEND_ID" value="ABI_BROADCAST" description="The accel ABI ID which is send over telemetry/logging"/>
<define name="MAG_ABI_SEND_ID" value="ABI_BROADCAST" description="The mag ABI ID which is send over telemetry/logging"/>
<define name="LOG_HIGHSPEED" value="FALSE" description="Log all the accel/gyro measurements at the IMU sampling rates in floats"/>
<define name="LOG_HIGHSPEED_DEVICE" value="flightrecorder_sdlog" description="The device to log all the highspeeds measurements"/>
</section>
</doc>
<settings>
<dl_settings>
<dl_settings name="IMU">
<dl_setting var="imu.body_to_imu.eulers_f.phi" shortname="b2i phi" min="-90" max="90" step="0.5" module="modules/imu/imu" param="IMU_BODY_TO_IMU_PHI" unit="rad" alt_unit="deg" handler="SetBodyToImuPhi" type="float" persistent="true"/>
<dl_setting var="imu.body_to_imu.eulers_f.theta" shortname="b2i theta" min="-90" max="90" step="0.5" module="modules/imu/imu" param="IMU_BODY_TO_IMU_THETA" unit="rad" alt_unit="deg" handler="SetBodyToImuTheta" type="float" persistent="true"/>
<dl_setting var="imu.body_to_imu.eulers_f.psi" shortname="b2i psi" min="-90" max="90" step="0.5" module="modules/imu/imu" param="IMU_BODY_TO_IMU_PSI" unit="rad" alt_unit="deg" handler="SetBodyToImuPsi" type="float" persistent="true"/>
<dl_setting var="imu.b2i_set_current" shortname="b2i cur roll/pitch" min="0" max="1" step="1" values="FALSE|TRUE" module="modules/imu/imu" handler="SetBodyToImuCurrent"/>
<dl_setting var="imu.gyro_abi_send_id" shortname="gyro abi send" min="0" max="255" step="1" param="IMU_GYRO_ABI_SEND_ID"/>
<dl_setting var="imu.accel_abi_send_id" shortname="accel abi send" min="0" max="255" step="1" param="IMU_ACCEL_ABI_SEND_ID"/>
<dl_setting var="imu.mag_abi_send_id" shortname="mag abi send" min="0" max="255" step="1" param="IMU_MAG_ABI_SEND_ID"/>
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>electrical</depends>
</dep>
<header>
<file name="imu.h"/>
</header>
<init fun="imu_init()"/>
<makefile target="!fbw">
<define name="USE_IMU"/>
<file name="imu.c"/>
<test/>
</makefile>
</module>