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

Make magneto take a constant amount of memory, regardless of the number of samples. #200

Merged
merged 4 commits into from
Jan 18, 2023

Conversation

kitlith
Copy link
Member

@kitlith kitlith commented Oct 6, 2022

Closes #197

Third commit is the real meat of this change, it is probably easier to review commit by commit due to the movement of the math functions of another file in the first commit.

I have tested this idea and observed negligible or no change in the calibration matrix given the same input.

I haven't changed anything about how the sensors use magneto, other than causing a net reduction in memory usage. I leave it up to other people to experiment with increasing the number of samples now that we're no longer memory constrained.

@kitlith
Copy link
Member Author

kitlith commented Oct 6, 2022

Once #201 is merged, the pull_request check should succeed.

@TheDevMinerTV
Copy link
Member

@kitlith you still have to rebase onto main to get the fix.

It's MIT licensed, I'm not concerned.
No matter how many samples you feed to magneto, it now only needs a
10x10 state matrix. The difference in output given identical inputs
should be (and has been tested to be) negligible.
Copy link
Member

@TheDevMinerTV TheDevMinerTV left a comment

Choose a reason for hiding this comment

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

There's code for the ICM20498 missing

src/sensors/bmi160sensor.cpp Show resolved Hide resolved
src/sensors/mpu9250sensor.cpp Show resolved Hide resolved
@kitlith
Copy link
Member Author

kitlith commented Oct 6, 2022

There's code for the ICM20498 missing

The ICM20498 does not have any mode that currently uses magneto, and therefore is out of scope for this PR.

If someone writes something for the ICM20498 that doesn't use the built-in DMP, that would be the time to introduce the use of magneto.

@TheDevMinerTV
Copy link
Member

Ah okay, makes sense ^^

@TheDevMinerTV
Copy link
Member

Needs testing.

@TheDevMinerTV TheDevMinerTV added the Status: Help Wanted Needs some help to make progress label Oct 6, 2022
@0forks
Copy link
Contributor

0forks commented Jan 18, 2023

This optimization has been in use in my BMI branch for almost 2 months without any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Help Wanted Needs some help to make progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Magneto] Handle infinite samples with constant memory usage
4 participants