OpenMV for Optical Flow

The OpenMV camera is a programmable camera which includes support for optical flow.

Warning

Support for this sensor will be included in Copter-3.7 (and higher)

Where to Buy

The sensor can be purchased directly from openmv.io

Connection to Flight Controller

../_images/openmv-pixhawk.jpg
  • The camera should be mounted on the underside of the copter with the camera lens pointing downwards. The camera edge with the lens should be towards the front of the vehicle. The image above is incorrect because the flight controller’s arrow is pointing down while the sensor’s lens is close to the top
  • Connect the camera’s P4, VIN and GND pins to one of the flight controller’s serial ports as shown above. In the image above the sensor is connected to a Pixhawk’s Telem2 port
  • Set FLOW_TYPE = 5 (MAVLink)
  • Set SERIAL2_PROTOCOL = 1 (MAVLink) if using Serial2/Telem2, if connected to another serial port use the corresponding SERIALx_PROTOCOL parameter
  • Set SERIAL2_BAUD = 115
  • Set EK2_FLOW_DELAY = 80
  • Optionally set EK2_GPS_TYPE = 3 to force the EKF to only use the optical flow sensor and not use the GPS

Note

Official pinout for the camera can be found here

Camera Setup

Official setup information can be found here but the short form is:

  • Connect the OpenMV camera to your computer. On Windows the camera should appear as a new COM port and a virtual drive should also be created (this is where scripts are copied to below)
  • Download, install and run the OpenMV IDE
  • Select File, Examples, 18-MAVLink, mavlink_opticalflow.py
  • On the bottom right, select the Drive that corresponds to the OpenMV camera’s virtual drive
  • Select Tools, save open script to OpenMV Cam
  • Select Tools, Reset OpenMV Cam
  • A green light on the camera should begin flashing which shows the script is running
../_images/openmv-ide.jpg

Additional Notes

  • As with the PX4Flow sensor a range finder is required to use the sensor for autonomous modes including Loiter and RTL
  • FlowHold does not require the use of a rangefinder
  • The sensor has been successfully tested to altitudes of about 10m