It will be fine. That block is most likely the remnant of a previous auton selector, but since the auton selection process is now done in your Auton.java class, that code was left behind.
As i said before, this is dependent on the current state of the gyro. At the start of the match, the gyro will read 0 (if reset on autonomousInit). Calling turn(90) will turn untill the gyro reads 90, effectively a 90 degree turn to the right. However, since the gyro is now at 90, another call to turn(90) will do nothing since the gyro is already at 90. If you wanted to turn another 90 degrees to the right, you may either call turn(180) or reset() than turn (90), given reset() is a function that calls gyro.reset().
No. Now that you followed my steps and made a "public static Robot r", all methods should now have access to the robot and you won't need to pass in the "r" parameter anymore.
"void" is necessary, since it defines the return type of the function. This is not changing.
The "private" keyword defines the accessibility of the function. "private" means that only code within Auton.java may access that function whereas "public" means that code anywhere may access that function. Since there is no point for some of those functions to be called elsewhere (such as "turn", "move", etc.) those should be private. For other functions that are called by other classes, such as startAuton() called by Robot.java, those should remain public in order to be called by other classes.
"static" depends on which implementation of the robot instantiation you chose. What "static" means is that, in order for that method to be accessed, a new Object of type $class (in this case, this is referring to the "new AutonMode()"). This is shown in Timer.delay, since "Timer t = new Timer()" is never called. However, in other cases such as "Victor leftDrive = new Victor(1)", non-static methods within the victor "leftDrive" are called since there are multiple different Victors.
As you can see in this code posted before
Code:
static Robot r
public static void setRobot(Robot rob){
r = rob;
}
//in Robot.java
AutonManager.setRobot(this);
I believe this is the implementation you chose. The "static" keyword on methods (apologize if I'm late on this but a method is stuff like turn, move, etc.) says that you can call
Code:
AutonManager.startAuton(autonMode);
Without the static keyword, you have to do
Code:
AutonManager m = new AutonManager();
m.startAuton(autonMode);
So, if you chose this implementation
Code:
Robot robot
public AutonManager(Robot r){
this.robot =r;
}
//in Robot.java
AutonManager autonManager;
public void robotInit(){
autonManager = new AutonManager(this);
}
than you
cannot use the static keyword since there is no static keyword on "robot", thus needing an enclosing instance.
See
http://stackoverflow.com/questions/4...-do-in-a-class or
http://www.javatpoint.com/static-keyword-in-java for more help on the "static" keyword.