kriswiner/ICM42688

Data fusion lag

Opened this issue · 3 comments

This is not so much a bug report as a question.
I am using (slightly modified) version of this repository for my robot (https://github.com/shurik179/yozh) and I have a strange issue: the there seems to be a lag in updating yaw.

I.e. I have code "rotate right until yaw of (current +90 deg) is reached". The robot rotates, stops, and if I read the yaw immediately, it is about 90 deg. If I read the yaw one second later, it is 94 deg - even though during this second the robot was not moving. And real-life value is indeed about 94 deg - so the robot overshot the turn.

Strangest of all, this only applies for rotating right (clockwise); when rotating CCW, this issue doesn't arise.

Do you have any ideas what could be causing that?
The data fusion code I use is the same 6 DoF Madgwick as in your repo, except that I do not run multiple iterations with each reading (I am running it on SAMD21G18 chip, with cpu frequency of 48 mhz, so it can only run data fusion at about 200 hz frequency - while I set the output data rate for both accel and gyro at 500 hz). Just in case, the code is here:
https://github.com/shurik179/yozh/blob/main/firmware/yozh-firmware/IMU.cpp

BTW, the yaw drift when the robot stands still is very low, I am quite happy with that.

Thanks, will try lowering the ODR.
What really puzzled me was the asymmetry: why it only shows for CW rotation...

BTW, thanks a lot for your work! it was certainly very helpful.