I did not see the source for your DriveForward command. I'm guessing it should look something like the following:
Code:
public class DriveForward extends Command {
private double timeToRun;
public DriveForward(double timeout) {
requires(Robot.drivetrain);
timeToRun = timeout;
}
@Override
protected void initialize() {
}
@Override
protected void execute() {
// Change to method to apply power to your drivetrain
drivetrain.setPower(0.4, 0.4);
}
@Override
protected boolean isFinished() {
return (timeSinceInitialized() >= timeout);
}
@Override
protected void end() {
// Don't forget to stop
drivetrain.setPower(0, 0);
}
@Override
protected void interrupted() {
end();
}
}
Is it possible that your isFinished() implementation was not checking that enough time had elapsed? If your isFinished() never returns true and you don't set a time out to interrupt your DriveCommand, the command will never stop and your robot will just keep going forward (which sounds like the condition you were describing).
Also, don't forget to stop the motors in your end() and interrupted() methods - unless you want the robot to continue to move even after the command terminates.