-
Notifications
You must be signed in to change notification settings - Fork 1
Matrix math and 'stubbed' kalman filter implementation #370
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
Conversation
| modernize-*, | ||
| performance-*, | ||
| portability-*, | ||
| -portability-avoid-pragma-once, |
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.
pragma once is awesome and ill be really sad if The Powers That Be say we shouldnt use it
(all the compilers we have ever used for our hardware and native sim support it wholly and completely [sdcc doesnt so no stm8s but also none of our code would work on an stm8 lol])
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.
We can do pragma once tbh. I do it in our other codebases lol. I just stuck with the standard for Zephyr when we started out
| }; | ||
|
|
||
| namespace ManualMatrixTests { | ||
| constexpr ManualMatrix<2, 2> testMult2x2x2() { |
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.
can verify that the type checking for matrix dimensions is all good at compile time. hurray for modern c++ versions
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.
could also static_assert their results but that was extra work
AarC10
left a comment
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.
Looks pretty good. Just drop the sample for benchmarking for repro and also I'm curious about your error handling. I'm looking at the return status and maybe we should alert the user that their inputs are bad?
https://arm-software.github.io/CMSIS_5/DSP/html/arm__math__types_8h.html#a5e459c6409dfcd2927bb8a57491d7cf6
For the functions implemented here (add, subtract, multiply) the template static_asserts prevent the conditions that would bring about the error codes. Even multiplication and addition by NaN is defined. For things like decompositions and inverses, there has to be some sort of error handling since they can fail and if/when implemented they will include return codes std::options or something. |
|
Benchmark included in the math directory not as a sample bc of reasons stated in PR description about current narrow-applicability. But it is there for testing as work is done for airbrakes and should lend itself pretty easily to turning into a 'real' sample later (also im on campus with no hardware so theres a chance that doesn't work in which case don't approve and ill fix it tn but it does compile) |
Description
Add simple matrix and cmsis-dsp matrix to airbrakes project. Also stub out implementation of 'simple' kalman filter. Subject to change as the model changes but im working to avoid 10000000 line PRs because i love my reviewers
The matrix files could be added as 'library' level files but given the rate of change for airbrakes and the fact that we have no use for the matrices elsewhere, I believe the should live in the app/ for airbrakes. There is also a chance that once the filter design has solidified, it makes sense to implement the entire control system as one function with direct calls to the cmsis matrix library. However, bc readability is important i have the matrix types. If the time comes, the 'optimized' version with direct calls can be implemented with the 'readable' version acting as a reference to verify functionality.
Based on the super cool specs we have been given / drawn up

Type of change
Please delete options that are not relevant.
How Has This Been Tested?
sw_board tests for determining matrix correctness and speeds on arm w/ cmsis
native_sim tests for ability to test independently of hardware
control_freak hardware in case all the other hardware explodes
sw_board
these dang arm engineers seem to know a thing or two.
Checklist: