This is a good question to be addressed this early in the season. Lets see what the field of VexForum archeology could yield us when searching for “Drive Straight PID ” (you need to know the right keywords, of course):
Most everyone struggles with accurate base control in auton. At the highest level, 5225 developed a 3 tracking wheel solution that allowed them to set the world record in programming skills last year, and a handful of teams including 8059 and 139 have replicated their “odometry” based on a document they released last year. Team 5225 Introduction to Position Tracking Document
But at a less extreme level, for people just looking to take a step up from move.relative you may like the base control code I developed this year…
For driving straight the most important thing is to have one PID loop for driving robot forward and another separate control loop for small heading corrections to keep the robot straight, which is exactly what @Doug Moyers code does.
That code could work great if you have perfectly balanced drivetrain and matched motors. However, that is very hard to achieve in the real life. One side will inevitably have more friction than the other. To handle that you will need to cap drivePower coming out of the forward PID loop about 10-15% below the max power that motors could accept.
If you visit above topics there will be actual code samples as well as more discussion and links to additional resources.resources