I am going to preface this with: no, I do not, under any circumstances, want to use a gyroscope here.
I am working with adding simulation support to our gyroscope code. I don’t need this to be accurate at all, but I’d like to be able to estimate the drivebase angle purely from our encoder readings (left and right sides).
I know this is possible, as I have seen other teams do it as an IRL replacement for a gyro, but I cant seem to find any code or explanation for it.
\omega = (vl - vr)/L, where vl and vr are the left and right speeds of your drivebase, and L is your wheelbase (drivebase width). Just integrate omega, and you got your heading.