Servers by jDrones

Summary of Optical Flow Development in ArduPilot

(Greg Covey) #41

Hi Nafnaf,

Thank you for the detailed information. I will try to replicate the circle mode dips in another area (or surface) when the weather permits. I will also look at your tutorial link and see if it deviates from the APM Wiki where I set up my PX4 Flow board and firmware.


(Ben Freudberg) #42

Hi Greg,

I noticed that you have two sonars installed on your copter (one on PX4Flow and one Maxbotix). You can’t have two sonars powered at the same time because they will interfere with each other. The way they work is to send a pulse and then listen for that pulse to bounce back and measure the latency. If you have two sonars sending pulses, they will hear each other’s pulses and return incorrect readings.


(Greg Covey) #43

Hi Ben,

It is true that there are two sonars but only the one external to the PX4Flow board is activated. The sonar that comes with the PX4Flow board is not accurate enough for good distance measurements.

The installation I used is in the APM Wiki here. The Wiki also contains a list of appropriate external sonar devices with a wide range of pricing.

(Rotem Shfaim) #44

Hello All,

Is it possible to use a sonar or LIDAR as obstacle avoidance system (pointing to the front of the UAV)?

Thank you

(Mike Boland) #45

@Rotemshf Have a look in the documentation

(Akm) #46

Hi Greg

Thanks for sharing your experience. I am also trying to use Optical flow and I am sure your experience will help.

I have a few doubts:

  1. Why do you need to arm in loiter mode? How is it different from Arming in STABILIZE mode and changing it to LOITER when attained certain height?
  2. Did you tried getting position hold using Optical flow in GUIDED mode or GUIDED_NO_GPS mode?

(Greg Covey) #47


I do not know why you need to arm in Loiter mode. I typically arm in Stabilize mode and move the quad out onto the field for testing before changing to other modes. Currently, Stabilize mode is the only mode I can count on for accurate flight when Optical Flow is enabled. Note that you still need to pick up the quad before arming to calibrate the range finder.

I just happened to re-test my Tarot 650 quad yesterday in a wild field of long grass and bushes. I did video the two flights but decided not to render them on Vimeo since the performance was so poor. Several times, even though I was at a proper height, the quad was almost destroyed. I am still using the same firmware and parameters as mentioned above in my previous post and video.

When switching from Stabilize mode to Alt Hold mode, the copter would always dip significantly in height forcing me to raise the throttle setting to gain height. When switching to Loiter mode, the copter would usually stay in proper position. In this tall grass field, Circle mode did not work well. Switching back to Loiter mode from Circle mode made the copter move off rapidly in a wrong direction. I was forced to switch back to Stabilize mode and fly manually home.

It seems that BARO works much better for altitude hold and my M8N GPS works best for position hold than using the Optical Flow feature. It may be that my choice of an inexpensive rangefinder (Maxbotic I2C EZ4 $40.) does not perform well. Using a more expensive Lightware SF11/C 120m unit for $249 or Lightware SF10/B laser rangefinder for $400 may provide better results but they are not in my hobby budget.

I will likely abandon my Optical Flow testing for now and simply switch back to BARO and GPS with a parameter change. Perhaps the better sensors will come down in price for DIY users and I can revisit Optical Flow on a new copter firmware release. I am also waiting for prices to drop on RTK since $700 is beyond my hobby budget.

(Akm) #48

Hi Greg,

Thanks for sharing your experience. I can understand the difficulties you have gone through. Even I am on the same page.

Let me share my story:

My stack:

  1. Firmware installed - APM:Copter V3.5.0-rc6 (efab409b)
  2. PixFlow - Optical Flow
  3. Range Finder - Garmin Lidar Lite V3. Used PWM Connection.

I followed this guide step by step -

Test 1:

I tried the First Flight (Copter Only) as mentioned in the guide - I started flying the copter indoor in STABILIZE mode with EKF_GPS_TYPE = 0 at a height of 1 meter (approx). After a few minutes of flying, I switched to ALT_HOLD mode and my copter suddenly took an extreme hike in altitude and hit the ceiling and crashed, damaging the legs. Though it was not enabled to let ELF use Optical Flow, I am not able to figure out what went wrong.

Test 2:

I went to open space, set the EKF_GPS_TYPE parameter to 3 to make the EKF ignore GPS and use the flow sensor. Started flying in STABILIZE mode, took to copter to a height of 2 meters (approx), then switched to LOITER mode - Just in a nick of time, the poor copter dropped down damaging the legs, props and one motor. It didn’t get disarmed, I guess it just couldn’t respond to the throttle or something I don’t know.

Attached the logs for reference.
test1-stabilize-alt_hold-crash.bin (2.6 MB)
test2-stabilize-loiter-crash.bin.log (3.3 MB)

I am expecting to find the reason for these behavior before I do any further experiment with my copter.

My today’s goal was to test Position Hold using Optical flow and Lidar Lite V3 in LOITER & ALT_HOLD mode. But my ultimate goal is to make this thing work in GUIDED & GUIDED_NO_GPS mode. I want my copter to hold position even if GPS is not available for which I thought I could use Optical flow. So after this, i need to figure out - How to make this work in GUIDED mode.


(Soubhi) #49

Was you able to achieve position hold using PX4Flow in guided or guided_noGPS mode?

Thank you

(Just for fun) #50

Very helpful tread, thank you for posting!

What is the most up to date information on optical flow integration?
Best firmware version for success?