# Optical flow without GPS

**URL:** <https://discuss.px4.io/t/optical-flow-without-gps/2801>\
**Category:** PX4 Autopilot\
**Created:** [March 18, 2017, 5:58pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801 "2017-03-18T17:58:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrit](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/ea5d25/32.png) [@shrit](https://discuss.px4.io/u/shrit)\
**Post date:** [March 18, 2017, 5:58pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/1 "2017-03-18T17:58:03Z")

</div>

Good day everybody,

For a while I have been watching these youtube videos:

[![](https://img.youtube.com/vi/nsQYg6iLNUc/maxresdefault.jpg "Pixhawk - optical flow position control") ](https://www.youtube.com/watch?v=nsQYg6iLNUc)

[![](https://img.youtube.com/vi/MtmWYCEEmS8/maxresdefault.jpg "Pixhawk PX4Flow indoor demo") ](https://www.youtube.com/watch?v=MtmWYCEEmS8)

[![](https://img.youtube.com/vi/4MEEeTQiWrQ/maxresdefault.jpg "Pixhawk PX4Flow outdoor demo") ](https://www.youtube.com/watch?v=4MEEeTQiWrQ)

The drone seems to be very stable, however I also have an optical flow module, and I have never obtained anything similar using my drone, even i have better isolation and frame than these drone in the above video.  
By looking at youtube comments it seems that the pilot is using a different forked firmware, so the question is: Does these modifications have be merged to the master? because the performance is outstanding.

---

<div class="post-metadata">

**Author:** ![rolandash](https://discuss.px4.io/user_avatar/discuss.px4.io/rolandash/32/4936_2.png) [@rolandash](https://discuss.px4.io/u/rolandash)\
**Post date:** [March 18, 2017, 6:37pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/2 "2017-03-18T18:37:23Z")

</div>

There are nothing special about in firmware or other forked branch. We have tested a lot of optical flow and it does the same as in video.

You should probably check carefully about your environment(illumination, texture, etc) and your optical module setup.

---

<div class="post-metadata">

**Author:** ![shrit](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/ea5d25/32.png) [@shrit](https://discuss.px4.io/u/shrit)\
**Post date:** [March 18, 2017, 8:53pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/3 "2017-03-18T20:53:26Z")

</div>

HI,

For installation of the camera (px4flow) i have checked a lot of time, there is no problem, it is shifted 2 cm from the center of the drone.  
I also changed efk to lpe in SYS configuration, However so far. I’m not able to access the list of lpe configuration even after booting the pixhawk, QGC always shows me the set of configurations for efk.  
At the end I don’t know if you guys know how to be sure if the camera work, for instance. Does it show data in the log?

---

<div class="post-metadata">

**Author:** ![rolandash](https://discuss.px4.io/user_avatar/discuss.px4.io/rolandash/32/4936_2.png) [@rolandash](https://discuss.px4.io/u/rolandash)\
**Post date:** [March 19, 2017, 4:12am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/4 "2017-03-19T04:12:41Z")

</div>

You can read the PX4 dev doc, to see how you can calibrate and setup optical module in QGC, as well as making sure your sonar is working properly. Also if you are not using MindPX/Mindracer, flow support may not be started by default(not quite sure you may need to double check).

Also, it is very important to make sure your environments can meet the minimum work condition of flow.

---

<div class="post-metadata">

**Author:** ![shrit](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/ea5d25/32.png) [@shrit](https://discuss.px4.io/u/shrit)\
**Post date:** [March 19, 2017, 5:59pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/5 "2017-03-19T17:59:56Z")

</div>

I have read this document, by following the instruction I should be able to get the set of LPE, settings, which never happens, by the way Does the camera have a log which might help?, I mean how to distinguish from damaged camera from a functioning one? QGC just show you the image received and ask you to optimize the focus.

Best regards.

---

<div class="post-metadata">

**Author:** ![AlexisTM](https://discuss.px4.io/user_avatar/discuss.px4.io/alexistm/32/3456_2.png) [@AlexisTM](https://discuss.px4.io/u/AlexisTM)\
**Post date:** [March 21, 2017, 12:00am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/6 "2017-03-21T00:00:14Z")

</div>

My guess is that you did not pimped correctly your PID, you should send a log (logmuncher) so we can see how “bad” it is.

Whatever is the localization system, if the PID is incorrect (not adapted to your model), you will fly but not well.

---

<div class="post-metadata">

**Author:** ![shrit](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/ea5d25/32.png) [@shrit](https://discuss.px4.io/u/shrit)\
**Post date:** [March 22, 2017, 5:40pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/7 "2017-03-22T17:40:30Z")

</div>

HI,

From my SD card, actually I didn’t understand all these data, as I’m not expert in drones.  
all of these flight contained px4flow camera.

Crash altitude hold was used :  
This test has finished by crash using altitude hold, the reason of crash is hitting a furniture, but the  
drone was not that stable before the crash and it was well drifting .

[http://logs.uaventure.com/view/PgrJWxgSFe5G5j4n5Yduo7](http://logs.uaventure.com/view/PgrJWxgSFe5G5j4n5Yduo7)

This are two another log from a general flight i used stabilized mode: I don’t remember how they were finished. but it might be helpful to see the drone behavior in general.

[http://logs.uaventure.com/view/byRFsHfr8CXjNb9YpQ5BoU](http://logs.uaventure.com/view/byRFsHfr8CXjNb9YpQ5BoU)

[http://logs.uaventure.com/view/uouFS7z3WCfwePnRvxnB6f](http://logs.uaventure.com/view/uouFS7z3WCfwePnRvxnB6f)

In general the drone has a slight drift.

---

<div class="post-metadata">

**Author:** ![AlexisTM](https://discuss.px4.io/user_avatar/discuss.px4.io/alexistm/32/3456_2.png) [@AlexisTM](https://discuss.px4.io/u/AlexisTM)\
**Post date:** [March 22, 2017, 6:03pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/8 "2017-03-22T18:03:54Z")

</div>

Looking at your logs makes me think the PX4Flow is not enabled. I guess the Local position X and Local position Y should exist with the PX4Flow.

I will do some tests tomorrow.

---

<div class="post-metadata">

**Author:** ![shrit](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/ea5d25/32.png) [@shrit](https://discuss.px4.io/u/shrit)\
**Post date:** [March 23, 2017, 10:18am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/9 "2017-03-23T10:18:04Z")

</div>

So if it is not enable, how to do it??

---

<div class="post-metadata">

**Author:** ![AlexisTM](https://discuss.px4.io/user_avatar/discuss.px4.io/alexistm/32/3456_2.png) [@AlexisTM](https://discuss.px4.io/u/AlexisTM)\
**Post date:** [March 23, 2017, 11:05am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/10 "2017-03-23T11:05:51Z")

</div>

I never used it but soon I will.

---

<div class="post-metadata">

**Author:** ![shrit](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/ea5d25/32.png) [@shrit](https://discuss.px4.io/u/shrit)\
**Post date:** [March 30, 2017, 9:01am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/11 "2017-03-30T09:01:40Z")

</div>

Well, after some configuration, and re-flashing the firmware of optical flow camera. I used the analyzer of QGC without arming or taking off, I see that x, y value are changing in real time especially when moving the drone, or moving some objects under the camera, which mean that it does work, However. when starting a flight test, the log values for x and y are always 0.

I remember the last flight, i switched from stabilized to altitude control, and the drone increased the throttle and got up to 3 meter directly for no obvious reason.

[http://logs.uaventure.com/view/E6RKa7RrjhSNBtGnNQ6Vxi](http://logs.uaventure.com/view/E6RKa7RrjhSNBtGnNQ6Vxi)  
[http://logs.uaventure.com/view/cFSYUvdKCB4rrypEYsA8n4](http://logs.uaventure.com/view/cFSYUvdKCB4rrypEYsA8n4)

Any ideas???

Thanks

---

<div class="post-metadata">

**Author:** ![AlexisTM](https://discuss.px4.io/user_avatar/discuss.px4.io/alexistm/32/3456_2.png) [@AlexisTM](https://discuss.px4.io/u/AlexisTM)\
**Post date:** [March 30, 2017, 9:24am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/12 "2017-03-30T09:24:04Z")

</div>

I have the same problem.

I will change the firmware to the 1.6.0 RC1 LPE version

---

<div class="post-metadata">

**Author:** ![shrit](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/ea5d25/32.png) [@shrit](https://discuss.px4.io/u/shrit)\
**Post date:** [March 30, 2017, 9:27am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/13 "2017-03-30T09:27:53Z")

</div>

I’m using 1.6.0 rc1, but i don’t know if there is a specific version for LPE

---

<div class="post-metadata">

**Author:** ![AlexisTM](https://discuss.px4.io/user_avatar/discuss.px4.io/alexistm/32/3456_2.png) [@AlexisTM](https://discuss.px4.io/u/AlexisTM)\
**Post date:** [March 30, 2017, 9:39am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/14 "2017-03-30T09:39:21Z")

</div>

> **[PX4/Firmware](https://github.com/PX4/Firmware/releases)**
>
> PX4 Autopilot Software. Contribute to PX4/Firmware development by creating an account on GitHub.

Download the ZIP and upload the `px4fmu-v2_lpe.px4` file.

Or else, it will be using EKF2

---

<div class="post-metadata">

**Author:** ![AlexisTM](https://discuss.px4.io/user_avatar/discuss.px4.io/alexistm/32/3456_2.png) [@AlexisTM](https://discuss.px4.io/u/AlexisTM)\
**Post date:** [March 30, 2017, 9:55am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/15 "2017-03-30T09:55:24Z")

</div>

In EKF2, you need to enable OF with the AID bitmask

EKF2\_AID\_MASK - AID bitmask

```
Set bits in the following positions to enable:
0 : Set to true to use GPS data if available
1 : Set to true to use optical flow data if available
2 : Set to true to inhibit IMU bias estimation
3 : Set to true to enable vision position fusion
4 : Set to true to enable vision yaw fusion
```

---

<div class="post-metadata">

**Author:** ![AlexisTM](https://discuss.px4.io/user_avatar/discuss.px4.io/alexistm/32/3456_2.png) [@AlexisTM](https://discuss.px4.io/u/AlexisTM)\
**Post date:** [March 30, 2017, 12:12pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/16 "2017-03-30T12:12:59Z")

</div>

It is running here, but the distance sensor with the PX4Flow is incredibly noisy.

I am looking how to disable it to use the PX4Flow + teraranger (which is very stable)

 ![](https://discuss.px4.io/uploads/default/original/1X/ad8fd318272bee761aeea0c21c3ff93fba21cbf2.png)

---

<div class="post-metadata">

**Author:** ![shrit](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/ea5d25/32.png) [@shrit](https://discuss.px4.io/u/shrit)\
**Post date:** [March 30, 2017, 12:32pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/17 "2017-03-30T12:32:24Z")

</div>

Which flight mode we have used during this test? in my logic if camera is activated, stabilized mode should use optical flow and should be quite similar to altitude hold.

best regards

---

<div class="post-metadata">

**Author:** ![AlexisTM](https://discuss.px4.io/user_avatar/discuss.px4.io/alexistm/32/3456_2.png) [@AlexisTM](https://discuss.px4.io/u/AlexisTM)\
**Post date:** [March 30, 2017, 1:37pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/18 "2017-03-30T13:37:54Z")

</div>

I used position mode to have a direct feedback from the PX4Flow.

Tried indoor (Low light enabled) and I had some quirks (drift issue)

Tried outdoor (Low light disabled) and had one quirk in a 3 minutes flight.

---

<div class="post-metadata">

**Author:** ![shrit](https://discuss.px4.io/letter_avatar_proxy/v4/letter/s/ea5d25/32.png) [@shrit](https://discuss.px4.io/u/shrit)\
**Post date:** [March 30, 2017, 1:51pm UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/19 "2017-03-30T13:51:40Z")

</div>

Thanks for your replay, i will try EKF, with the above configuration and see the results.

---

<div class="post-metadata">

**Author:** ![AlexisTM](https://discuss.px4.io/user_avatar/discuss.px4.io/alexistm/32/3456_2.png) [@AlexisTM](https://discuss.px4.io/u/AlexisTM)\
**Post date:** [April 3, 2017, 7:01am UTC](https://discuss.px4.io/t/optical-flow-without-gps/2801/20 "2017-04-03T07:01:15Z")

</div>

I tested again today, indoor, on a mat (used by kids to play cars) and it worked perfectly (+/- 10 cm, 3 inches)

[Next page](https://discuss.px4.io/t/optical-flow-without-gps/2801.md?page=2)
