We used a similar idea to what I think you’re getting towards in 2018. The team has continued using it and you can find the code here. There is a whitepaper available here.
Effectively what you will want to do is calculate the angle between your current heading and the slope of the tangent line at your current point in the polynomial. If your polynomial is defined on the domain [0, 1], and you have calculated the arc length of the polynomial in advance (we used this JS library), then you can find your desired tangent line by dividing your current distance traveled (average of your 2 encoders) by the total length of the polynomial. You’ll then use a simple P controller to constantly “chase” the next desired angle.
This approach to auto is okay, and I think it’s one of the simpler ways to get it done; it’s relatively consistent, however it isn’t perfect and you’ll have to spend some time getting the autos perfect.
However, if you are looking for long-term auto success, I recommend checking out the solutions currently provided by WPILib as mentioned by Tyler and Prateek above. They will be more accurate and better supported by the community in the long term.