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

PositionControl: deconflict velocity control gains from thrust #14749

Merged
merged 1 commit into from
May 4, 2020

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Apr 24, 2020

Describe problem solved by this pull request
Before #14212 the velocity control gains used in the multicopter position controller were defined as a scale between velocity error in one axis (or it's integral and derivative respectively) and the unit thrust vector. The problem with this is that the normalization of the unit thrust vector changes per vehicle or even vehicle configuration as 0 and 100% thrust get a different physical response. That's why the gains are now defined as scale between velocity error (integral/derivative) and the output acceleration in m/s². E.g. with the default P horizontal velocity gain of 4 m/s² per m/s you would counteract a velocity error of 1m/s with 4m/s² actuation in order to accelerate to the desired velocity. This leads to less dependence of the velocity control tuning to the vehicles maximum thrust, output configuration and hover thrust.

In #14212 a backward compatibility factor was introduced to make the existing parameters backward compatible. This pull request aims at:

  1. fixes Multicopter velocity control gains backwards compatibility depends on hover thrust #14720
  2. Make the parameters reflect that reproducible gain scale while still staying backwards compatible.

Describe your solution

  • Avoid constantly adjusting the velocity gains with the HTE
  • Make sure the hover thrust integral update doesn't break
    even though its unit is acceleration and not unit thrust anymore
  • Replace the existing parameters with new ones that directly reflect the correctly scaled values

In horizontal direction it doesn't make sense to scale them with the hover thrust and in vertical direction the adjustments are already done in the acceleration to collective thrust conversion.

Test data / coverage
SITL tested and real world tested, see #14749 (comment)

@MaEtUgR MaEtUgR self-assigned this Apr 24, 2020
@MaEtUgR MaEtUgR changed the title PositionControl: deconflict hover thrust estimator, acceleration control PositionControl: deconflict velocity control gains from thrust Apr 24, 2020
@MaEtUgR MaEtUgR force-pushed the velocity-gains-fix branch 2 times, most recently from 8bea229 to b6c9bba Compare April 27, 2020 13:50
@MaEtUgR MaEtUgR requested a review from bresch April 27, 2020 13:51
@MaEtUgR MaEtUgR marked this pull request as ready for review April 27, 2020 13:51
@dagar dagar added this to the Release v1.11.0 milestone Apr 27, 2020
@MaEtUgR
Copy link
Member Author

MaEtUgR commented May 4, 2020

I went out real-world testing this pr and found the problem #14821 which was already present before and is not caused by this pr. The problem shows in the takeoff of the last three logs.

Here are the test logs for this pr:
stabilized, altitude: https://logs.px4.io/plot_app?log=153e83cb-60e4-408b-96cd-2336cc2b4432
stabilized, altitude, position: https://logs.px4.io/plot_app?log=b0fc3935-98fe-418e-bdae-8855066d569d
position: https://logs.px4.io/plot_app?log=219ac076-694d-4e85-8618-7665d62b349b
position 2: https://logs.px4.io/plot_app?log=b21d1d59-04c7-4d96-aaad-87a8401e69e2
position 3: https://logs.px4.io/plot_app?log=13f14b3b-d919-432c-9e89-f0610ec7285c

The pr works like expected. Please review the _ACC parameter name changes and transitioning code in the second commit. I noticed when switching to a new PX4 branch after this commit and to an older one again you lose the custom velocity control tuning e.g. SITL defaults. I'm also happy if we just merge the first commit if discussion about the parameters continues.

- Avoid constantly adjusting the velocity gains with the HTE
- Make sure the hover thrust integral update doesn't break
  even though its unit is acceleration and not unit thrust anymore

We need to convert the velocity gains to not contain/depend on the
hover thrust. In horizontal direction it doesn't make sense to scale
them with the hover thrust and in vertical direction the adjustments are
already done in the acceleration to collective thrust conversion.
@MaEtUgR
Copy link
Member Author

MaEtUgR commented May 4, 2020

As proposed in the last comment I separated out the really important gain fix in this pr from the parameter rescaling #14823. That should make it far easier to review.

@MaEtUgR MaEtUgR merged commit cdf37ca into master May 4, 2020
@MaEtUgR MaEtUgR deleted the velocity-gains-fix branch July 8, 2020 16:55
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.

Multicopter velocity control gains backwards compatibility depends on hover thrust
3 participants