Skip to content

Problem reading accurate motorbike tilt angle #77

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

Closed
fralbo opened this issue Jul 13, 2021 · 8 comments
Closed

Problem reading accurate motorbike tilt angle #77

fralbo opened this issue Jul 13, 2021 · 8 comments

Comments

@fralbo
Copy link

fralbo commented Jul 13, 2021

Hello,

I try to reading motorbike tilt angle and I experiment a problem I also have with MPU-6050 in fact.
These chip seem to work well on desktop but using it on vehicle seem to be a challenge.
As ICM-20948 seems to be usable on drone, I though it was dedicated to give accurate tilt angle but it seems to be more complicated than it appears.

First, I tested it on my desktop, applying the same movements to my Samsung S10+ (embedding a LSM6DSO) and the ICM-20948 breakout.
The result is this one image
as you can see, the waveforms perfectly match.

Here, I did the same mounting both devices on my motorbike. image
Between 547 and 807, I really was in stable turn, with the same tilt angle as given by my S10+. But the ICM-20948 was seriously drifting to 0 and the offset accumulated at 807 seems to appear at 911.
Between 1639 and 1925, I was accelerating as the turn decreases. S10+ gives an understandable value from my S10, but the ICM-20948 dramatically drift to 0, probably while the z accel increases.

I guess the problem could come from the pitch drift correction made with the g acceleration. And as on motorbike, as well as on drone, a turn cause the g acceleration to increase, maybe this algorithm causes the pitch reading to be false.

I hope I was clear enough, do you have an idea about the problem and how to solve it?


Using Sparkfun ICM 20948 v 1.2.7 library and Example7_DMP_Quat6_EulerAngles.ino sketch running on ESP32 FireBeetle, no filter enable.

@PaulZC
Copy link
Contributor

PaulZC commented Jul 15, 2021

Hi @fralbo ,

By default, the DMP code in the ICM-20948 library puts the accelerometers into 4g mode (and the gyros into 2000dps mode):

// Set Gyro FSR (Full scale range) to 2000dps through GYRO_CONFIG_1
// Set Accel FSR (Full scale range) to 4g through ACCEL_CONFIG
ICM_20948_fss_t myFSS; // This uses a "Full Scale Settings" structure that can contain values for all configurable sensors
myFSS.a = gpm4; // (ICM_20948_ACCEL_CONFIG_FS_SEL_e)
// gpm2
// gpm4
// gpm8
// gpm16
myFSS.g = dps2000; // (ICM_20948_GYRO_CONFIG_1_FS_SEL_e)
// dps250
// dps500
// dps1000
// dps2000
result = setFullScale((ICM_20948_Internal_Acc | ICM_20948_Internal_Gyr), myFSS); if (result > worstResult) worstResult = result;

Maybe more g would help? Please take a look at issue #64.

Best wishes,
Paul

@PaulZC
Copy link
Contributor

PaulZC commented Jul 15, 2021

There is some helpful info in #51 too:

#51 (comment)

@fralbo
Copy link
Author

fralbo commented Jul 15, 2021

Your idea is to decrease the effect of g correction to x/y orientation ?
Do you think changing the scale can change it ? I'm going to try.
Do you know if it's possible to deactivate the automatic correction? Maybe to only enable it when we are just between +/- 2 degrees or so?

@fralbo
Copy link
Author

fralbo commented Jul 15, 2021

So, I made the test but that doesn't change the problem.
I guess the correction doesn't rely on the scaled g value.

@PaulZC
Copy link
Contributor

PaulZC commented Jul 15, 2021

Hi @fralbo ,
OK - thank you for trying that.
I do not know what else to suggest - we have no control over the inner workings of the DMP.
All I can suggest is that you try the actual InvenSense code and see if that works for you. Please see #74 for details.
Best wishes,
Paul

@fralbo
Copy link
Author

fralbo commented Jul 16, 2021

I tried to use an implementation not using the DMP but it's really really not good!
https://forums.adafruit.com/viewtopic.php?f=19&t=181180&p=881568#p881568
I'm stil searching...

@fralbo
Copy link
Author

fralbo commented Nov 21, 2021

Ok so, according to my tests, tilt measurement on motorbike and certainly drones, as they turn banking like a motorcycle, we do not have to use acceleration but gyro only.
So, in Setup() function, I use acceleration to measure the initial tilt angle, because the motorbike could be on its lateral crutch, but while driving, I only read the gyro values.
And what about gyro drift ? Yes, I obviously have this problem, of course ! So, I use the tilt angle derivative value. I mean, if I detect that tilt angle does not change for a while, I certainly drive in straight line so, I apply an integral correction to reset the angle to 0.
And that works fine!

@fralbo fralbo closed this as completed Nov 21, 2021
@PaulZC
Copy link
Contributor

PaulZC commented Nov 21, 2021

Hi @fralbo ,

Thank you for the update. I am glad that is working for you!

Best wishes,
Paul

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

No branches or pull requests

2 participants