Find robot position using encoders?

How can I find an XY coordinate on the field for my robot using 2 encoders? My team can’t get any more sensors so I can’t use an accelerometer. I have an H-drive if that’s important.

This might help

With an H drive and two encoders you can’t track XY location. A holonomic drive has three degrees of freedom, but each encoder can only account for one degree each. If you limit the robot to never using all three degrees at the same time during autonomous you might be able to get away with two encoders.

In theory I could add an omni wheel without a motor to the back to track position, couldn’t I?

That’s a tracking wheel, and was how 5225A was able to have such an extremely successful odometry program

Yup! I’d recommend having tracking wheels for all three encoders, as, unlike your drive wheels, they won’t slip. We also had them hinged and lightly pressed into the ground because even a little slippage can make your position tracking vastly less accurate.