What is a good and efficient way to program a time based autonomous program in an iterative robot base class? More specifically, could anyone show me what an example code would look like if I for example wanted to make my tankdrive, four motor robot, drive forward for two seconds and then turn for one second and then stop?
Any help would be greatly appreciated.
Read about the Timer Class.
Set a timer when you start your motors.
Each loop (autonomous periodic), check the timer.
When you reach the desired time mark, do something.
FYI: You might also want to put encoders on your motors, and check the distance (revolutions) the encoders say you went.