Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holybro UART optical flow (thoneflow driver) severe oscillations position mode [Bug] #22220

Closed
dirksavage88 opened this issue Oct 13, 2023 · 6 comments · Fixed by #22611
Closed

Comments

@dirksavage88
Copy link
Contributor

Describe the bug

I've tested the holybro uart sensor on a 210mm wheelbase quad and found severe position oscillations when using 1.14, main, and even going back to 1.13.3 stable. I swapped the holybro sensor for the Ark can flow sensor with updated cannode firmware (recent main) that includes the gyro bias estimation fixes. The ark flow worked great.

See this forum discussion:
https://discuss.px4.io/t/holybro-optical-flow-sensor-thoneflow-oscillations-on-main/34768

To Reproduce

Enable the thoneflow driver, set the OF, EKF2, and rangefinder params, and take off in position mode

Expected behavior

Optical flow position mode holds stable position with minimal oscillation

Screenshot / Media

Here is a pitch angle plot from the holybro sensor: bokeh_plotpitch_thoneflow

Same exact hardware setup except the ark flow:
bokeh_plot_pitch_arkflow

Flight Log

Holybro (like a merry go round) : https://review.px4.io/plot_app?log=94031e37-9350-4b03-a76e-19fdd9cdcf4d
Ark can flow (I'm not moving): https://review.px4.io/plot_app?log=7ea5d915-144a-45ff-971c-76aa3d33732e

Software Version

tested with similar results on stable, 1.14 beta, recent main

Flight controller

holybro 6c mini

Vehicle type

None

How are the different components wired up (including port information)

No response

Additional context

No response

@DronecodeBot
Copy link

This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/holybro-optical-flow-sensor-thoneflow-oscillations-on-main/34768/1

@dagar
Copy link
Member

dagar commented Oct 18, 2023

image

@dirksavage88
Copy link
Contributor Author

As requested @dagar @bresch here are three logs that show an attempt at a box pattern as well as spinning by hand in position mode while armed (but landed):

  1. box pattern: https://review.px4.io/plot_app?log=08d11193-1a40-498f-b366-cd56d09862eb
  2. Spinning 1: https://review.px4.io/plot_app?log=9ed53bbc-df6c-41e1-95c2-882b4cd0bfda
  3. Spinning 2: https://review.px4.io/plot_app?log=6ad9c489-5c97-4fcc-b172-a645d395fc93
  4. EKF2 replay from box pattern: https://review.px4.io/plot_app?log=27ad9e20-8aa6-4d33-a137-3d20e8fe3348

@jfaure6
Copy link

jfaure6 commented Nov 29, 2023

Hello @dirksavage88 !

I observe exactly the same phenomenon with the same hardware (pmw3901, thoneflow driver in UART).
My setup is Holybro's px4vision in v1.5. Note that I also have the Holybro PX4Vision in v1, with the PMW3901 in SPI, but with this configuration, I do not observe any oscillations.
You can view the logs:
v1.5 : https://review.px4.io/plot_app?log=d2530b83-3116-4b63-a292-8a3d440a3993
v1 : https://review.px4.io/plot_app?log=e8908b3a-7745-41a9-859f-4bbdddd4349a

@bresch
Copy link
Member

bresch commented Dec 11, 2023

Looks like the scale in the driver might be wrong. Try divide those scales by 2 (replace 3.52e-3 by 1.76e-3):

flow->pixel_flow[0] = static_cast<float>(delta_x) * (3.52e-3f);
flow->pixel_flow[1] = static_cast<float>(delta_y) * (3.52e-3f);

@mmalecki
Copy link
Contributor

mmalecki commented Jan 5, 2024

This patch has greatly improved OF performance with this sensor for me:

Before, note the oscillations with no RC input:
before-patch

After, lack of earlier oscillations:
after-patch

Thanks @bresch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants