Servers by jDrones

How to setup and check Optical flow

I loaded px4flow-klt-06Dec2014.px4 when I used copter-3.4.5
Do I have to load OpticalFlow Firmware again ?

If it is enabled it should work ok

1 Like

I could fly my quad to use PX4FLOW and LiDAR light v3 with copter-3.4.5.
I want to fly my quad indoor without compass this is why I want to use copter-3.5.2 and EK3.


Yes release 3.5 can do that.
I guess you mean without GPS … Compass still work indoor, its just less efficient because of magnetic perturbation.

Yes, I mean without GPS and Compass.
But I got it.
That’s what I thought.
I should consider another way.

By the way, Do you know how to work optical flow on 3.5


Please take a look at this thread:
The copter does not takeoff in Guided mode and EKF_GPS_TYPE = 3 (optical flow)

Thank you for always your reply.

I looked into following URL and set up my quad but opt_m_x, opt_m_y and and opt_qua values are still zero.
So I tried connect to pixhawk via console and executed px4flow test command.
When I execute px4flow test on 3.4.5 the result is PASS but on 3.5 the result is command not found.
Are there anything that I have to do ?



Well, that is not normal, I will give it a try
What is your PixHawk type?
Can you test with the PX4Flow as the only device on the I2C bus?
@rmackay9 can you replicate ?

BTW, you cannot use the px4flow test on 3.5
Here is what @OXINARF wrote: The command not existing is perfectly normal, 3.5 uses our in-tree px4flow driver, not the old px4firmware driver…

Do you have any error on mission planner, like bad optflow or else ?
Do you confirm the opticalflow as being active in the parameters ?

Please show this picture.
This is my PixHawk

I tested with the PX4Flow as the only device on the I2C bus.

no I can not replicate. is likely to be caused by my issue.
I try look more closely it.


It’s hard to say without looking more closely at the logs but I suspect the pull request 6803 is the cause of the problem.

You could test by load “master” onto the pixhawk. Go to MP’s install firmware screen and press Ctrl-Q and you should see the firmware name change to “APM:Copter V3.6-dev Quad”. Try loading that and see if it’s working better. We don’t understand exactly why some people are having initialisation issues with the px4flow. I personally don’t ever see the problem. For some users at least it appears to be a power issue - if the pixhawk and flow sensor are only powered from the USB port, it seems the flow sensor starts more slowly.

We actually haven’t received confirmation from any user that the above fix resolves the problem so looking forward to hearing how it goes.

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

Servers by jDrones