When you use the drivetrain class (or similar), the algorithm used by the turnTo (or similar function) is to calculate how far to move each wheel. This is done thru the following formula:
Where trackWidth is defined as the distance from the left wheels to the right wheels. WheelBase would be the distance from the front wheels to the backwheels.
One method would be to program the robot to turn 720 or 1080 degrees and change the track width until you observe the robot turning the correct amount. Physical measurements are a good starting point, but reality can intervene, and experimental results work better.
Alternately, if you can add an inertial sensor to the robot, do it. With the inertial sensor the robot can directly measure how far it has turned rather than calculating the required number of motor degrees based on the measurements you give it.
Both methods should get your robot closer to an “accurate” turn. However, it will still likely not be “perfect”. You’ll need to assess where “good enough” is for you, both in terms of accuracy and repeatability. All of these are good entries to make in your Engineering Notebook.
If you wind up looking beyond these two relatively simple solutions, you’ll find the world of “control theory” and the “Proportional-Integral-Derivative” (PID) method.