This is a discussion of getting the PX4Flow sensor working with Copter-3.3.1 (or higher).
You need to be a member of diydrones to add comments!
This is a discussion of getting the PX4Flow sensor working with Copter-3.3.1 (or higher).
You need to be a member of diydrones to add comments!
Replies
Just in case it might be useful to someone trying to get OF to work, here's a copy of my notes on getting OpticalFlow working with Copter v3.3.
I have it kinda/sorta working (with some intermittent issues), and I'm not 100% sure if everything is setup correctly and I'm sure I've missed something, so any feedback will be greatly appreciated.
Thanks!
Download PX4FLOW Firmware
Download the APM's version of PX4FLOW Firmware from: http://ardupilot.com/downloads/?did=118
(The expanded firmware should be
px4flow-klt-06Dec2014.px4
)Flash PX4FLOW firmware
NOTE: Some versions of QGroundControl are missing the menu to upload custom firmware from local filesystem. Use the latest version (v2.8.0) in order to upload the custome firmware to PX4FLOW. v2.8.0 also has PX4FLOW specific settings menu with auto-video streaming. If you want to run an older version of QGroundControl, use v2.5.2 or earlier in order to be able to load custom firmware to PX4FLOW.
All release versions of QGroundControl can be found here
Adjust PX4FLOW
Connect PX4FLOW to Pixhawk/PXF
Update Copter Firmware
Configure OpticalFlow
Via APM Planner 2.0 / Mission Planner
Change the following parameters:
Testing
Check mount orientation and tweak the scaler parameters according to the instructions in the wiki
Check dataflash logs (NOT telemetry logs) and make sure:
NOTE: OF.flowX and OF.flowY don't get updated in the telemetry log, so make sure to check the dataflash logs.
NOTE: Don't use OF_LOITER mode as they've been removed a long time ago from the firmware. APM Planner 2.0 still has this mode in the drop-down menu, presumably in order to support older versions.
Issues
px4flow status
command to see if the PX4FLOW module is detected on I2C and the driver is loaded. You should see a bunch of readouts if it's functioning correctly and error message otherwise.Questions
Misc. Notes
References
Can the image built from px4flow source code work with APM:Copter 3.3.1 that downloaded by MissionPlanner?
Yes, I think it should work. I'd recommend using Copter-3.3.2 though because it allows arming without a GPS.
I have just tried the V3.3.2 copter for pixhawk, and get below result
1.opt_flow enabled, EKF_GPS_TYPE=3.
2.opt_m_x, opt_m_y,opt_qua is not zero in flying data->status
3.EKF5.meaRng is between (0,3), EKF5.FIX goes up step by step from 0 to 20, EIF5.FIY keeps zero
4. tried several time ,loiter is not working
attachement is part of my log
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 ^^;
2015-11-25 15-05-40.log
OF.jpg
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, http://ardupilot.com/downloads/?did=118 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,
Thanks Goro, I'll try again and let you shared on the result ^^;
Hi,
You probably couldn't get it to match because the formula for scaling is as follows:
float flowScaleFactorX = 1.0f + 0.001f * flowScaler.x
float flowScaleFactorY = 1.0f + 0.001f * flowScaler.y
You are setting flowScaler.x and flowScaler.y and they get divided by 1000 and added by one.
So if you see in the log reviewer that they differ by a factor of 2 to 3 (which was for me the case), you need to fill in 1000 to 2000.
I had to fill in 2500 for my setup (1.5m above ground). Now they match better. But it is still difficult to tune as the way you roll the copter influences the data a lot. Try to tilt it like an inverted pendulum so the focal point on the ground doesn't move. Not just rotating copter around its own axis.
Hope this helps.
Cheers,
Jon
That is some of the best and most complete diagnostic and set up information that I have seen on the PX4flow to date!
Thank you again!
A big thank you goes out to Randy Mackay, Paul 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.