Odometry drifting and not working while strafing

I’m trying to create an auto target button using odometry through okapilib and the odometry drifts a little bit over time, but more concerning is when I strafe our mecanum drive and then try and use the auto target the angle is practically unchanged even if I’m on the other side of the field. I know I set up my odometry correctly so I don’t know why this is happening.

Are you sure you are tracking horizontal displacement correctly? AKA do you have a horizontal tracking wheel? Also to help with drifting, are you using the IME’s (integrated motor encoders) or rotation sensors/optical shaft encoders? Using the IME’s will add some drift due to the slop in the motors/wheels. I’d recommend using optical shaft encoders/rotation sensors to improve accuracy. It’s also possible your code isn’t having accurate enough calculations.

I’m using okapi’s algorithm and I have 3 tracking wheels all with quad encoders