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

Lidar-Lite v1-3 (all labels) from PulsedLight3D (now Garmin) connected over i2c bus.

With the default settings the ranging takes ~3ms so don't poll the lidar faster than 300Hz (in practice lidar_lite_periodic() can run at the PERIODIC_FREQUENCY and still be OK)

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="lidar_lite">
2  <configure name="LIDAR_LITE_I2C_DEV" value="i2c2" />
3  <configure name="LIDAR_LITE_I2C_ADDR" value="0x62" />
4  <configure name="USE_LIDAR_LITE_AGL" value="1" />
5  <configure name="LIDAR_LITE_COMPENSATE_ROTATION" value="1" />
6  <configure name="LIDAR_LITE_MEDIAN_LENGTH" value="7" />
7 </module>

Module configuration options

Configure Options

  • name: LIDAR_LITE_I2C_DEV value: i2c2
    Description: I2C device to use for lidar
  • name: LIDAR_LITE_I2C_ADDR value: 0x62
    Description: default slave address of lidar
  • name: USE_LIDAR_LITE_AGL value: 1
    Description: use this lidar for AGL measurements. On by deafult
  • name: LIDAR_LITE_COMPENSATE_ROTATION value: 1
    Description: compensate AGL measurements for body rotation
  • name: LIDAR_LITE_MEDIAN_LENGTH value: 7
    Description: Length of median filter for Lidar-lite measurements

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.

  • lidar_lite_downlink()
    • Frequency in Hz: 4
    • Autorun: FALSE
      Periodic function is started by user command.
  • lidar_lite_periodic()
    • Frequency in Hz: 100
    • 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 lidar_lite.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="lidar_lite" dir="lidar">
<doc>
<description>
Lidar-Lite v1-3 (all labels) from PulsedLight3D (now Garmin) connected over i2c bus.
With the default settings the ranging takes ~3ms so don't poll the lidar faster than 300Hz
(in practice lidar_lite_periodic() can run at the PERIODIC_FREQUENCY and still be OK)
</description>
<configure name="LIDAR_LITE_I2C_DEV" value="i2c2" description="I2C device to use for lidar"/>
<configure name="LIDAR_LITE_I2C_ADDR" value="0x62" description="default slave address of lidar"/>
<configure name="USE_LIDAR_LITE_AGL" value="1" description="use this lidar for AGL measurements. On by deafult"/>
<configure name="LIDAR_LITE_COMPENSATE_ROTATION" value="1" description="compensate AGL measurements for body rotation"/>
<configure name="LIDAR_LITE_MEDIAN_LENGTH" value="7" description="Length of median filter for Lidar-lite measurements"/>
</doc>
<settings>
<dl_settings NAME="Lidar lite">
<dl_settings NAME="Lidar">
<dl_setting MAX="1" MIN="0" STEP="1" VAR="lidar_lite.compensate_rotation" shortname="derotate_agl"/>
<dl_setting MAX="1" MIN="0" STEP="1" VAR="lidar_lite.update_agl" shortname="update_agl"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="lidar_lite.h"/>
</header>
<init fun="lidar_lite_init()"/>
<periodic fun="lidar_lite_downlink()" freq="4" autorun="FALSE"/> <!-- for debug -->
<periodic fun="lidar_lite_periodic()" freq="100"/> <!-- poll data, since we have 4 states in the state machine, divide the frequency
by 4 to get the actual number of readings per second. For example 100Hz = 25 range readings -->
<event fun="lidar_lite_event()"/>
<makefile>
<configure name="LIDAR_LITE_I2C_DEV" default="i2c1" case="lower|upper"/>
<configure name="LIDAR_LITE_I2C_ADDR" default="0xC4"/>
<configure name="USE_LIDAR_LITE_AGL" default="1"/>
<configure name="LIDAR_LITE_COMPENSATE_ROTATION" default="1"/>
<configure name="LIDAR_LITE_MEDIAN_LENGTH" default="7"/>
<define name="LIDAR_LITE_I2C_DEV" value="$(LIDAR_LITE_I2C_DEV_LOWER)"/>
<define name="USE_$(LIDAR_LITE_I2C_DEV_UPPER)"/>
<define name="LIDAR_LITE_I2C_ADDR" value="$(LIDAR_LITE_I2C_ADDR)"/>
<define name="USE_LIDAR_LITE_AGL" value="$(USE_LIDAR_LITE_AGL)"/>
<define name="LIDAR_LITE_COMPENSATE_ROTATION" value="$(LIDAR_LITE_COMPENSATE_ROTATION)"/>
<define name="LIDAR_LITE_MEDIAN_LENGTH" value="$(LIDAR_LITE_MEDIAN_LENGTH)"/>
<file name="lidar_lite.c"/>
</makefile>
<makefile target="nps">
<define name="USE_SONAR" value="1"/><!-- in NPS use a virtual sonar to simulate lidar measurements -->
</makefile>
</module>