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

Fixed PID tuning sliders disabling on certain values. #2053

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

mikeller
Copy link
Member

@mikeller mikeller commented Jun 8, 2020

Fixes #2049. There is bugs, damn bugs, and rounding errors.

@mikeller mikeller added this to the 10.7.0 milestone Jun 8, 2020
@sonarcloud
Copy link

sonarcloud bot commented Jun 8, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
1.0% 1.0% Duplication

Copy link
Member

@McGiverGim McGiverGim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work @mikeller !!

@asizon
Copy link
Member

asizon commented Jun 8, 2020

Yes good work! Maybe the last 10.7.0 bugfix??

@asizon
Copy link
Member

asizon commented Jun 9, 2020

i have tested it,the behiavour with PD Balance slider seems that is solved, but trying to find behiavours in other slider i can see some break points with PD Gain slider.
To reproduce:
1-disable dmin
2-put Master slider on 0.5
3-put PD Balance slider at 0.5
4-put PD Gain slider on 1.3 or 1.6
5.save

@McGiverGim
Copy link
Member

I think we have some rounding error with this... 1 / D_MIN_RATIO = 1.176470588235294 that produces all this problems.

@asizon
Copy link
Member

asizon commented Jun 9, 2020

Yes, maybe we need to aply * 0.85 to this.PID_DEFAULT[2], now is aplying to P, it doesnt makes much sense

@@ -49,7 +51,7 @@ TuningSliders.setDMinFeatureEnabled = function(dMinFeatureEnabled) {
if (this.dMinFeatureEnabled) {
this.defaultPDRatio = this.PID_DEFAULT[2] / this.PID_DEFAULT[0];
} else {
this.defaultPDRatio = this.PID_DEFAULT[2] / (this.PID_DEFAULT[0] * 1.18);
this.defaultPDRatio = this.PID_DEFAULT[2] / (this.PID_DEFAULT[0] * (1 / D_MIN_RATIO));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I think that we are wrong aplying D_MIN_RATIO to P and not D

@mikeller
Copy link
Member Author

mikeller commented Jun 9, 2020

@asizon:

i have tested it,the behiavour with PD Balance slider seems that is solved, but trying to find behiavours in other slider i can see some break points with PD Gain slider.
To reproduce:
1-disable dmin
2-put Master slider on 0.5
3-put PD Balance slider at 0.5
4-put PD Gain slider on 1.3 or 1.6
5.save

This happens in master as well, so this is a different bug.

@mikeller
Copy link
Member Author

mikeller commented Jun 9, 2020

I've had another look at this, and for what I can tell what we are seeing here is inherent to how this is implemented: It tries to determine if individual PID values have been adjusted by comparing the PID values to the calculated PID values based on the sliders. But because the two calculations are slightly different, with rounding in different places, the rounding will cause the results of these two calculations to be different in some cases.
If we want to fix this we will have to rewrite the logic to determine if the sliders should be on or off to actually keep track of the PID values, and 'remember' if the user has ever manually changed one - this will obviously also have to be persisted in the firmware.

@McGiverGim
Copy link
Member

Yes, I remember the discussion before 10.6. I always prefered that this was implemented in firmware first, to reduce the complexity and maintainability of the Configurator, but a lot of users wanted this so we released it.

Is clear that it has been a success, a lot of users like it, but the way it is implemented is a headache for us.

Now I don't know what to do with this. Try to fix it? Release it as is? I'm ok with what you decide @mikeller .

@mikeller
Copy link
Member Author

mikeller commented Jun 9, 2020

@McGiverGim: I think accepting that we have now is not perfect, and trying to get the firmware based implementation done is the best approach - we could probably play whack-a-mole with these irregularities until the cows come home.

@mikeller mikeller merged commit b8d0481 into betaflight:master Jun 9, 2020
@mikeller mikeller deleted the fix_sliders_resetting branch June 9, 2020 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PID sliders disabling
3 participants