Quote:
Originally Posted by AnnaliseDonavan
Code:
public class Robot extends IterativeRobot {
RobotDrive Drive;
Joystick drivestick;
Joystick joystick;
int autoLoopCounter;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
Jaguar FL = new Jaguar (5);
Jaguar BL = new Jaguar (2);
Jaguar FR = new Jaguar (3);
Jaguar BR = new Jaguar (4);
Drive = new RobotDrive(FL,BL,FR,BR);
drivestick = new Joystick(0);
joystick = new Joystick(1);
}
|
Declaring objects inside a method makes them local objects that (unless copied elsewhere) disappear when the method returns. I'm presuming you want these to be instance variables. In this case, declare them earlier and just assign them in robotInit():
Code:
public class Robot extends IterativeRobot {
RobotDrive Drive;
Joystick drivestick;
Joystick joystick;
Jaguar FL, BL, FR, BR;
int autoLoopCounter;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
FL = new Jaguar (5);
BL = new Jaguar (2);
FR = new Jaguar (3);
BR = new Jaguar (4);
Drive = new RobotDrive(FL,BL,FR,BR);
drivestick = new Joystick(0);
joystick = new Joystick(1);
}
P.S.: Also, enclosing your code with the tags makes it easier to read!
P.P.S.: After seeing this, I did not review the rest of the code.