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

FW Auto level trim bug fix #9393

Merged
merged 3 commits into from
Oct 26, 2023
Merged

Conversation

breadoven
Copy link
Collaborator

@breadoven breadoven commented Oct 23, 2023

Fixes a bug in FW Auto level trim mode where PID controller dT value wasn't calculated correctly because the previous time value used to calculate dT was never saved so dT was always equal to the current time.

PID gain constants have been corrected to give a reasonable response based on HITL but might need further tuning. The old constants were probably very large to compensate for the dT time error ?

@breadoven breadoven added this to the 7.0 milestone Oct 23, 2023
@breadoven
Copy link
Collaborator Author

Saving the adjusted level trim currently doesn't work due to Auto saving on disarm overwriting the adjusted value with the original value before it gets updated by the auto level trim function. Fix needed.

@DzikuVx
Copy link
Member

DzikuVx commented Oct 24, 2023

@b14ckyy sanity check? After all, it was your idea in the first place

@b14ckyy
Copy link
Collaborator

b14ckyy commented Oct 25, 2023

Any Idea when these issues appeared? Must say I never saw a problem. For Pre 6.0 builds it always worked and the 2 planes I built since 6.0 where on spot with level trim from the start so I never ran it.

But it explains why some people said the trim did not save for them. I just never heard back from them.

@breadoven
Copy link
Collaborator Author

breadoven commented Oct 25, 2023

Well the dT bug has been there from the start https://github.com/iNavFlight/inav/pull/6564/files#diff-afd1226d5a8ae512e5fc53a545d9b7259b4f001bc94eae9c38cacd8762fb7f54. The saving issue came in with auto saving on disarm ... easily missed.

Interesting that it seemed to work. I'm guessing it might have appeared to have worked, just very slowly immediately after arming ... becoming more sensitive as flight time increased ?

@b14ckyy
Copy link
Collaborator

b14ckyy commented Oct 25, 2023

Oh so after a while flying the behavior changes then? That might explain why some people reported it not working properly but I never saw issues as I basically did it only once on a maiden or test flight shortly after takeoff and turned it off again. will test that for sure

@breadoven
Copy link
Collaborator Author

This tested OK with HITL and also managed a flight test where it seemed to behave as expected. Seemed to because I think there was thermic lift around which will generally cause problems with this method of setting pitch trim based on vertical velocity but that just needs to be taken into account if you use it I guess.

Tweaked the PID gain because it looked a bit sensitive so should be good to merge now.

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

Successfully merging this pull request may close these issues.

4 participants