Log in

View Full Version : Trouble with Eclipse (Java)


BrighidKHeh
13-02-2015, 16:07
public Joystick joystick1;
public JoystickButton NoodleOn;
public JoystickButton NoodleOff;
public Joystick LiftArm;
public Joystick joystick2;
}
public IO() {
rightJoystick = new Joystick(1);
joystick2 = new Joystick(2);
NoodleOn = new JoystickButton(joystick2, 3);
NoodleOn.whileHeld(new NoodleOn());
___________________________________________
The two bolded Joysticks (joystick(1) and joystick(2)) contain errors. The errors says "cannot instantiate the type joystick". The code shouldn't be producing errors, and joystick.class is under the WPILIB like it should be. Any solutions?
__________________________
http://Libraries\Pictures
the image is under a word document

Rakusan2
13-02-2015, 16:24
I do not see rightJoystick being declared
public Joystick rightJoystick;
also this year the numbering for joysticks is 0-based meaning that the 1st joystick is Joystick(0)

BrighidKHeh
13-02-2015, 16:35
public Joystick rightJoystick;
public JoystickButton NoodleOn;
public JoystickButton NoodleOff;
public Joystick ArmUpDown;
public Joystick leftJoystick;
}
public IO() {
rightJoystick = new Joystick(1);
leftJoystick = new Joystick(2);
NoodleOn = new JoystickButton(2, 3);
NoodleOn.whileHeld(new NoodleOn());
ArmUpDown = new Joystick(1);
____________________________________
The bolded joysticks all have the same error still. "Cannot instantiate the type joystick". Also, when I click on joystick.class under WPILib, I get a page that says "Source not found - The JAR file has no source attachment". I don't know if this makes a difference or not.

BrighidKHeh
13-02-2015, 17:35
Is there anyone who is good at Java and would be willing to use TeamViewer?

Rakusan2
13-02-2015, 17:41
Are you able to show me the rest of the class?

BrighidKHeh
13-02-2015, 17:48
public class ArmDown extends Command {
public ArmDown() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(Robot.noodleAndToteSystems);
}

// Called just before this Command runs the first time
protected void initialize() {
}

// Called repeatedly when this Command is scheduled to run
protected void execute() {
Robot.noodleAndToteSystems.SetArmMotorSpeed(-1);
}

// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return false;
}

// Called once after isFinished returns true
protected void end() {
Robot.noodleAndToteSystems.SetArmMotorSpeed(0);
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
return arm.limitSwitch3;
return arm.limitSwitch4;
end();
}
}
___________________________________
The error is at the top of this page, and every other page in the program.

Ozuru
13-02-2015, 23:54
Well, the first thing I've noticed is that your Joystick ports are off -- it starts at a zero-index so Joystick 1 is in port 0 and Joystick 2 is in port 1.

viggy96
15-02-2015, 00:31
Did you import the Joystick class?

Fauge7
15-02-2015, 00:59
you have to create the object outside the constructor like so Oi.java (https://github.com/fauge7/Gainz-Robot-Code/blob/master/Gainz/src/org/usfirst/frc/team3019/robot/OI.java)