Another option would be to use the system clock:
We used similar code on an alliance partner's robot at week 0 and it worked flawlessly.
Code:
public void autonomous() {
long startTime = System.currentTimeMills();
while(isAutonomous()){ //Place everything in a loop.
long timePassed = System.currentTimeMills() - startTime;
if(timePassed < 5000){
//in the first 5 seconds of auto
robotDrive.drive(0.1,0.0);
}else {
robotDrive.drive(0,0.0);
}
Timer.delay(.05);
}
This code should not cause any drive not updated enough issues because the delay is only .05 second, and you should still be able to have the safety enabled.
Also you'll noticed I chanced the speed to .01, you only need to cross the line, so I would slowly increment the speed until it matches your needs. Driving at half speed for 5 seconds could have some unintended consequences.