Determining drivebase angle without a gyroscope

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.

Can anyone help?

Sure, it’s just forward kinematics.

\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.

2 Likes

so, I would be calling this once every 10-ish ms with the distance traveled since the last call, and adding the result to my stored angle?

Sure! \theta += dt \cdot (vl-vr)/L

4 Likes

Thank you!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.