Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
dw1000_arduino module

Driver to get ranging data from Decawave DW1000 modules connected to Arduino

Decawave DW1000 modules (http://www.decawave.com/products/dwm1000-module) are Ultra-Wide-Band devices that can be used for communication and ranging. Especially, using 3 modules as anchors can provide data for a localization system based on trilateration. The DW1000 is using a SPI connection, but an arduino-compatible board can be used with the library https://github.com/thotro/arduino-dw1000 to hyde the low level drivers and provide direct ranging informations.

See https://hal-enac.archives-ouvertes.fr/hal-01936955 for more information on the EKF filtering.

Example for airframe file

Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!

<module name="dw1000_arduino">
b'<configure name="DW1000_ARDUINO_UART" value="UARTX" />\n '
b'<configure name="DW1000_ARDUINO_BAUD" value="B115200" />\n '
b'<configure name="DW1000_USE_AS_LOCAL_POS" value="FALSE|TRUE" />\n '
b'<configure name="DW1000_USE_AS_GPS" value="FALSE|TRUE" />\n '
</module>

Module configuration options

Configure Options

  • name: DW1000_ARDUINO_UART value: UARTX
    Description: UART on which arduino and its DW1000 module is connected
  • name: DW1000_ARDUINO_BAUD value: B115200
    Description: UART Baudrate, default to 115200
  • name: DW1000_USE_AS_LOCAL_POS value: FALSE|TRUE
    Description: use as a local positioning system (default: TRUE)
  • name: DW1000_USE_AS_GPS value: FALSE|TRUE
    Description: use as a fake GPS positioning system (default: FALSE)

Airframe file section

  • section name: DW1000 prefix: DW1000_
    • name ANCHORS_IDS value: 1, 2, 3
      Description: Comma separated list of anchors ID
    • name ANCHORS_POS_X value: 0., 0., 5.
      Description: Comma separated list of anchors ID over X axis
    • name ANCHORS_POS_Y value: 0., 5., 0.
      Description: Comma separated list of anchors ID over Y axis
    • name ANCHORS_POS_Z value: 0., 0., 0.
      Description: Comma separated list of anchors ID over Z axis
    • name OFFSET value: 0., 0., 0.
      Description: Position offset other X, Y and Z axis
    • name SCALE value: 1., 1., 1.
      Description: Position scale factor other X, Y and Z axis
    • name INITIAL_HEADING value: 0.
      Description: Initial heading correction between anchors frame and global frame
    • name NB_ANCHORS value: 3
      Description: Set number of anchors, only 3 are required/supported at the moment
    • name USE_EKF value: FALSE|TRUE
      Description: Enable EKF filtering, required to estimate speed
    • name EKF_Q value: 1.0
      Description: EKF process noise
    • name EKF_R_DIST value: 0.1
      Description: EKF noise on distance measurements
    • name EKF_R_SPEED value: 0.1
      Description: EKF noise on speed measurements (if available)
    • name NOISE_X|Y|Z value: 0.1
      Description: Noise level reported by the POSITION_ESTIMATE message when USE_AS_LOCAL_POS is activated
    • name VEL_NOISE_X|Y|Z value: 0.1
      Description: Noise level reported by the VELOCITY_ESTIMATE message when USE_AS_LOCAL_POS is activated

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.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw dw1000_arduino.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="dw1000_arduino" dir="decawave">
<doc>
<description>
Driver to get ranging data from Decawave DW1000 modules connected to Arduino
Decawave DW1000 modules (http://www.decawave.com/products/dwm1000-module) are Ultra-Wide-Band devices that can be used for communication and ranging.
Especially, using 3 modules as anchors can provide data for a localization system based on trilateration.
The DW1000 is using a SPI connection, but an arduino-compatible board can be used with the library https://github.com/thotro/arduino-dw1000 to hyde the low level drivers and provide direct ranging informations.
See https://hal-enac.archives-ouvertes.fr/hal-01936955 for more information on the EKF filtering.
</description>
<configure name="DW1000_ARDUINO_UART" value="UARTX" description="UART on which arduino and its DW1000 module is connected"/>
<configure name="DW1000_ARDUINO_BAUD" value="B115200" description="UART Baudrate, default to 115200"/>
<configure name="DW1000_USE_AS_LOCAL_POS" value="FALSE|TRUE" description="use as a local positioning system (default: TRUE)"/>
<configure name="DW1000_USE_AS_GPS" value="FALSE|TRUE" description="use as a fake GPS positioning system (default: FALSE)"/>
<section name="DW1000" prefix="DW1000_">
<define name="ANCHORS_IDS" value="1, 2, 3" type="int[]" description="Comma separated list of anchors ID"/>
<define name="ANCHORS_POS_X" value="0., 0., 5." type="float[]" description="Comma separated list of anchors ID over X axis"/>
<define name="ANCHORS_POS_Y" value="0., 5., 0." type="float[]" description="Comma separated list of anchors ID over Y axis"/>
<define name="ANCHORS_POS_Z" value="0., 0., 0." type="float[]" description="Comma separated list of anchors ID over Z axis"/>
<define name="OFFSET" value="0., 0., 0." type="float[]" description="Position offset other X, Y and Z axis"/>
<define name="SCALE" value="1., 1., 1." type="float[]" description="Position scale factor other X, Y and Z axis"/>
<define name="INITIAL_HEADING" value="0." description="Initial heading correction between anchors frame and global frame"/>
<define name="NB_ANCHORS" value="3" description="Set number of anchors, only 3 are required/supported at the moment"/>
<define name="USE_EKF" value="FALSE|TRUE" description="Enable EKF filtering, required to estimate speed"/>
<define name="EKF_Q" value="1.0" description="EKF process noise"/>
<define name="EKF_R_DIST" value="0.1" description="EKF noise on distance measurements"/>
<define name="EKF_R_SPEED" value="0.1" description="EKF noise on speed measurements (if available)"/>
<define name="NOISE_X|Y|Z" value="0.1" description="Noise level reported by the POSITION_ESTIMATE message when USE_AS_LOCAL_POS is activated"/>
<define name="VEL_NOISE_X|Y|Z" value="0.1" description="Noise level reported by the VELOCITY_ESTIMATE message when USE_AS_LOCAL_POS is activated"/>
</section>
</doc>
<settings>
<dl_settings>
<dl_settings name="dw1000">
<dl_setting max="1" min="0" step="1" module="decawave/dw1000_arduino" var="dw1000_use_ekf" shortname="use_ekf" values="FALSE|TRUE"/>
<dl_setting max="5.0" min="0.01" step="0.01" module="decawave/dw1000_arduino" var="dw1000_ekf_q" shortname="q_noise" handler="update_ekf_q"/>
<dl_setting max="1.0" min="0.01" step="0.01" module="decawave/dw1000_arduino" var="dw1000_ekf_r_dist" shortname="r_dist" handler="update_ekf_r_dist"/>
<dl_setting max="1.0" min="0.01" step="0.01" module="decawave/dw1000_arduino" var="dw1000_ekf_r_speed" shortname="r_speed" handler="update_ekf_r_speed"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="dw1000_arduino.h"/>
</header>
<init fun="dw1000_arduino_init()"/>
<periodic fun="dw1000_arduino_periodic()" freq="10"/>
<periodic fun="dw1000_arduino_report()" freq="10" autorun="FALSE"/>
<periodic fun="dw1000_reset_heading_ref()" freq="1" autorun="FALSE"/>
<event fun="dw1000_arduino_event()"/>
<makefile>
<configure name="DW1000_ARDUINO_UART" case="upper|lower"/>
<configure name="DW1000_ARDUINO_BAUD" default="B115200"/>
<configure name="DW1000_USE_AS_LOCAL_POS" default="TRUE"/>
<configure name="DW1000_USE_AS_GPS" default="FALSE"/>
<file name="dw1000_arduino.c"/>
<file name="trilateration.c"/>
<file name="ekf_range.c"/>
<define name="DW1000_USE_AS_LOCAL_POS" value="$(DW1000_USE_AS_LOCAL_POS)"/>
<define name="DW1000_USE_AS_GPS" value="$(DW1000_USE_AS_GPS)"/>
<raw>
ifeq (,$(findstring $(DW1000_USE_AS_GPS),0 FALSE))
ifdef SECONDARY_GPS
ifneq (,$(findstring $(SECONDARY_GPS), dw1000))
# this is the secondary GPS
$(TARGET).CFLAGS += -DGPS_SECONDARY_TYPE_H=\"modules/decawave/dw1000_arduino.h\"
$(TARGET).CFLAGS += -DSECONDARY_GPS=GPS_DW1000
else
$(TARGET).CFLAGS += -DGPS_TYPE_H=\"modules/decawave/dw1000_arduino.h\"
$(TARGET).CFLAGS += -DPRIMARY_GPS=GPS_DW1000
endif
else
# plain old single GPS usage
$(TARGET).CFLAGS += -DGPS_TYPE_H=\"modules/decawave/dw1000_arduino.h\"
endif
endif
</raw>
</makefile>
<makefile target="ap">
<define name="USE_$(DW1000_ARDUINO_UART_UPPER)"/>
<define name="DW1000_ARDUINO_DEV" value="$(DW1000_ARDUINO_UART_LOWER)"/>
<define name="$(DW1000_ARDUINO_UART_UPPER)_BAUD" value="$(DW1000_ARDUINO_BAUD)"/>
</makefile>
</module>