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

add feedforward max_rate_limit and jitter_factor to msp for 4.3 #11017

Conversation

ctzsnooze
Copy link
Member

Although feedforward_max_rate_limit and feedforward_ jitter_factor are new variables for 4.3, it would be great if they could be included in the MSP so we can set and review them in Configurator 1.44.

In particular, the feedforward_ jitter_factor parameter can, and should, be user editable without need to go to the CLI. Higher values give a strong 'transition-like' effect for freestyle at lower or Rx link rates, and with fast links, a value around 5 works better than defaults.

feedforward_max_rate_limit affects the onset time of the pull-back in feedforward when the sticks are rapidly heading towards max, eg at the start of a flip or roll. A value of 90 is default. On heavier setups with a stronger tendency to overshoot, a lower value, eg 85, may work better, and on a highly tuned racer, 95 may be better.

@@ -2836,6 +2843,14 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
#else
sbufReadU8(src);
#endif
#if defined(USE_FEEDFORWARD)
Copy link
Member

Choose a reason for hiding this comment

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

Please move and add this logic to line 2819 (2826)

Copy link
Member

Choose a reason for hiding this comment

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

Then the configurator and lua scripts and every other client have to be updated.

Copy link
Member

@haslinghuis haslinghuis Oct 13, 2021

Choose a reason for hiding this comment

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

But's it's within the same #if defined(USE_FEEDFORWARD) statement, but maybe I'm missing order of other settings. New statements should be added at the end of existing ones,

Copy link
Member

Choose a reason for hiding this comment

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

The new parameters have to be added to the end of the MSP message. If they were added before thrust linear and vbat sag compensation, any client not aware of this change would end up changing max rate limit and jitter factor instead.

Copy link
Member

Choose a reason for hiding this comment

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

I kind of agree with @haslinghuis here - the way MSP works is that it does so by only allowing incremental changes between versions - the above conditional for USE_FEEDFORWARD is targeting the same version as this, so I think we may as well keep it as clean as possible within the convention.
It is true that this will require some additional changes in clients, but in the end changes will be needed anyway for these clients to support 4.3, as clients implementing the intermediate state are not sending enough bytes to get the firmware to process this block.

haslinghuis
haslinghuis previously approved these changes Oct 13, 2021
@klutvott123
Copy link
Member

The addition of feedforward_max_rate_limit is fine, but feedforward_jitter_factor was added for BF 4.3 and shouldn't be added to MSP until 4.4. I can see why @ctzsnooze wants to add this parameter early as it's a possibly better alternative to feedforward_transition.
This breaks the rules, but I'm willing to accept it if the other reviewers agree.

klutvott123
klutvott123 previously approved these changes Oct 13, 2021
Copy link
Member

@mikeller mikeller left a comment

Choose a reason for hiding this comment

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

This is really just a change for existing functionality which has been around for a while, and has been reworked, so I think the risk of this needing another rework with parameter type changes is relatively low.

@@ -2836,6 +2843,14 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
#else
sbufReadU8(src);
#endif
#if defined(USE_FEEDFORWARD)
Copy link
Member

Choose a reason for hiding this comment

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

I kind of agree with @haslinghuis here - the way MSP works is that it does so by only allowing incremental changes between versions - the above conditional for USE_FEEDFORWARD is targeting the same version as this, so I think we may as well keep it as clean as possible within the convention.
It is true that this will require some additional changes in clients, but in the end changes will be needed anyway for these clients to support 4.3, as clients implementing the intermediate state are not sending enough bytes to get the firmware to process this block.

@ctzsnooze
Copy link
Member Author

ctzsnooze commented Oct 25, 2021

I'm happy to put these new Feedforward parameters up into the one #if defined(USE_FEEDFORWARD) block, or leave them, as is, in two separate blocks.

Both are easy enough to read, and there is less work for others if we leave it as is.

@mikeller your call, I don't mind either way.

@klutvott123
Copy link
Member

@ctzsnooze Just put them in the same block. I'll get the lua scripts in sync again and you or @haslinghuis can do the configurator. 👍

@ctzsnooze ctzsnooze dismissed stale reviews from klutvott123 and haslinghuis via d45653c November 14, 2021 22:54
@ctzsnooze
Copy link
Member Author

ctzsnooze commented Nov 14, 2021

I've rebased to master, and put the changes into the one #ifdef feedforward block in d45653c

Please confirm it is done correctly, if so I'll squash to a single commit.

move params to one block, remove whitespace
@ctzsnooze ctzsnooze force-pushed the include-feedforward-max_rate_limit-and-jitter_factor-in-MSP branch from 4e138a9 to 4a485b4 Compare November 14, 2021 23:18
Copy link
Member

@klutvott123 klutvott123 left a comment

Choose a reason for hiding this comment

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

👍

@ctzsnooze
Copy link
Member Author

Checked and tested.
Works perfectly with betaflight/betaflight-configurator#2656
Thanks @haslinghuis for making the Configurator changes.

@blckmn blckmn merged commit 60776fc into betaflight:master Nov 25, 2021
@ctzsnooze ctzsnooze deleted the include-feedforward-max_rate_limit-and-jitter_factor-in-MSP branch December 29, 2021 11:32
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.

5 participants