Inertial uncontrollably drifting

My inertial sensor tends to constantly rotate on the x axis without the robot even moving. Whenever we run one or two autonomous programs, the inertial sensor begins to spin either clockwise or counterclockwise, increasing in speed with each additional run. Even worse, whenever we fire our slapper, say in our skills auton, it completely compounds the rotational drift exponentially. At first, it starts at about .2 degrees a second, and maybe increases to around 1-2 degrees a second with enough normal 15 second autons. Already this is an incredibly large error, but if we fire the slapper, it increases to somewhere between 15-60 degrees a second of rotation. Keep in mind, the robot is not moving or turning whenever we check the inertial, so there is no reason it should be rotation whatsoever. We have calibrated countless times, factory calibrated it nearly 100 times at our last competition, and still nothing works. We have gotten 5 brand new or recently used inertial sensors, which other teams had no problems with, put it on our robot and have encountered the same issue. We have replaced the wire connecting the inertial to the brain, changed the port that the inertial wire connected to, changed the position of the inertial to multiple positions on the robot, including as far away as possible from the slapper to reduce the shock, and still nothing works. I am inclined to believe that this is a code issue as there should be no way that 5 new inertials, as well as the one we were previously using, which had worked fine for our past 3 competitions, should be broken in the same way. I have never encountered this issue before and multiple people have tried and failed to diagnose the problem and solution. Sorry for the long rant but I am out of ideas for how to fix this problem and would love some assistance. Does anyone know of a solution to solve this problem, or do we need to just test more inertials?

When are you calibrating your inertial? The robot needs to be completely still while the inertial is calibrating, otherwise it will drift like you are experiencing. Also make sure you calibrate the inertial at the beginning of every run of the program so the error doesn’t build up from going a long time without calibrating. If this doesn’t fix it, it would help if you could post your code to help diagnose the problem.

We are calibrating our inertial before every match, and during the initialize portion of our code, when the robot isn’t moving.

First line of debugging is to go to the inertial sensor dashboard without any user program running, keep the robot still, and press calibrate. Then observe the sensor and see if it drifts (it will always drift a little, but not 1 or 2 degrees/second). That should tell you if the sensor is ok, or if it’s something to do with code or the robot build.

really ? factory cal ? not such a good idea, factory cal is not something to be done often and requires the sensor to be mounted very accurately.

so depending on results. perhaps post a photo of how the IMU is mounted so we can possibly tell if it is subjected to any vibration etc.