I see you are forcing the robot to wait half a second every loop iteration:
wait(0.5,seconds); //because heading reading is slow, need to wait to get accurate reading
void turn_to(double heading){
double d = BrainInertial.heading(degrees); //turn to a compass specific heading
if (d > 180){
d = d-360;
}
d = heading - d;
turn(d);
}
The heading reading is ‘slow’ because you are making it slow. It will help a lot if you replaced this delay with something much more reasonable… like… wait(20, msec);.
Perhaps, if you can implement a PID as EngineerMike mentions, your overshooting problem will be much less significant.
I can promise you the problem isn’t the sensor: