Also, you cannot define a jaguar inside of a code block (in this case, your "try" block, and then use it anywhere outside of the block. Outside of any method, but inside your class, type (you may have already done this):
Code:
CANJaguar armMotor;
Then, change your code that you displayed to this:
(Basically remove the CANJaguar variable marker):
Code:
public void robotInit(){
try {
armMotor = new CANJaguar (4, CANJaguar.ControlMode.kPosition);
} catch (CANTimeoutException ex){
ex.printStackTrace();
}
Essentially, what is happening is that you're not initializing your global CANJaguar variable. How Java works is that it allows global and local variables of the same name. So the Jaguar that you're initializing isn't the same one that you're using at line 70. You made a new Jaguar also called "armMotor" and initialized that one. Because it had a conflicting name, Java resolved this by "hiding" the global variable from that function. The armMotor inside robotInit() was discarded after robotInit ended. The other armMotor that you defined elsewhere was never touched. By removing the CANJaguar reference, you're not creating a new variable anymore but instead initializing the existing global one, which is what you intended on doing.