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

MultirotorMixer: hotfix [-1,1] scaling #15626

Merged
merged 1 commit into from
Aug 27, 2020
Merged

MultirotorMixer: hotfix [-1,1] scaling #15626

merged 1 commit into from
Aug 27, 2020

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Aug 26, 2020

Describe problem solved by this pull request
Taking off with a powerful enough multirotor which has hover thrust < 50% leads to a vertical flyaway. E.g. SITL jmavsim
By bisecting I found that #15563 introduced that and after inspection I found that only the idle thrust part has enough influence to make that happen. Apparently the output was scaled with [0,1] instead of [-1,1].

Describe your solution
The variable _idle_speed which was removed in #15563 was always -1.f so I just followed where it was used before and replaced the previous use with the number.

Describe possible alternatives
We should probably reconsider suddenly changing the output scaling in the middle of the mixer. This is just a hotfix to restore previous functionality without _idle_speed.

Test data / coverage
SITL flying works again 🎉

Additional context
Bug is not on v1.11

dagar
dagar previously approved these changes Aug 26, 2020
@MaEtUgR
Copy link
Member Author

MaEtUgR commented Aug 26, 2020

Something seems still not good. The mixer test fails. Let me check.

@dagar
Copy link
Member

dagar commented Aug 26, 2020

I suppose it's a little late now, but can we also add something simple to the mixer unit tests that would have caught this in the first place?

@dagar
Copy link
Member

dagar commented Aug 26, 2020

Depending on the constructor (geometry or actual scaling) you get a different idle speed.

https://github.com/PX4/Firmware/blob/0ff4fad95cfb8bc4a2fa62088363e57b7c037b23/src/lib/mixer/MultirotorMixer/MultirotorMixer.cpp#L82-L103

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Aug 26, 2020

Depending on the constructor (geometry or actual scaling) you get a different idle speed.

That's also what I had found out. Default value for _idle_speed was 0.f but the output_limit_calc function for all mixer output wants [-1,1]. So without changing all the output modules and mixers to a different scaling it was easier to have a rescale adaption in the mixer test. We can reconsider how scaling should be but as a hotfix I consider this the nicest solution.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Aug 26, 2020

For CI: #12148 (comment)

After it was mistakenly rescaled in
26bac78#diff-899d35a48340c6065702d4fa77b70f0d
#15563
@dagar
Copy link
Member

dagar commented Aug 27, 2020

Thanks for the quick fix @MaEtUgR, apparently this wasn't such a quick and easy flash savings after all...

@dagar dagar merged commit 16776ff into master Aug 27, 2020
@dagar dagar deleted the mixer-hotfix branch August 27, 2020 00:52
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.

2 participants