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

mc_pos_control: pass on parameter metadata #21729

Merged
merged 5 commits into from
Jun 26, 2023
Merged

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Jun 16, 2023

Solved Problem

When checking changes in multicopter position control parameters I realized there are too many of them and they also affect many parts of the system that are not directly related to position control itself.

Solution

In an effort to change this but not have too much back and forth in the naming I too kan initial pass and

  • separated in multiple files based on the rough topic since original file was almost 1k lines
  • Adapted descriptions to be more clear
  • Adjusted some limits and decimals

Changelog Entry

For release notes:

Improved multicopter position control parameter descriptions

Alternatives

Based on this we can remove unnecessary parameters, rename them, further separate them into their corresponding groups and make sure the same parameter is not mistaken for too many things.

Test coverage

No specific testing. I adjusted based on my past experience.

@MaEtUgR MaEtUgR added Documentation 📑 Anything improving the documentation of the code / ecosystem Admin: Cleanup (housekeeping) 🧹 labels Jun 16, 2023
@MaEtUgR MaEtUgR requested a review from sfuhrer June 16, 2023 15:58
@MaEtUgR MaEtUgR self-assigned this Jun 16, 2023
@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jun 19, 2023

Upon request, I separated the two steps of file splitting and metadata revision into two commits. Now it should be easier to review.

@dagar
Copy link
Member

dagar commented Jun 19, 2023

Do we want to consider exposing any of this in separate parameter groups so that anyone without the source code open can possibly benefit?

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jun 20, 2023

Do we want to consider exposing any of this in separate parameter groups

Yes and rename some parameters and remove some and make the effect they have more clear e.g. not use the same acceleration for independent things. I planned to do this in further steps covering individual parts. To me there are too many parameters to clean them up all at once that's why I started with these updated descriptions and the code only separation is to help with the next steps.

Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

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

Very nice push! Just a couple of nitpicks:

  • I wouldn't constrain the decimals too much, eg often I would put 1 instead of 0
  • a couple of times you remove the .0 from the @min / @max, but you missed a couple as well

*
* MPC_POS_MODE
* 1 just deceleration
* 3 acceleration and deceleration
* 4 just acceleration
* 4 use MPC_ACC_HOR instead
Copy link
Contributor

Choose a reason for hiding this comment

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

so it's not used with 4? Then maybe "not used, use MPC_ACC_HOR instead"

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, I changed the working 👍

That's a parameter to untangle. It should just be autonomous acceleration and manual acceleration period. I reused that parameter at the time because during the transition it made sense in terms of what values were required compared to the FlightTaskManualPositionSmoothVel (pos mode 3) and even much before that this parameter was the slew rate of the velocity controller so it was already reused and not renamed for a smooth transition before.

I'd separate those to the configuration options that have a clear name and only change one thing that the user actually cares about.


/**
* Minimum manual thrust
* Minimum collective thrust in Stabilized mode
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we actually combine this param with the one that limits the min throttle in Auto modes? Or just keep it to max range in Stabilized mode?

Copy link
Member Author

Choose a reason for hiding this comment

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

My plan for these minimum throttle ones is to have a limited airmode up to this amount of throttle independent of the mode. We can theoretically merge them together before. I'm assuming they are different because 12% throttle is pretty high for minimum stick and 8% throttle is rather low for the position controller to go for if there's no airmode. It's all the same issue in my eyes. Minimum should be 0% should be spinning props at idle and they only spin up if torque is needed -> airmode but can't make the drone go nuts -> limited airmode.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jun 22, 2023

Thanks @sfuhrer for the review. You exactly hit the important points that need to be improved. I rebased on the main branch and added commits to address the feedback, see comments. I plan to follow up with any user-facing restructuring like renaming, regrouping, using different parameters.

a couple of times you remove the .0 from the @min / @max, but you missed a couple as well

Solved in d25938a

@sfuhrer
Copy link
Contributor

sfuhrer commented Jun 22, 2023

@MaEtUgR I think it is nice to also remove the trailing zeros in the param meta data, though how they are currently displayed in the param reference is then a bit ugly (as the "f" is missing there).

image

I guess it would be best if either the trailing "." in the meta data wouldn't be displayed on the website, or is changed to a ".0". Would you have an idea where to propose that?

Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

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

My review points have all been addressed, looks clean!

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jun 26, 2023

@sfuhrer Thanks for checking again.

is then a bit ugly

I don't find it too ugly but we can look into how to remove the trailing point. 👀

@MaEtUgR MaEtUgR merged commit 7e79d65 into main Jun 26, 2023
77 of 84 checks passed
@MaEtUgR MaEtUgR deleted the maetugr/mpc-parameters branch June 26, 2023 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin: Cleanup (housekeeping) 🧹 Documentation 📑 Anything improving the documentation of the code / ecosystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants