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

Added IMUTemperature read function for ICM42605 #10423

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

ultrazar
Copy link
Contributor

@ultrazar ultrazar commented Oct 23, 2024

I saw that it might be useful to have the ability to read the temperature data from the ICM42688P sensor. #10382 (comment)
So I've previously implemented that function back when I was doing the accelerometer temperature compensation. It differs by 3-4ºC from the baro but seems to work well.
The implementation is based on the offcial datasheet and following the same code structure used for similar drivers such as the mpu6000 in inav

@ultrazar
Copy link
Contributor Author

And regarding my problems with the accelerometer Z drift, I stopped using corrections based on the temperature because it is imprecise and the temp sensors are slow detecting rapidly changing temperatures. Therefore, the method that I use now is basically to smooth navAcc[2] measurements (it should always end up being 0 for most flight manuevers, as the acceleration always tends to go to zero instead of the velocity) and subtract that in final navAcc[2] variable. In this way, there will never be any drift in Z acceleration estimation that can affect other estimations.

I firslty performed tests of this method in Python using real Blackbox data to see how it could manage real flight data:
Captura de pantalla 2024-08-20 182948
The red line represents normal navAcc[2], with high level of drift due to temperature changes
The blue line is the estimated drift from navAcc[2], basically applying a simple real-time smoothing algorithm.
The black line would be the final estimated Z acceleration by subtracting the estimated drift from navAcc[2]

I've already implemented this in my INAV fork some months ago and It has been working pretty well actually, I think it even gently improves overall Z position/velocity estimations in fully-functional and calibrated FCs.

I might do a PR on that if there's anyone interested.

@mmosca
Copy link
Collaborator

mmosca commented Oct 24, 2024

Code looks ok and seems to match datasheet, just need to flash it to a fc to confirm.

@mmosca mmosca merged commit df9b18f into iNavFlight:master Nov 4, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants