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

Refactor dMin to dMax #4173

Merged
merged 4 commits into from
Sep 24, 2024
Merged

Conversation

mituritsyn
Copy link
Contributor

Configurator part for betaflight/betaflight#13908

Copy link

netlify bot commented Sep 18, 2024

Deploy Preview for origin-betaflight-app ready!

Name Link
🔨 Latest commit bad319a
🔍 Latest deploy log https://app.netlify.com/sites/origin-betaflight-app/deploys/66f035896e87f20008121a6f
😎 Deploy Preview https://deploy-preview-4173.dev.app.betaflight.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nerdCopter
Copy link
Member

nerdCopter commented Sep 20, 2024

needs to be backward compatible (gated) labeling.
image

i'd suggest if/then to swap labels only irregardless of other logic.

@ctzsnooze
Copy link
Member

Maybe make the 'D' in 'Derivative' label bold, also?

@ctzsnooze
Copy link
Member

Also, in image above, D Max values are shown as being smaller than Derivative values, whereas they should always be greater. Perhaps update the image ?

@haslinghuis
Copy link
Member

Backwards compatibility

@mituritsyn
Copy link
Contributor Author

i'd suggest if/then to swap labels only irregardless of other logic.

I'm not sure I've made the best implementation.

2b30712

@haslinghuis
Copy link
Member

  • Normally only have to change english locale only - other locales get overwritten by crowdin but it does not hurt to have them updated.
  • Backwards compatibilty looks to be resolved except for the sliderWarning
  • In PR with 4.5.2:
    image
  • In master with 4.5.2:
    Screenshot from 2024-09-22 16-17-40

const WARNING_DMIN_GAIN = 42;
const enableWarning = FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_DMAX_GAIN || FC.ADVANCED_TUNING.dMinRoll > WARNING_DMIN_GAIN;
const WARNING_D_GAIN = 42;
const enableWarning = FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_D_GAIN || FC.ADVANCED_TUNING.dMaxRoll > WARNING_D_MAX_GAIN;
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps (need to import semver)

Suggested change
const enableWarning = FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_D_GAIN || FC.ADVANCED_TUNING.dMaxRoll > WARNING_D_MAX_GAIN;
const enableWarning = semver.lt(FC.CONFIG.apiVersion, '1.47.0')
? FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_D_MAX_GAIN || FC.ADVANCED_TUNING.dMaxRoll > WARNING_D_GAIN
: FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_D_GAIN || FC.ADVANCED_TUNING.dMaxRoll > WARNING_D_MAX_GAIN;

Copy link

@mituritsyn
Copy link
Contributor Author

  • Normally only have to change english locale only

nice to know)
there is duplicate pidTuningDerivativeHelp key, I'm sure there should be only one but they have similar text.

@haslinghuis
Copy link
Member

haslinghuis commented Sep 22, 2024

Last edition 2672:

Controls the strength of dampening to ANY motion on the craft. For stick moves, the D-term dampens the command. For an outside influence (prop wash OR wind gust) the D-term dampens the influence.<br><br>Higher gains provide more dampening and reduce overshoot by P-term and FF.<br>However, the D-term is VERY sensitive to gyro high frequency vibrations (noise | magnifies by 10x to 100x).<br><br>High frequency noise can cause motor heat and burn out motors if D-gains are too high or the gyro noise is not filtered well (see Filters tab).<br><br>Think of the D-term as the shock absorber on your car, but with the negative inherent property of magnifying high frequency gyro noise.

Previous edition 2572 line 1861 should probably be removed - BUT seems currently in use:

Baseline damping of ANY motion of the craft. <br /><br />Opposes movement whether caused by stick inputs or external influences (e.g. prop-wash or wind gusts)<br /><br />Higher D gains provide more stability and reduce overshoot.<br /><br />D amplifies noise (magnifies by 10x to 100x). This can burn out motors if gains are too high or D isn't filtered well.<br /><br />D-term is a bit like the shock absorber on your car.

@haslinghuis
Copy link
Member

haslinghuis commented Sep 22, 2024

@mituritsyn

  • noticed D_MAX calculation has changed (an improvement as D_MAX is allowed below D while D_MIN could not be lower than D) as we no longer use dminRatio in firmware calc.
  • this better represents gain factor for amount of gyro / setpoint activity required to boost D ?

PR with 13908:

image

Master:

image

EDIT: resolved in betaflight/betaflight@2bb6cef

@mituritsyn
Copy link
Contributor Author

@mituritsyn

  • noticed D_MAX calculation has changed (an improvement as D_MAX is allowed below D while D_MIN could not be lower than D) as we no longer use dminRatio in firmware calc.

No, I'm trying to keep the old behaviour. I've updated the calculation formula in the firmware.

@haslinghuis haslinghuis merged commit 2631c90 into betaflight:master Sep 24, 2024
8 checks passed
@mituritsyn mituritsyn deleted the replace-dmin-with-dmax branch September 24, 2024 09:58
demvlad pushed a commit to demvlad/betaflight-configurator that referenced this pull request Nov 14, 2024
* rename vars

* swap labels for older versions

* change locales

* fix slider warnings for older versions
OGCJM11 pushed a commit to OGCJM11/betaflight-configurator that referenced this pull request Dec 28, 2024
* rename vars

* swap labels for older versions

* change locales

* fix slider warnings for older versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

5 participants