PX4FLOW Developer Guide

Hardware Setup

  • PX4FLOW Board v1.3
  • HRLV-MaxSonar-EZ (MB1043)
  • 16mm Lens
  • Micro USB cable

The flow module has been accepted as paper to the International Conference on Robotics and Automation (ICRA 2013) in Karlsruhe, Germany.

Dominik Honegger, Lorenz Meier, Petri Tanskanen and Marc Pollefeys. An Open Source and Open Hardware Embedded Metric Optical Flow CMOS Camera for Indoor and Outdoor Applications, ICRA2013 (Full version)

Software / Build Source

  • PC with QGroundcontrol v1.0.9 (beta) installed
  • Recent PX4FLOW Firmware

PX4Flow source code is available: https://github.com/PX4/Flow

Build

Install the PX4 toolchain according to the dev guide: px4_quickstart and clone the sources from 'https://github.com/PX4/Flow' via GIT (see the dev guide a GIT quick start).

cd flow
make all
make upload-usb

Then connect the flow sensor. It should show these steps on a successful upload:

Found board 6,0 bootloader rev 3 on /dev/ttyACM1
erase...
program...
verify...
done, rebooting.

Troubleshooting

In case one doesn't see the aforementioned steps, the modem-manager should be removed by:

sudo apt-get remove modemmanager

User also needs to be in the plugdev group:

sudo usermod -a -G plugdev $USER

Focus Image

Connect PX4FLOW to QGroundcontrol:

  1. Connect PX4FLOW sensor over USB to PC
  2. Open QGroundcontrol
  3. Switch to Plot perspective: Perspectives/Plot
  4. Connect to PX4FLOW sensor: Communication/Add Link

  • Link Type: Serial
  • Protocol: MAVLink
  • Serial Port: corresponding Port (e.g. /dev/ttyACM* or COMM*)

Now a new Unmanned System should appear and Onboard Parameters are loaded (click on “Get” if not)

Change Parameter VIDEO_ONLY to 1 and press Set.

The Widget Video Downlink shows now the Image in full resolution. Focus the lens on 1.5m. Fix the lens position and switch VIDEO_ONLY Mode off.

Data Output

The PX4FLOW module outputs MAVLink packets on USB and serial port. Use QGroundControl to read data from the module.

Parameters

BFLOW_F_THRD

This parameter is a feature threashold and limits the quality of patterns that are used to calculate the bottom flow. For low values (e.g. 10) almost every pattern is taken, for higher values (e.g. 100) only significant patters are taken.

BFLOW_V_THRD

This is a pattern correlation threashold for filtering bad matches. Lower means only strong correlations are accepted.

Parameters are currently not written to ROM (reset at power loss)

PX4FLOW Parameters

The following list gives a short explanation of the current available parameters in the PX4FLOW firmware.

Parameters are currently not written to ROM (reset at power loss)

