Skip to content

Imu traits take 2#167

Merged
TheButlah merged 2 commits intomainfrom
imu_traits
Jan 31, 2023
Merged

Imu traits take 2#167
TheButlah merged 2 commits intomainfrom
imu_traits

Conversation

@TheButlah
Copy link
Collaborator

@TheButlah TheButlah commented Jan 29, 2023

I added an imu trait. Originally I was thinking there would be a fused and unfused imu, but it makes far more sense for there to just be one imu trait generic on its associated type, and that type can be fused or unfused. Also there was disagreement before on how to name stuff, like whether its RawImu or Imu or FusedImu. This makes that no longer necessary because all imus are the Imu trait.

I also added a FusedImu struct that we can use to combine an unfused imu with a Fuser. The idea is that the Fuser is purely a math thing. It could be any fusion algorithm.

One thing that remains to be solved is where filtering comes into the picture. If possible I think we should punt that to a later design iteration, when we have a need for it. Its possible that FusedImu is the one without filtering, and FilteredFusedImu has filtering also, which also implements Imu<Data=FusedData>. I'm not really sure which is why I think we should deal with it later in favor of unblocking present work.

I did not touch any of the business logic of the current imu implementations (such as the bmi160) as I felt that was out of scope.
The bmi160 should become an unfused type in a followup pr, and we should also refactor the nonblocking imu functions into async blocking ones, if we can figure out how to do that using proper async (might be hard, because most drivers use a non-async blocking api).

@TheButlah TheButlah requested a review from ImUrX January 29, 2023 02:47
// We want to do some floating point math at compile time
#![feature(const_fn_floating_point_arithmetic)]
// We need async traits for efficient yet generic IMUs
#![feature(async_fn_in_trait)]

Check warning

Code scanning / clippy

the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes

the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
@TheButlah TheButlah requested a review from Noxime January 29, 2023 02:48
@TheButlah TheButlah changed the title Imu traits Imu traits take 2 Jan 29, 2023
@TheButlah
Copy link
Collaborator Author

TheButlah commented Jan 30, 2023

will merge by end of day today (GMT-5) if there is no further feedback

@TheButlah TheButlah merged commit b13ede4 into main Jan 31, 2023
@TheButlah TheButlah deleted the imu_traits branch January 31, 2023 02:29
@TheButlah TheButlah mentioned this pull request Jan 31, 2023
@TheButlah TheButlah added Area: Firmware Relating to the firmware subprojct Type: Enhancement A new feature or improvement Type: Refactor Refactor or architectural changes labels Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Firmware Relating to the firmware subprojct Type: Enhancement A new feature or improvement Type: Refactor Refactor or architectural changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants