You could try this. This worked for me when I had your EXACT problem.
Code:
public void autonomous()
{
Timer.start() //starts a timer at 0 seconds
while(isAutonomous() && isEnabled()) //run when autonomous is Clive and you are enabled
{
if(Timer.get() < time) //time is a double in terms of seconds
{
driveVariable.drive(speed, curve); //move robot at this speed with/without curve
}
Timer.delay(0.005); //does nothing for 5 seconds but helps refresh motors in loop
}
Timer.stop() //stops timer
}
Good luck and happy competition!