Name Default Access Comment
BFLOW_F_THLD 30 RW This parameter is a feature threashold and limits the quality of patterns that are used to calculate the bottom flow. For low values (e.g. 10) almost every pattern is taken, for higher values (e.g. 100) only significant patters are taken.
BFLOW_V_THLD 5000 RW This is a pattern correlation threashold for filtering bad matches. Lower means only strong correlations are accepted.
BFLOW_HIST_FIL 0 RW 1: Flow histogram filter is ON, 0: OFF
BFLOW_GYRO_COM 1 RW 1: Gyro compensation is ON, 0: OFF
BFLOW_LP_FIL 0 RW 1: Lowpass filter on flow output is ON, 0: OFF
BFLOW_W_NEW 0.3 RW Flow lowpass filter gain
DEBUG 1 RW 1: Debug messages ON, 0: OFF
GYRO_SENS_DPS 250 RW Gyroscope sensitivity: 250, 500, 2000 (dps)
GYRO_COMP_THR 0.01 RW Gyro compensation threshold (dps): Gyro data lower than this threshold is not compensated to prevent drift
IMAGE_WIDTH 64 R Image width (pixels)
IMAGE_HEIGHT 64 R Image height (pixels)
IMAGE_L_LIGHT 0 RW 1: Image sensor low light mode ON, 0: OFF
IMAGE_NOISE_C 1 RW 1: Image sensor noise correction ON, 0: OFF
IMAGE_TEST_PAT 0 RW 1: Gray-shaded test pattern mode ON, 0: OFF
LENS_FOCAL_LEN 16 RW Focal length of lens (mm)
POSITION 0 RW 0: Only position 0 is used (Bottom: 0, Front: 1, Top: 2, Back: 3, Right: 4, Left: 5)
SONAR_FILTERED 0 RW 1: Kalman filter on sonar output is ON, 0: OFF
SONAR_KAL_L1 0.8461 RW Sonar Kalman gain L1
SONAR_KAL_L2 6.2034 RW Sonar Kalman gain L2
SYS_ID 81 RW MAVLink System ID
SYS_COMP_ID 50 RW MAVLink Component ID
SYS_SENSOR_ID 77 RW MAVLink Sensor ID
SYS_TYPE 0 RW MAVLink System Type
SYS_AP_TYPE 1 RW MAVLink Autopilot Type
SYS_SW_VER 13XX R Software Version
SYS_SEND_STATE 1 RW 1: Send MAVLink Heartbeat, 0: Not
USART_2_BAUD 115200 R Baudrate USART 2
USART_3_BAUD 115200 R Baudrate USART 3 (Data Output)
USB_SEND_VIDEO 1 RW 1: Send video over USB, 0: Not
USB_SEND_FLOW 1 RW 1: Send flow over USB, 0: Not
USB_SEND_GYRO 1 RW 1: Send gyro data over USB, 0: Not
USB_SEND_FWD 0 RW 1: Send forwarded flow over USB, 0: Not
USB_SEND_DEBUG 1 RW 1: Send debug msgs over USB, 0: Not
VIDEO_RATE 150 RW Time in milliseconds between images of video transmission
VIDEO_ONLY 0 RW 1: High resolution video mode is ON, 0: OFF

Modes

VIDEO ONLY Mode

Set VIDEO_ONLY to 1 for high resolution mode. In this mode the camera image is transmitted at a higher resolution to ease the lens focus process. No flow values are calculated in this mode.

Low Light Mode

If IMAGE_L_LIGHT is set to 1, the sensor operates in low light mode.

This mode is under construction, and results are more noisy

Test Pattern Mode

If the parameter IMAGE_TEST_PAT is set to 1, the sensor inserts a vertical gray-shaded test pattern in the signal chain.

  • Test Pattern 64×64 (VIDEO ONLY Mode is OFF)

  • Test Pattern 376×240 (VIDEO ONLY Mode is ON)

General Troubleshooting

  • Unplug the flow sensor if plugged
  • Start QGroundControl, select the PX4 startup mode go to Config → Firmware Upgrade.
    • Click on SCAN (green button in the center)
    • Connect the flow sensor now
    • Flash the stable firmware
  • Click on Advanced Config in the left menu to see the parameters
  • Display the video stream with QGroundControl (Tool Widgets → Video Downlink)
    • Check that there are no stripes on the stream. If you get stripes, set IMAGE_TEST_PAT to 1. It should look like the examples above. If you have stripes in the image but no stripes when this mode is enabled, right-click into the image once in both modes and save and send an image of each mode to the manufacturer's support team.
    • Check that you get a clear image (its a tele / zoom lens, so the visible area will be small)
  • Set the VIDEO_ONLY parameter to 1 to obtain a higher resolution image.
  • Check that the image is sharp at the operating distance (the typical flight altitude)

  • Please check the mailing list in case you have a similar distorted image with visible dark lines:

Translations of this page:


Quick Links

QR Code: URL of current page