Go to Post And who knows, maybe one day you'll prove the impossible possible! - MissInformation [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-02-2015, 16:07
BrighidKHeh's Avatar
BrighidKHeh BrighidKHeh is offline
Registered User
FRC #3871 (Trojan Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Worthington, MN
Posts: 37
BrighidKHeh is an unknown quantity at this point
Trouble with Eclipse (Java)

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?
__________________________

the image is under a word document
Reply With Quote
  #2   Spotlight this post!  
Unread 13-02-2015, 16:24
Rakusan2 Rakusan2 is offline
Registered User
AKA: Tomas Rakusan
FRC #3571 (Milton Mustangs)
Team Role: Programmer
 
Join Date: May 2014
Rookie Year: 2011
Location: Milton, ON, Canada
Posts: 22
Rakusan2 is an unknown quantity at this point
Re: Trouble with Eclipse (Java)

I do not see rightJoystick being declared
Code:
public Joystick rightJoystick;
also this year the numbering for joysticks is 0-based meaning that the 1st joystick is Joystick(0)
Reply With Quote
  #3   Spotlight this post!  
Unread 13-02-2015, 16:35
BrighidKHeh's Avatar
BrighidKHeh BrighidKHeh is offline
Registered User
FRC #3871 (Trojan Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Worthington, MN
Posts: 37
BrighidKHeh is an unknown quantity at this point
Re: Trouble with Eclipse (Java)

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.

Last edited by BrighidKHeh : 13-02-2015 at 16:49.
Reply With Quote
  #4   Spotlight this post!  
Unread 13-02-2015, 17:35
BrighidKHeh's Avatar
BrighidKHeh BrighidKHeh is offline
Registered User
FRC #3871 (Trojan Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Worthington, MN
Posts: 37
BrighidKHeh is an unknown quantity at this point
Re: Trouble with Eclipse (Java)!!!

Is there anyone who is good at Java and would be willing to use TeamViewer?
Reply With Quote
  #5   Spotlight this post!  
Unread 13-02-2015, 17:41
Rakusan2 Rakusan2 is offline
Registered User
AKA: Tomas Rakusan
FRC #3571 (Milton Mustangs)
Team Role: Programmer
 
Join Date: May 2014
Rookie Year: 2011
Location: Milton, ON, Canada
Posts: 22
Rakusan2 is an unknown quantity at this point
Re: Trouble with Eclipse (Java)

Are you able to show me the rest of the class?
Reply With Quote
  #6   Spotlight this post!  
Unread 13-02-2015, 17:48
BrighidKHeh's Avatar
BrighidKHeh BrighidKHeh is offline
Registered User
FRC #3871 (Trojan Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Worthington, MN
Posts: 37
BrighidKHeh is an unknown quantity at this point
Re: Trouble with Eclipse (Java)

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.
Reply With Quote
  #7   Spotlight this post!  
Unread 13-02-2015, 23:54
Ozuru's Avatar
Ozuru Ozuru is offline
It's always the programmer's fault.
no team
 
Join Date: May 2013
Rookie Year: 2010
Location: Earth
Posts: 268
Ozuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to behold
Re: Trouble with Eclipse (Java)

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.
Reply With Quote
  #8   Spotlight this post!  
Unread 15-02-2015, 00:31
viggy96 viggy96 is offline
Registered User
FRC #3331
Team Role: College Student
 
Join Date: Jan 2015
Rookie Year: 2010
Location: Charlotte
Posts: 55
viggy96 is infamous around these partsviggy96 is infamous around these parts
Did you import the Joystick class?
Reply With Quote
  #9   Spotlight this post!  
Unread 15-02-2015, 00:59
Fauge7 Fauge7 is offline
Head programmer
FRC #3019 (firebird robotics)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Scottsdale
Posts: 195
Fauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to all
Re: Trouble with Eclipse (Java)

you have to create the object outside the constructor like so Oi.java
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi