This is a discussion of getting the PX4Flow sensor working with Copter-3.3.1 (or higher).

Views: 23376

Reply to This

Replies to This Discussion

A big thank you goes out to Randy MackayPaul Riseborough, and other APM developers. They are the ones who've worked tirelessly to make this whole thing work and they've also been helping us troubleshoot in various forums. I've just summarized what they've posted in different places.

Thank's Wes.


Can you use both OF and GPS?

I see that the solution to get OF working lies in setting EKF_GPS_TYPE -> 3

But this sets the EKF to not use the GPS. Can you then still automatically fly GPS waypoints?

Does the NKF support fusing both?



Thanks a lot Goro,

I've followed wiki and yours above but I'm totally under trouble with Optical Flow. 

I got OF flashed and lens focused by QgroundControl but I couldn't get OF.bodyX, OF.FlowX, IMU.GyroX matched like wiki.

And also during flying test, even with EKF_GPS_Type = 3, my copter just said "3D Fix needed" in Loiter mode when I tried arm it.

Attached my log and copter.

Very appreciated if you can give me any clue ^^;


Thank you Paul for posting very useful information!

I'll switch to master and give EKF2 a try later and report back.

Hi Kyomo,

I see you are using vanilla v3.3.1, which will not let you arm in Loiter without 3D Fix. You'll need to patch the source code and build the firmware yourself, or use v3.3.2-rc2.

As far as I know, is the only version that will work with APM firmware, and when I tried other versions of PX4FLOW firmware, I couldn't get bodyX, etc. to match up either.

Hope it helps,

Hi Jon,

I'm not an expert on this, but by looking at the EKF source code, it looks like GPS won't be used at all when you set EKF_GPS_TYPE to 3. However, when you fly in GPS mode and if you lose GPS signal, and if OF data is available, it looks like the software will fall back to using OF (AP_NavEKF_core.cpp around line 500).

I haven't looked at EKF2 code, so I have no idea about that.

In any case, I hope someone who knows what they are talking about could confirm/correct me.

Very nice that there is a thread for the PX4Flow, and thanks to all the developers for their hard work.

Below is a video where we take off to 1.5m, turn 180 degree, then command a 1m move via Dronekit. After reaching 1m, it lands.

The takeoff could use some work, I think we'll try using EKF2 and setting RNG_GNDCLEAR and RNG_OFFSET next.

Would I be correct in assuming that if we had about 20cm legs, the takeoff could be performed fully under optical flow?

Thanks, going to give that a try next time. Currently we're still hampered a bit due to the Lidar Lite jumping to 12m occasionally, we moved it to its own BEC, but now it just up and quits sometimes.

I've ordered some stuff (Traco TSR 1-2450) for a dedicated power supply, according to Pulsedlight the stability of the 5V is critical.

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.

Can you set RNGFND_MAX_CM to 1100 to ignore Lidar Lite readings above 11 meters?

It's hard to tell from such a short flight, but it looks like the quad may be drifting on X-Y axes.  I had this problem (my Loiter using OF was drifting back and forth) and was able to significantly improve it by going into Mission Planner and adjusting upward the Loiter-P value.  This made the response to drifting in X-Y much more aggressive.  If you crank it up too high though, the quad will start "jitter" in place when loitering. 

Also, I think it's recommended to have a decent amount of variation on the surface the camera is looking at.  I can't tell, but that grey carpet might be too uniform.  Maybe put down painter's tape or something that won't blow around? 

Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service