Over the course of this summer, I have been working on a research project at the University of Virginia involving a flying camera platform indoors. Seeing as GPS is not a valid option for indoor loitering, I chose to use a combination of px4flow and LIDAR-Lite sensors to maintain position. Seeing as documented personal experiences are in short supply, I figured I would share my experience and what I learned. I also want to say that I have been part of the community for several years, and until now, I have not done anything interesting or new enough to post about, so I am overly excited to be posting :)

As always, the adventure began on the wiki. The PX4FLOW page referenced needing a rangefinder, recommending the LIDAR-Lite, which I hastily ordered. One bit of advice, check to make sure you have all the required cables before you hit order. When they both arrived, I realized I did not have any 4-pin DF13 cables, one of which is used to connect the OF sensor to the Pixhawk.


Not letting that deter me, I started with the LIDAR. Following the instructions on the wiki, I decided to use PWM as my interface, because I did not have the required capacitors for I2C, and my I2C bus was filling up. 15 minutes later, I had the wiring done, and had reflashed the firmware on the copter to the newest 3.3 beta. Configuration was easy, again following the wiki, and a quick test flight verified the sensor's operation. As soon as the DF-13 cable arrived, I again followed the wiki for configuration and setup of the Optical Flow, which went without a hitch.


Now begins the fun part; Tuning and testing. With the sensors installed as shown above, I began the tuning process by focusing the OF camera. This took a bit of time, and a good bit of work. First, the wiki recommends installing specific firmware on the OF Camera. The trouble was, the newer version of QGroundControl refused to let me choose my own firmware to upload. I managed to track down an older version of QGroundControl, and uploaded the firmware. From there, connecting and viewing the video is easy. I would recommend setting the sensor to "video only" mode, as you will get a much higher resolution for focusing.

With the camera focused, I began the tuning procedure in the wiki. This is an absolute must. I thought that it would not be needed, but the results of my first test before tuning were truly too horrendous to even post. With the config rechecked, the camera refocused at the correct distance, and some tuning, the senors resulted in a much better flight, which the logs back up. 


Once the OF and gyro data all lined up nicely, I switched the EKF filters from using GPS to using OF, and took the copter outside for my first flight. The results were spectacular, and the copter was able to hold position in wind, without so much as a wobble, up to 25 feet in altitude. Confident, I brought the copter into the reactor room, the environment it would be flying in on a daily basis. When I took off, the copter almost immediately veered off and nearly crashed into a chair. Disheartened, I looked through the logs, and found that the optical flow was, once again, getting inconsistent readings. 


After re-reading the wiki page, I realized that the whole reactor room was lit up with nothing but LEDs, and not very bright ones. I immediately brought out all of the drop lights with halogen bulbs I could find in the building and lit up the floor of my test area. The test flight confirmed that the light, and type of light, in that room was the problem, as the copter performed flawlessly. After adding the FPV system, I had a platform that would fly in one spot and live stream video from the air. Below is a test flight I recorded, and sorry for the potato-quality lighting, it is a result of the LED lighting in the room. 

The eventual goal is to put the Tarot Gimbal I took off the IRIS+ back on, and use the gopro for video. I have yet to figure out how I intend to do that, as there is very little realestate on the bottom of the IRIS+, but I will update this blog if I manage to figure it out. I hope this helps someone, or was at least entertaining! If anyone has any questions, I will be happy to help. Thanks for reading!

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • Hi  Austin.

    What version of firmware did you use ?

    Have you ever been worked opticalflow with AC 3.6-dev ?  

    I try set up opticalflow with AC 3.6-dev on PixHawk but it does not work. 

    I use PIX4FLOW and garmin lidar lite v3.

    I could fly my quad to use optcalflow with AC 3.4.5 but  I can't it with AC 3.6-dev.

    I'd really appreciate it if you could give me your opinion on it.


  • Sorry for the long wait on replies! Been very busy with school and ramping up for the SUAS competition!

    Vinh L: Yes, that is the optical flow sensor I was using. Back then the beta firmware was required for them to work together, but as far as I have heard, the main release now has support. 

  • Fabio- I am using version 2 of the lidar. I powered it from an old Castle Creations 10A BECI had laying around, and it works perfectly. I would suggest trying again with PWM, as it worked almost instantly. Let me know if you hav any more questions!


  • Hello Austin,

    are you using some kind of BEC for powering? If so, which one is it?
    I tried to use an ultrasonic range finder, powered directly from the pixhawk, but the readings were too unreliable, despite my efforts to shield it and grounding it and using I2C as transmission protocol. Therefore, I'm considering the idea of getting the lidar lite. BTW, are you using version 1 or 2 of the lidar?


  • Roberto-

    If all else fails, go outside into the sun, and check for correct operation. I have found lighting to make more of an impact than anything on performance. Also, keep an eye on what the surface below looks like. Optical Flow seems to be working well with most surfaces, from asphalt to gravel to plywood floors and concrete. Surfaces I have found problematic include gridded floors, and occasionally, grass. I have found it to work most places though :)

  • Moderator

    Hi Austin,

    today i did some test with Luca in some situation flight very well in other some iusse and toilet bowl whe work it's fantastic but at the moment my opinion it is ,too in early stage of development ... 

    We are uploading our video now .. Solve the problem in easy way deactivated all the pre flight check because for this kind of mode at the moment there are some bugs in the pre flight check.


    Roberto Navoni

  • Roberto- 

    I use standard loiter. Because of the conditions I am in (Nuclear reactor, even compass has problems), I disabled all the arm checks. I do not recommend it, but I am in a highly controlled environment, where I am the only one inside. You need to arm and take off in loiter mode, and if you replace the EKF filter value with the optical flow value, it should not yell at you about 3D fix. That is the same firmware version I am using, so it should work well :) Let me know if you need more help!

    -Austin Suhler

  • Moderator

    Hi Austing ,

    what kind of mode are you using for flight with Optical Flow ? The standard Loiter ? or OF_Loiter ... I have this kind of experience until now tih APM 3.3rc8 and i don't already understand where is the problem ...

    in last week we are testing the APM 3.3rc8 on VR Brain 5.2 , we are
    checking all nuttx driver and advanced functionality like Optical Flow
    loiter and lidar terrain following functionality.
    So about the lidar we are very happy ... did a lot of test and all
    work fine as you can see in this video:

    After the test of alt hold we start to evaluate optical flow , follow
    the wiki instruction did the first fight well and check the log ...
    then activate the optical flow , armed the drone in stabilize ,
    because in loiter the pre flight check tell that is not possible
    without 3D fix .. then switch in loiter and try to take off. When i'm
    taking off i check if the command on roll and pitch work well but it
    don't work ... don't move the drone ... only throttle work if i re
    switch to stabilize i re take the control on pitch and roll .
    What could be the problem ? Are there some guys that sucessfully check
    this release of firmware with Optical flow ?
    Thanks in advance

This reply was deleted.