Px4Flow: Trouble getting any response over I2C

Hi Harry,

I’m flying 3.6 for about a month now (started with the master version before the beta was released) since I needed a compatible driver for the Teraranger Evo.
For my usage the version seems pretty stable for now.
I performed the auto-tune process for all the axes, changed a bit the values and my copter is quite stable.
As far as I understaned LOITER mode change dramatically in this version and also more controllers were added, I refer you to Leonard Hall lecture for more info: http://ardupilot.org/dev/docs/apmcopter-programming-attitude-control-2.html

Eventually i’m trying to fly my copter in an indoor enviroment with the px4flow and an external rangefinder.

It works great in a well textured terrain (outside) but in indoor narrow spaces I have difficulties:

  1. The px4flow is pretty poor in terms of FOV and resolution so you relly need a well textured terrain for it to not carried away ,my Mavic-air on the other hand stable like a rock where the px4flow can’t hold position in LOITER.
  2. I’m also having trouble to relay on the rangfinder as my main ekf alt source - I refer you to my openned isuue, maybe you will have some insights: Issues when EK2/EK3_ALT_SOURCE = 1

Cheers, Gal.

I have excellent results indoor with different sizes quadcopter 450 -330 -250 and 180
Yes you need good texture , good lighting, tight IMU-OpticalFlow correlation in the signals (phase & amplitude) and ekf3.

You set home ekf in mission planner map , walk the quad in a square pattern to define the boundaries and then you can takeoff in guided mode and go within these boundaries
Beware of the IMU drift when the vehicle is static

1 Like

I do fly with EK3 enable.
I dont want to fly AUTO and WP navigation just trying to hover in place in LOITER.
What is your rangefinder type? do you using EK2/3_ALT_SOURCE=1? what is you px4fow nominal noise in [rad/sec] when hovering?

Yes Loiter is the preferred mode for OpticalFlow.
Rangefinder is a TFMINI with I2c Arduino interface == the cheapest you can get :wink:

I think the nominal noise is more a PX4 type of sensor signal ?
As a substitute we can look at FIX,FIY - optical flow X and Y axis innovations (mrad/s) , here is the graph from my last test with 3.6

I also updated the discussion about 3.6 and Loiter mode with Optical Flow, just amazing !!

I can see your image of the gyro.x VS body.x VS flow.x. but when you hover what is the nominal noise of the Opt.flow?
The default flow noise something parameter is set to 0.25, so I think that any Opt.flow read below this value is ignored.
My graphs lookes pretty much the same or even better in terms of correlation of the Opt.flow to the IMU but it keep drifting randomly.

What floor type do you have indoor?

I have s textured rug with a good Led lighting
Where do you read the nominal noise?
Btw the latest test were using the 330 frame

1 Like

Hi…as per my experience the startup timing is very crucial when working with px4flow, it need to be powered up before the autopilot.When I turn on my system the I2C bus getting his voltage from the Pixhawk servo rail it randomly recognize the px4flow.

board assembly

What type of FC… PixHawk 2 ?

@ppoirier, I circled in red color what I meant, I guess the copter is in hover but the flow have some noise compering to the gyro reading, about 50 [rad/sec]?
Does the copter manage to hover in place in this specific stage?
I’m using Pixhawk.

@ChesLans, I’m dealing with the same thing… for solving this i’m powering the flow first through the USB and after connecting the battery i’m disconnecting the USB.
I thought of using a seperate 5V regulator for the I2C bus and put a capacitor between the power-module to the pixhawk line in order to delay his start-up.

Does anybody of you using EK2/3_ALT_SOURCE=1?

Here is a test I just completed on the Q330

Here is the video of test

Here is logging of OF flow - Body - IMU Gyr and Rangefinder distance -altitude of TFMINI

Here is logging of EKF Innovation of Optical Flow X-Y

1 Like

Please take note that most of the instability is caused by the airflow on this confined space.

ppoirier: The plots from your flight for of.flowx and of.bodyx are extremely helpful. Now that I have data from my px4flow I’m working on the set up of the device. your example of a working system is very helpful, as an addition to the wiki information, in interpreting my own results. I noticed you have scaling set high as your of.flowx looks to be consistently higher than of.bodyx, from what you have seen, is this consistent for all setups?

As a follow up, I have solved my issue with getting data over the I2c, at the end of the day my problem was probably due to a faulty or damaged df13 connector. (from back in the day of PH1) I now have a new I2c splitter and all new connectors.
However, Startup on battery is not solved. I get consistent results only if I start up the PH via usb power then switch over to battery. Looks like this is still a problem for some. I plan on living with this for now and hoping for a solution in the future.

Good to know it help :slight_smile:
Yes my OF is about 125% over the IMU == that really helps making the vehicle more responsive on OF while flying manually… Just like PID you make adjustements according to your preference. But just like PID, you have to master the basic adjustments before getting in ‘‘advanced tuning’’.

@rmackay9 seem the coldstart of PX4FLOW has not been resolved.

Hai Ppoirier,

I am trying to connect 2 devices to the I2C of pixhawkFC

  1. PX4 flow - for flight stabilisation
  2. TeraOne Range finder - for height measurement
    Will pixhawk recognise these 2 devices just by connecting them using an I2C splitter, since both devices are supported with pixhawk ?

one more doubt while trying to do calibration of PX4 flow, the following parameters didnt give any readings.

  1. OF.flowX & Y
  2. OF.bodyX & Y
    What exactly does these parameters stand for?
    On the other hand I got results for these following parameters:
    1.flow_comp_m_x
    2.flow_comp_m_y
    These are bit confusing what each parameter means !

in the wiki to verify px4 flow is working it was mentioned to check opt_m_x and y i guess these are same as flow_comp_m_x and y . So in conclusion i am curious to know is my optical flow sensor working fine or why i am not getting any value for of.flowx and y.
Below image shows my attempt to verify optical flow

,

Thanks in advance

Hello
According to wiki:
If the sensor is operating you should see non-zero opt_m_x, opt_m_y
So if you move the quad, you should see these values in Mission Planner.

And you should calibrate with the log files as desribed in the wiki.

There is no problem on having both PX4FLOW and Lidar on I2C.

Thanks for your response !
I got non-zero opt_m_x, opt_m_y values and I have plotted the same in the above graph.
but later in wiki they are plotting OF.flowX and OF.flowY for calibration. I dont understant what OF.flowX and OF.flowY are ! Im getting its value zero

they are in the log file == open log with mission planner

Connect to your flight controller and ensure that logging while disarmed is enabled (In Copter-3.3 set LOG_BITMASK to 131071, In Copter-3.4 LOG_DISARMED to 1)

TEST

Download the data flash logs and plot the OF.flowX , OF.bodyX and IMU.GyrX data. It should look something like this:

Are you using pixracer on the frame? And I guess the motors are RED DJI,right?

Hello
Yes PixRacer with latest firmware and good supply to the PXFlow. Motors are cheap AliExpress ones.

1 Like

It’s end of 2020 and I still cannot get my PX4flow to work when starting on battery. I tried the latest 4.0.4 and 4.0.5 and still have this same problem. Only startup on USB works.
Have you resolved this issue by any chance? If so, could please share how you did it?
Thanks