Servers by jDrones

How to setup and check Optical flow


(Masanori Miyamoto) #21

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

Thanks.


(ppoirier) #22

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


(Masanori Miyamoto) #23

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 ?

3.4.5

3.5.2


(ppoirier) #24

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 ?
Related? https://github.com/ArduPilot/ardupilot/pull/6803


(ppoirier) #25

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 ?


(Masanori Miyamoto) #26

Please show this picture.
This is my PixHawk

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

@rmackay9
no I can not replicate.
https://github.com/ArduPilot/ardupilot/pull/6803 is likely to be caused by my issue.
I try look more closely it.

Thanks.


(rmackay9) #27

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.


(Masanori Miyamoto) #28

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

Thanks a lot.


(Masanori Miyamoto) #29

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

With FLOW_ENABLE = 1, AHRS_EKF_TYPE = 3, AHRS_GPS_USE = 0, EK3_ENABLE = 1 and EK2_ENABLE = 0.
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.
https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_OpticalFlow
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;

}


(ppoirier) #30

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.


(Masanori Miyamoto) #31

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.


(ppoirier) #32

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


(Masanori Miyamoto) #33

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


(ppoirier) #34

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


(Masanori Miyamoto) #35

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.

Thanks.


(Masanori Miyamoto) #36

This is the the video which optical flow with AC 3.4.5
https://youtu.be/Im7iXrNmgUs

This is the the video which optical flow with AC 3.6-dev
https://youtu.be/g1dqqHt5-Zw


Setup Optical flow problem
(Name) #37

Hi,
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.


(ppoirier) #38

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)


(Masanori Miyamoto) #39

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

Thank you for your infomation.


(Masanori Miyamoto) #40

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?