-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Control Allocation Sequential Desaturation unit tests #22612
Control Allocation Sequential Desaturation unit tests #22612
Conversation
hmm, looks like the tailsitter SITL test is failing? curious as this only adds a unit test. |
merged; now all SITL tests are passing. |
Thanks for your contribution, I'm going through it later.
It's now passing. These SITL tests are a bit flaky. Can you rebase your branch on latest main? Something seems to have been messed up with your history, and this PR shows up many commits that don't come from you. |
@sfuhrer I can try, but I am not sure why those other commits are showing up. Although, the changes are accurately captured, as can be seen in the |
c4c1d88
to
3c5d8ae
Compare
@sfuhrer the commit history has been cleaned up. |
670e226
to
025881f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for kicking this off, that's very valuable.
I only have some minor things. I leave it up to you to also add some test cases for the "normalized" allocation - could though also be a follow up PR.
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
|
||
const auto &actuator_sp = allocator.getActuatorSetpoint(); | ||
// In the case of yaw saturation, thrust per motor will be reduced by the hard-coded | ||
// magic-number yaw margin of 0.15f. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaEtUgR maybe it's a good time to document this magic number in the algorithm as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can only imagine why this is useful. I think @bresch had the full context here.
5f997b4
to
060d4c2
Compare
060d4c2
to
4bce6d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some mini comments, otherwise good to go.
PS: please do not force push a branch that you opened already a pull request for, as otherwise it's not possible for the reviewer to see what has changed since the last review. Just add the review comments as new commits on top, and push the branch like that. Once the PR is approved you can clean up the commits or we just squash-merge to merge it all into one commit.
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
…ionSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
…ionSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
…ionSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot a couple of MOTOR_COUNTS. Lets do them all in ints and then we can get this in!
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp
Outdated
Show resolved
Hide resolved
…for logical float zeros, and make YAW_MOTORS an int
@sfuhrer thanks, I fixed those and also added the float specifier suffix to all float zeros, replaced magic numbers with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the last clean up, let's get it in!
* [control_allocation] add unit tests for ControlAllocationSequentialDesaturation * complete first 2 unit tests * add yaw test * add more unit tests * improve comments * format * address review comments * submodule update * Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * remove float suffix for logical integers, add missing float suffixes for logical float zeros, and make YAW_MOTORS an int --------- Co-authored-by: Master Chief <master-chief@the-void.com> Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
* [control_allocation] add unit tests for ControlAllocationSequentialDesaturation * complete first 2 unit tests * add yaw test * add more unit tests * improve comments * format * address review comments * submodule update * Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * remove float suffix for logical integers, add missing float suffixes for logical float zeros, and make YAW_MOTORS an int --------- Co-authored-by: Master Chief <master-chief@the-void.com> Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
* [control_allocation] add unit tests for ControlAllocationSequentialDesaturation * complete first 2 unit tests * add yaw test * add more unit tests * improve comments * format * address review comments * submodule update * Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp Co-authored-by: Silvan Fuhrer <silvan@auterion.com> * remove float suffix for logical integers, add missing float suffixes for logical float zeros, and make YAW_MOTORS an int --------- Co-authored-by: Master Chief <master-chief@the-void.com> Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
Solved Problem
Unit tests for ControlAllocationSequentialDesaturation. No code changes are made to any existing library, this only adds unit tests. The unit tests serve 2 purposes: 1) help ensure that expected functionality remains the same and 2) documents and demonstrates (through examples) the desaturation algorithm.