• Thanks, Paul. That sounds promising. 

    We intend to fuse the data from PX4Flow and our IR-LOCK system. In the simplest implementation, IR-LOCK would be used to correct the drift. 

    Also, we were thinking of using IR-LOCK to compute x-y velocities, but I am not 100% confident in that approach. 

    What exactly do you mean by "accurately focused and calibrated sensor"? Did you use the default 16mm lens? 

  • Does anybody have experience with using optical flow at a much higher altitude, such as ~20m? ... My initial guess is that ~20m is probably not doable, but I would like to hear otherwise. :) We have some work that could benefit from it. 

  • In case someone might find it useful, here's my notes on using the sonar on PX4FLOW as the analog rangefinder.

    Since I mostly fly small quads indoors, I thought it would be nice to shed some weight by eliminating bulky and heavy LiDAR unit so I gave it a try, but it turns out my sonar unit was too noisy to be usable so I decided not to go this route, but your milage may vary.

    Using the Sonar on PX4FLOW as RangeFinder


    • Analog output on the EZ4 sonar is pin 3.
    • GND is pin 7.
    • Range of analog output is between 0.0v and the Vcc supplied to the sonar. So if you hook it up to 3.3 Vcc, maximum will be 3.3V. If you use 5V source, maximum output will be 5V.
    • PX4FLOW supplies 5V to the sonar, so the maximum output voltage from pin 3 is going to be roughly 5V (slightly lower in practice). Note that this fluctuates depending on the quality of power source. When powered via USB, it's usually lower than 5v, but when powered via battery and power module, it goes over 5V.

    • Make sure you connect the analog out of the sonar to Pixhawk's 6.6V ADC input.

    • DO NOT connect the PX4FLOW's sonar to the 3.3V ADC input directly as the maximum voltage will be too high for the 3.3V ADC port.
    • Pixhawk's 6.6V ADC input socket is 3 pos DF13. The center pin is the analog input. The pin on the right (when viewed from above) is the ground (if you are using pre-assembled cable from 3DR, it will be the other black cable). On Pixhawk, pin #1 (one one the left) is always Vcc on any of the DF13 sockets.
    • DO NOT connect 5V (red wire) to the sonar.

    If in doubt, consult these pages.


    # Analog=1, I2C=4RNGFND_TYPE=1
    # Analog output on EZ4 is linear
    # Analog input pin on ADC 6.6V socket is mapped to virtual pin 15.
    # If you've connected the sonar to ADC 3.3V socket (using voltage converter), it will either be virtual pin 13 or 14 (ADC 3.3V socket has 2 analog input pins combined).

    # EZ4 is linear and ratiometric
    # Don't connect stop pin (sonar will always be on)

    # The wiki says you should set this to 7m for EZ0 and EZ4, but that's for XL-MaxSonar series. HRLV-Max-Sonar-EZ4 on PX4FLOW only mesures up to 5m.
    # EZ4 on PX4FLOW won't return reliable data if the distance is closer than 30cm.

    # Adjust the following according to the description given by Paul Riseborough in the previous comment.
    # Distance in cm of the PX4FLOW unit from the ground.
    # In theory, the voltage range should be between 0.293V and 4.885V (300mm to 5000mm) when Vcc = 5V for the EZ4 sonar on PX4FLOW.
    # Acroding to the datasheet, EZ4 will return 4.885mV at 5m when given 5V Vcc.
    # 5m / 4.885v

    # Finally, if you are using EKF.
    # Use range finder instead of baro.

    # If you are using EKF2.
    # Use range finder instead of baro.


    • Before arming with range finder attached, you need to raise the aircraft to at least 50cm, but no more than 2m in height. Pre-arm logic checks the rangefinder's health status by confirming that both minimum and maximum values registered before arming is within certian pre-determined threshold (i.e. if the range does not go over 50cm, pre-arm check will fail. It will also fail if the reading goes over 200cm)
    • If the sonar is noisy and if it spikes to full output even for a short while before pre-arm check clears, you won't be able to ARM unless you reboot.
    • Also, if your sonar is mounted too close to the ground, the output on these EZ sonars tend to max out or fluctuate between min and max values, and you won't be able to arm. Again, you'll have to reboot.
  • Hi Paul, I'm not sure why log shows like that and I've tested it indoor like space under big bridge which protected GPS signal perfectly. I'll do test it again. Thanks for your comment ^^

  • Hi!
    I'm testing v3.3.2-RC2 using PIXHAWK and PX4FLOW.
    I read reply Goro Senzai and all comments. But still have two questions

    1) I’m set the EKF_GPS_TYPE parameter equal to 3 and trying take-off in Loiter mode. But copter lost PITCH control via transmitter and autopilot also cann’t control PITCH.
    2) On the floor always "Error compass variance". I arm copter in hand and then put on the floor. I set FS_EKF_THRESH 0 (and second test set 1), but nothing changed.

    Help me please with my questions. Thanks in advance

    2015-11-25 17-14-18 26.bin
  • Interesting.  It must've been fixing some other issue with my quad then.  To be clear, it was the setting labeled "Loiter PID" in the upper right hand corner of Mission Planner's settings that appeared to "fix" my loiter issues.  The settings labeled "Rate Loiter PID" did not resolve my issues. 

  • Randy/Paul--

    Under ideal Optical Flow conditions on a typical 450 class quadcopter (lots of incandescent light, varied ground texture, focused PX4flow, tuned PID settings, and altitude of ~1 meter) how much X-Y drift should we expect to see in Loiter Mode?    

  • We're doing a project where we would like to follow LED beacons in a parking garage, so we're going to be pretty much between 1 and 2m altitude all the time.

    Are there any plans to incorporate sonar backup for the lidar? If nobody is working on that yet, I could commit our changes? My idea would be to look at both sonar and lidar, then switch to sonar and reboot lidar if it becomes unstable.

    • Hi Fabien, 

      We are working on a somewhat similar project, but at a higher altitude. Let me know if I can shoot you a PM sometime. :)

      -Thomas (IR-LOCK)

    • We're interested in developing a "next generation" optical flow sensor where the camera lens is slaved to a high accuracy laser altimeter in order to provide dynamic focus and increase the useable range. We're looking for someone to flight test our new SF11 laser altimeter with the PX4Flow so that we can collect some real world data before moving forward with the final design. @Fabien, would you be interested in testing the SF11 on your project? We already have some high altitude flight data but we need verification of the short range performance as well :).

This reply was deleted.