Our autonomous was originally pretty complex, Andrew was programming it the hard way. Then I started moving commonly used bits to ralff.whatever (after qbranche's original Robotics Autonomous Language For FIRST). I designed the interface that ralff takes care of just about everything. It generally works like `ralff.do(parameter, time)'. This left turning still fairly complex (our drive train is fairly complex), so I took some code directly from the teleop, and spoof joystick inputs.
Code:
switch (autoMode) {
case 0://Testing (nothing) mode//////////////////////////////////////////////
break;
case 1://Zone 1/////////////////////////////////////////////////
switch (stage) {
case 0: if (ralff.driveForward(-1, 1 )) stage++; break;
case 1: if (ralff.turnBack(0.5,-1, 1.65 )) stage++; break;
case 2: if (ralff.driveForward(-1, 0.25)) stage++; break;
case 3: break;
}
break;
case 2://Zone 2/////////////////////////////////////////////////
switch (stage) {
...