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

PX4FLOW optical flow sensor connected over i2c bus

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="px4flow_i2c">
2  <configure name="PX4FLOW_I2C_DEV" value="i2c2" />
3  <configure name="PX4FLOW_I2C_ADDR" value="0x84" />
4  <configure name="REQUEST_INT_FRAME" value="1" />
5  <configure name="PX4FLOW_NOISE_STDDEV" value="1.0" />
6  <configure name="USE_PX4FLOW_AGL" value="1" />
7  <configure name="PX4FLOW_COMPENSATE_ROTATION" value="1" />
8  <configure name="PX4FLOW_MEDIAN_LENGTH" value="7" />
9 </module>

Module configuration options

Configure Options

  • name: PX4FLOW_I2C_DEV value: i2c2
    Description: I2C device to use for px4flow
  • name: PX4FLOW_I2C_ADDR value: 0x84
    Description: slave address of px4flow
  • name: REQUEST_INT_FRAME value: 1
    Description: request i2c_integral_frame, default TRUE
  • name: PX4FLOW_NOISE_STDDEV value: 1.0
    Description: standard deviation of the flow measurement (if known)
  • name: USE_PX4FLOW_AGL value: 1
    Description: update AGL measurements from onboard sonar
    Description: compensate AGL measurements for body rotation
  • name: PX4FLOW_MEDIAN_LENGTH value: 7
    Description: Median filter length for the px4flow measurements

Module functions

Init Functions

These initialization functions are called once on startup.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • px4flow_i2c_downlink()
    • Frequency in Hz: 4
    • Autorun: FALSE
      Periodic function is started by user command.
  • px4flow_i2c_periodic()
    • Frequency in Hz: 50
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.


Header Files

The following headers are automatically included in modules.h

Source Files

Raw px4flow_i2c.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="px4flow_i2c" dir="optical_flow">
<description>PX4FLOW optical flow sensor connected over i2c bus</description>
<configure name="PX4FLOW_I2C_DEV" value="i2c2" description="I2C device to use for px4flow"/>
<configure name="PX4FLOW_I2C_ADDR" value="0x84" description="slave address of px4flow"/>
<configure name="REQUEST_INT_FRAME" value="1" description="request i2c_integral_frame, default TRUE"/>
<configure name="PX4FLOW_NOISE_STDDEV" value="1.0" description="standard deviation of the flow measurement (if known)"/>
<configure name="USE_PX4FLOW_AGL" value="1" description="update AGL measurements from onboard sonar"/>
<configure name="PX4FLOW_COMPENSATE_ROTATION" value="1" description="compensate AGL measurements for body rotation"/>
<configure name="PX4FLOW_MEDIAN_LENGTH" value="7" description="Median filter length for the px4flow measurements"/>
<dl_settings NAME="optical flow">
<dl_settings NAME="px4flow">
<dl_setting MAX="1" MIN="0" STEP="1" VAR="px4flow.compensate_rotation" shortname="derotate_agl"/>
<dl_setting MAX="1" MIN="0" STEP="1" VAR="px4flow.update_agl" shortname="update_agl"/>
<dl_setting MAX="10" MIN="0" STEP="0.1" VAR="px4flow.stddev" shortname="stddev"/>
<file name="px4flow_i2c.h"/>
<init fun="px4flow_i2c_init()"/>
<periodic fun="px4flow_i2c_downlink()" freq="4" autorun="FALSE"/> <!-- for debug -->
<periodic fun="px4flow_i2c_periodic()" freq="50"/> <!-- poll px4flow for data, see for details -->
<configure name="PX4FLOW_I2C_DEV" default="i2c1" case="lower|upper"/>
<configure name="PX4FLOW_I2C_ADDR" default="0x84"/> <!-- 0x42 + additional zero at the end to make 8 bit address -->
<configure name="REQUEST_INT_FRAME" default="1"/>
<configure name="PX4FLOW_NOISE_STDDEV" default="1.0"/>
<configure name="USE_PX4FLOW_AGL" default="1"/>
<configure name="PX4FLOW_COMPENSATE_ROTATION" default="1"/>
<configure name="PX4FLOW_MEDIAN_LENGTH" default="7"/>
<define name="PX4FLOW_I2C_DEV" value="$(PX4FLOW_I2C_DEV_LOWER)"/>
<define name="USE_$(PX4FLOW_I2C_DEV_UPPER)"/>
<define name="PX4FLOW_I2C_ADDR" value="$(PX4FLOW_I2C_ADDR)"/>
<define name="REQUEST_INT_FRAME" value="$(REQUEST_INT_FRAME)"/>
<define name="PX4FLOW_NOISE_STDDEV" value="$(PX4FLOW_NOISE_STDDEV)"/>
<define name="USE_PX4FLOW_AGL" value="$(USE_PX4FLOW_AGL)"/>
<file name="px4flow_i2c.c"/>