Servers by jDrones

How to setup and check Optical flow

I’ll try optical flow with 3.6-dev following your instructions and then I’ll report the result.

Thanks a lot.

I tried to use just optical flow with AC3.6-dev.

PX4FLOW was detected by AC3.6-dev I confirmed it via NSH console.
Following command typed on my ubuntu machine.

 sudo gtkterm --port /dev/serial/by-id/usb-3D_Robotics_PX4_FMU_v2.x_0-if00

I could find the message in console that is “Found PX4Flow on bus 1”.
But optm_x, optm_y, opt_x and opt_y were updated only once.
Their values did not update despite I rotate about PX4LOW in roll and pitch.
Should I need to remove PX4FLOW firmware ?

I also tried to see following codes.
This might just be my idea but AP_OpticalFlow_PX4Flow::timer does not work well.
Is this function reads data directly from PX4FLOW ?

bool AP_OpticalFlow_PX4Flow::setup_sensor(void)
   if (!scan_buses()) {
      return false;
   // read at 10Hz
   dev->register_periodic_callback(100000, FUNCTOR_BIND_MEMBER(&AP_OpticalFlow_PX4Flow::timer, void));
   return true;


Where do you try to read these values?
Within Mission Planner, open the Flight Data screen’s Status tab. If the sensor is operating you should see non-zero opt_m_x, opt_m_y and an opt_qua values.

I connected PixHawk to Mission Planner via USB and then I push PX4FLOW 's reset switch after a few seconds the value of opt_m_x, opt_m_y and opt_qua in HUD are updated only once.
After that these values are not updated. I try this operation several times the results are same.

If you moving the opticalflow camera around , does it shows numbers?

I tried to move opticalflow camera around, it does not show numbers.
I tried it with AC3.4.6, it shows numbers very smoothly.

I am waiting for delivery of a PixHawk like yours in a few days, I will update

I will take a video which I am operating PX4FOW and Mission plannner then upload it to youtube and I post its url here.
Please wait for until tomorrow.


This is the the video which optical flow with AC 3.4.5

This is the the video which optical flow with AC 3.6-dev

I have the same issue.

    • When I start the Pixhawk normaly opt_m_x and opt_m_y shows zero.
    • When I start the Pixhawk with USB cable opt_m_x and opt_m_y shows valid values.
    • When I start the Pixhawk normaly and execute preflight_reboot_shutdown opt_m_x and opt_m_y shows valid values.
      No difference if I use i2c 0 or i2c 1

I use the Pihawk cube with the Spektreworks PDB.

Hopefully the information can help.

I just received my Pixhawk, connected USB, updloaded latest firmware, connected the px4flow and configured.
After reboot (necessary because of the I2C init), reconnected to mission planner and it works fine
See the numbers under the HUD (0 .12 & -0.15)

Oh that’s great.
Anyway I’ll try it to use latest firmware.

Thank you for your infomation.

Hi ppoirier.

I tried it to use latest firmware (AC 3.6-dev) then the number of opt_m_y and opt_m_x appeared on the HUD (0.7 & 0.1).
I try moving the opticalflow camera around but these values remain unchanged.
As is obvious I do it in lighted environment.
If you moving optcalflow camera around the value of opt_m_y and opt_m_x on HUD are updated?

Yes the value changes according to x-y movements


I’m following this thread and it’s being very interesting to read! One question: If GPS is lost during flight, would the FC switch to OpticalFlow automatically and maintain position? I’m thinking about having OpticalFlow as a failsafe to prevent the Copter to fly away when there is no more GPS. Is that a real use case?

Kind regards,


Yes, actually the EKF is blending both signals and will progessively reject a bad Gps and use the opticalflow as the velocity estimator (with IMU as state estimators as well). When Gps gets back to normal the EKF will mix it back.

There is are parameters EK2 and EK3 than set the gps and other state estimators confidence levels

@ppoirier Thanks! That sounds promising!

Hello everyone, I do not know if it is the right thread for this query but since I see that it seems that you have worked with the px4flow you can maybe tell me what I am doing wrong.

I think I followed the steps of the wiki well but when I do the manual test I get the following graph (the same thing happens with pitch).

Bin archive:!AhvJ_mXkKaypwYUbRNY87zEN5XI6tQ

I also met this issue, opt_m_x, opt_m_y and opt_qua in HUD are updated only once.

1 Like

Im really sorry but suddenly I remembered this information here. These connections doesnt seem to have a sonar included am i missing something ?

Servers by jDrones