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

Lulu fixes and improvements #10416

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Lulu fixes and improvements #10416

wants to merge 6 commits into from

Conversation

pjpei
Copy link
Contributor

@pjpei pjpei commented Oct 16, 2024

Hi!

Thank you for considering this pull request!

I updated the LULU filter in the following ways:

  1. Changed the indentation to K&R with 4 spaces instead of tabs.
  2. Updated the interpretation to seemingly perform better at high throttle.
  3. Updated to have a proper fixed delay instead of quasi-variable delay.

I believe this is a better filter for higher throttle compared to the previous.

Let me know if I should change anything or fix anything!

@DzikuVx DzikuVx added this to the 8.1 milestone Nov 6, 2024
@Lisanderl
Copy link

Hi @pjpei How can I enable lulu filter to test it? Can I just build from this branch and flash to my FC ?

@pjpei
Copy link
Contributor Author

pjpei commented Nov 27, 2024

Hi @Lisanderl !

So it's exactly the same as the previous LULU, just using this branch instead of the previous.

I'll quickly lookup the previous instructions, but bottom line is you need to go to the CLI to enable it I believe :)

The "gyro_filter_mode" should be set to "LULU" instead of the other possible settings, and I believe that setting the "gyro_lulu_sample_count" to 3 should work fine for most craft. Maybe 4 if it's a larger craft. "looptime" at 500 ideally.

Unlike the previous recommendations I made. The other filtering can then be disabled (adaptive filter, rpm filter, etc) IMO and just then add a PT1 DTerm-Filter of 100Hz should be good enough (all my tests showed this was good enough on my craft).

I think just setting the above before tuning the PID should do

Note that the PID needs to be somewhat re-tuned with this, especially the d-term behaves a bit differently with the LULU filtering system.

Let me know if this works OK! :)

Kind regards,
@pjpei

@Lisanderl
Copy link

Hi @Lisanderl !

So it's exactly the same as the previous LULU, just using this branch instead of the previous.

I'll quickly lookup the previous instructions, but bottom line is you need to go to the CLI to enable it I believe :)

The "gyro_filter_mode" should be set to "LULU" instead of the other possible settings, and I believe that setting the "gyro_lulu_sample_count" to 3 should work fine for most craft. Maybe 4 if it's a larger craft. "looptime" at 500 ideally.

Unlike the previous recommendations I made. The other filtering can then be disabled (adaptive filter, rpm filter, etc) IMO and just then add a PT1 DTerm-Filter of 100Hz should be good enough (all my tests showed this was good enough on my craft).

I think just setting the above before tuning the PID should do

Note that the PID needs to be somewhat re-tuned with this, especially the d-term behaves a bit differently with the LULU filtering system.

Let me know if this works OK! :)

Kind regards, @pjpei

Thanks a lot for guideline! I will try in a few days and let you know )

@Lisanderl
Copy link

I have tried LULU on my heavy 7-inch quad with pretty 'strict' settings and It works well!
Settings:
loop time = 500
gyro_lulu_sample_count = 5 (First I had been using 3 but I heard some noise, so I decided to increase )
dterm_lpf_hz = 80, 100 (I didn't notice any difference, maybe I can go up to 100+)
dterm_lpf_type = PT1
Also, I've tried dterm lulu filter, which gives oscillation, so I changed back to PT1.
I noticed some pitch bounceback when I did high throttle up -> free fall -> up again. But it feels different, so I may have to play with my PIDs a bit.

blackbox_log_2024-12-06_171025.TXT

@pjpei
Copy link
Contributor Author

pjpei commented Dec 7, 2024

Hey that's great news! Thanks for testing!

Yeah dterm lulu is not gonna be that good unfortunately. However, with the lulu sample count on gyro = 5 and dterm_lpf_type on pt1, do re-tune the PIDs. That hopefully will fix the bounceback, I managed to tune it out on a few of my craft. The d-term specifically needs adjusting with this filter but as they all interact, the whole craft needs slight re-tuning after switching.

Kind regards,

@pjpei
Copy link
Contributor Author

pjpei commented Dec 7, 2024

Looking at the graph, might want to try sample_count at 6 perhaps. Might help? The guideline is the lulu_sample_count should be one to two samples greater than half the main resonant frequency.

Looking at the graph below, 5 seems to work most of the time, but at low throttle it seems that 6 would be better in this instance.

Let me know if that helps? Also please check the CPU usage before flight on higher settings like 6!

image
image

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

Successfully merging this pull request may close these issues.

3 participants