mtmal / ICM20948-linux-i2c

Linux driver for I2C communication with ICM20948.
MIT License
7 stars 2 forks source link

RPY #1

Open zaheeroz opened 3 years ago

zaheeroz commented 3 years ago

Hi Mate, Thanks for sharing the great work. I tried to run it on 2 different brands of ICM20948s, however I am getting some wrong RPYs. Roll starts from 11.x and gets to 20.x in the 200 counter, while the device is totally still and on the floor. The error/numbers are very consistent and it would seem like something is incrementing. I have made no changes to the code. Any idea what's going on ?
Thanks

mtmal commented 3 years ago

Hi Zaheeroz, Apologies for asking a basic question, but in this scenario, do you run gyros calibration? It is the -c 1 option. If it starts with non-zero angles while stationary, to me that indicates biases which were not reset. You may also want to rebuild it with -DLOG=1 to get some more information on what is happening (although it is not too extensive). Cheers, Mateusz

krobol commented 3 years ago

I have the same Problem. The calibration is run, but after that the RPYs are increasing/decreasing by some amount.

mtmal commented 3 years ago

Thanks, both. I quickly double-checked it and indeed angles change, but it doesn't seem too dramatic. I ran it for 4000 iterations and it reached a max of 5 degrees on roll/pitch. Bear in mind that IMUs are not that great when stationary due to their bias, which is basically a random walk. Also, in the calibration, I only perform gyro calibration - not accelerometer. To do the latter, you would need to write your own code. The problem with this is that IMU needs to be perfectly aligned with the gravity vector, which is not always possible (e.g. IMU embedded with a stereo camera on the tilted head). Otherwise, you would need to know the precise tilt angle.

What I suggest is to put IMU on a robot and drive in a straight line. Angles should be zero. When moving, IMU should be giving better results - mainly because there will be an additional force acting on the accelerometer. When stationary, it is hard for it to distinguish roll from pitch.

I appreciate it may not be the answer anyone was looking for, but so far this is my experience with IMUs in robotics (unless you have access to high-grade expensive devices).