Go to Post What about marriages ended by FIRST. I know that by Presidents Day my wife is not real happy with me :) - IndySam [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 16-02-2015, 13:15
SirGibbs SirGibbs is offline
Registered User
FRC #5676 (Hornets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: USA
Posts: 11
SirGibbs is an unknown quantity at this point
Build Errors

Hey guys,
after multiple errors with eclipse and my code, I got it finally but when I try to deploy the code now, I get this error:
Code:
ERROR Unhandled exception instantiating robot org.usfirst.frc.team5676.robot.Robot java.lang.IllegalStateException: Network tables has already been initialized at [edu.wpi.first.wpilibj.networktables.NetworkTable.checkInit(NetworkTable.java:45), edu.wpi.first.wpilibj.networktables.NetworkTable.setServerMode(NetworkTable.java:68), edu.wpi.first.wpilibj.RobotBase.<init>(RobotBase.java:58), edu.wpi.first.wpilibj.IterativeRobot.<init>(IterativeRobot.java:55), org.usfirst.frc.team5676.robot.Robot.<init>(Robot.java:16), sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method), sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62), sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45), java.lang.reflect.Constructor.newInstance(Constructor.java:408), java.lang.Class.newInstance(Class.java:433), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:197)]
I just dont know what I would need to change to make it running... here is my code:

Code:
package org.usfirst.frc.team5676.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import org.usfirst.frc.team5676.robot.XboxController; 
import edu.wpi.first.wpilibj.Compressor;	
import org.usfirst.frc.team5676.robot.XboxController.Axis;
import org.usfirst.frc.team5676.robot.XboxController.buttons;
import org.usfirst.frc.team5676.robot.XboxController.triggers;


public class Robot extends IterativeRobot {
   
	RobotDrive myDrive; 
	Joystick driveStick; 
	static XboxController gameStick = new XboxController(1);
	DoubleSolenoid Piston; 
	
	static Axis LeftStick=Global.driver.LeftStick;
	static Axis RightStick=Global.driver.RightStick;
	static triggers Triggers = Global.driver.Triggers;
	static buttons DriverButtons = Global.driver.Buttons;
	static buttons OperatorButtons = Global.operator.Buttons;
	static int OperatorDpad = -1;
	
    public void robotInit() {
    	myDrive = new RobotDrive (1, 2, 3, 4);
    	driveStick = new Joystick(1); 
    }

    
    public void autonomousPeriodic() {

    }

    public void operatorControl() { 
    	while (isOperatorControl() && isEnabled()) { 
    		myDrive.arcadeDrive(driveStick);
    		Timer.delay(0.01);
    	}
    }
    public void teleopPeriodic() {
        
    }
    
    public void moveArm()
	{	 Piston = new DoubleSolenoid(0,1 );
		
		if(gameStick.button[0].get() == true) {
			
			Piston.set(DoubleSolenoid.Value.kForward);	
		
			System.out.println("'A' button is pressed: Piston moves forward");
		}
	  else if(gameStick.button[1].get() ==true)
		{
			Piston.set(DoubleSolenoid.Value.kReverse); 
	
			System.out.println("'B' button is pressed: Piston moves backward");
		}
		else
		{
			Piston.set(DoubleSolenoid.Value.kOff);		
		}
	}
    
    public void FrontArm()
   	{	 Piston = new DoubleSolenoid(2,3 );
   			
   		if(gameStick.button[2].get() == true) {
   			
   			Piston.set(DoubleSolenoid.Value.kForward);	
   			System.out.println("'X' button is pressed: Piston moves forward");
   		}
   	  else if(gameStick.button[3].get() ==true)
   		{
   			Piston.set(DoubleSolenoid.Value.kReverse); 
   			System.out.println("'Y' button is pressed: Piston moves backward");
   		}
   		else
   		{
   			Piston.set(DoubleSolenoid.Value.kOff);	
   		}
   	}

    
    public void pickerArm()
	{	 Piston = new DoubleSolenoid(4,5 );
		
		if(gameStick.button[4].get() == true) {
			
			Piston.set(DoubleSolenoid.Value.kForward);	
		
			System.out.println("LB' button is pressed: Piston moves forward");
		}
	  else if(gameStick.button[5].get() ==true)
		{
			Piston.set(DoubleSolenoid.Value.kReverse); 
			
			System.out.println("'RB' button is pressed: Piston moves backward");
		}
		else
		{
			Piston.set(DoubleSolenoid.Value.kOff);
		}
	}
    
  
    public void testPeriodic() {
    
    }
    
}
Thank you in advance for any help or suggestions.
Reply With Quote
  #2   Spotlight this post!  
Unread 16-02-2015, 17:27
dstech dstech is offline
Registered User
no team
 
Join Date: Feb 2015
Location: Marietta, GA
Posts: 1
dstech is an unknown quantity at this point
Re: Build Errors

Well First it looks like you have a lot going on in your code with all those imports and extending a class but I would try and really pick apart that error and see if you can find that spot in "RobotBase" where it is actually messing up.

Apart from that you could try surrounding your code with a try-Catch block to handle that exception and see if that will make it happy? I may be completely off base but it's worth a shot...
Reply With Quote
  #3   Spotlight this post!  
Unread 16-02-2015, 17:57
SirGibbs SirGibbs is offline
Registered User
FRC #5676 (Hornets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: USA
Posts: 11
SirGibbs is an unknown quantity at this point
Re: Build Errors

At first thank you, well we are a complete rookie team. Oke what exactly would that do?
Reply With Quote
  #4   Spotlight this post!  
Unread 16-02-2015, 18:02
gbear605's Avatar
gbear605 gbear605 is offline
Scarebear
FRC #1768 (Nashoba Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: United States
Posts: 37
gbear605 is an unknown quantity at this point
Re: Build Errors

It's saying that Network tables has already been created. Have you tried restarting the robot/RoboRIO?
If that doesn't fix it: your code look fine. The error appears (to me) to be unrelated to your code, especially since the error has to do with Network Tables, which you aren't using in your code. There's likely some other error in your electronics or your method of deploying the code.
Reply With Quote
  #5   Spotlight this post!  
Unread 16-02-2015, 18:05
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: Build Errors

I'm having the same problems. Once I get to the Driver Station, I get this error message, along with no Robot Code:

ERROR Unhandled exception instantiating robot org.usfirst.frc.team3871.robot.Robotjava.lang.Clas sNotFoundException: org.usfirst.frc.team3871.robot.Robot at [java.net.URL.ClassLoader$1.run(URLClassLoader.java :372), java.net.URL.ClassLoader$1.run(URLClassLoader.java :361), java.security.AccessController.doPriveleged(Native Method), java.net.URLClassLoader.findClass(URLClassLoader.j ava:360),java.lang.ClassLoader.loadClass(ClassLoad er.java:424), sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:308), java.lang.ClassLoader.loadClass(ClassLoader.java:3 57), java.lang.Class.forName0(NativeMethod), java.lang.forName(Class.java:259), edu.wpi.first.wpilibi.RobotBase.main(RobotBase.jav a:197)]
Reply With Quote
  #6   Spotlight this post!  
Unread 16-02-2015, 18:35
SirGibbs SirGibbs is offline
Registered User
FRC #5676 (Hornets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: USA
Posts: 11
SirGibbs is an unknown quantity at this point
Re: Build Errors

Ok thank you guys, as soon as I can come into the school tomorrow I will restart the Robot and try it again, maybe reimage it. I asked several people and nobody sees a relation between the code and the error... Otherwise I will try the "try block". If that doesn't help, I don't know... Maybe one of you gets a magic idea ^^. Thank you all for your help, I will keep you up do date, maybe that also helps somebody else. If you have any more suggestions or ideas, no matter what it is, please post it...
Reply With Quote
  #7   Spotlight this post!  
Unread 17-02-2015, 07:58
SirGibbs SirGibbs is offline
Registered User
FRC #5676 (Hornets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: USA
Posts: 11
SirGibbs is an unknown quantity at this point
Re: Build Errors

Ok it has to be an code error. The default code is running. That is so incredible weird, is anybody seeing the mistake???
Reply With Quote
  #8   Spotlight this post!  
Unread 17-02-2015, 08:01
gbear605's Avatar
gbear605 gbear605 is offline
Scarebear
FRC #1768 (Nashoba Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: United States
Posts: 37
gbear605 is an unknown quantity at this point
Re: Build Errors

When you put your code on the robot, does it work now?
Reply With Quote
  #9   Spotlight this post!  
Unread 17-02-2015, 08:57
SirGibbs SirGibbs is offline
Registered User
FRC #5676 (Hornets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: USA
Posts: 11
SirGibbs is an unknown quantity at this point
Angry Re: Build Errors

Well the default code was running,our code wasn't. I tried a second code that I wrote last night and it told me that it was running and deployed, but I got the error again but it still worked. So I started to reimage the roborio just in case and to reinstall java. Is it just me or is the one that we need missing at the download page????? The Armv 7 Linux AFP Softfp abi little endian jre? The ones that are at the oracle website aren't working. I would bet that their was a third one yesterday...
Reply With Quote
  #10   Spotlight this post!  
Unread 17-02-2015, 09:51
fsilberberg fsilberberg is online now
WPILib Developer
AKA: Fred Silberberg
FRC #0190
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Redmond
Posts: 148
fsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura about
Quote:
Originally Posted by SirGibbs View Post
Well the default code was running,our code wasn't. I tried a second code that I wrote last night and it told me that it was running and deployed, but I got the error again but it still worked. So I started to reimage the roborio just in case and to reinstall java. Is it just me or is the one that we need missing at the download page????? The Armv 7 Linux AFP Softfp abi little endian jre? The ones that are at the oracle website aren't working. I would bet that their was a third one yesterday...
Make sure you're running the latest plugins. That error was fixed a few weeks ago.
Reply With Quote
  #11   Spotlight this post!  
Unread 17-02-2015, 10:14
SirGibbs SirGibbs is offline
Registered User
FRC #5676 (Hornets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: USA
Posts: 11
SirGibbs is an unknown quantity at this point
Re: Build Errors

oke I will. Its just weird because it was working yesterday.....
Reply With Quote
  #12   Spotlight this post!  
Unread 17-02-2015, 11:06
SirGibbs SirGibbs is offline
Registered User
FRC #5676 (Hornets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: USA
Posts: 11
SirGibbs is an unknown quantity at this point
Re: Build Errors

Ok the default codes are running, I still get the same error when i use my code. So it seems to be code related...
Reply With Quote
  #13   Spotlight this post!  
Unread 17-02-2015, 11:33
cstelter cstelter is offline
Programming Mentor
AKA: Craig Stelter
FRC #3018 (Nordic Storm)
Team Role: Mentor
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Mankato, MN
Posts: 77
cstelter will become famous soon enough
Re: Build Errors

Only thing that jumped out at me is you're instantiating both xbox controller and Joystick on port 1. That doesn't seem right, but likely won't lead to the problem.

Try commenting all but the drivetrain and incrementally adding in items

i.e. start with:

Code:
package org.usfirst.frc.team5676.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import org.usfirst.frc.team5676.robot.XboxController; 
import edu.wpi.first.wpilibj.Compressor;	
import org.usfirst.frc.team5676.robot.XboxController.Axis;
import org.usfirst.frc.team5676.robot.XboxController.buttons;
import org.usfirst.frc.team5676.robot.XboxController.triggers;


public class Robot extends IterativeRobot {
   
	RobotDrive myDrive; 
	Joystick driveStick; 
	//static XboxController gameStick = new XboxController(1);
	//DoubleSolenoid Piston; 
	
	//static Axis LeftStick=Global.driver.LeftStick;
	//static Axis RightStick=Global.driver.RightStick;
	//static triggers Triggers = Global.driver.Triggers;
	//static buttons DriverButtons = Global.driver.Buttons;
	//static buttons OperatorButtons = Global.operator.Buttons;
	//static int OperatorDpad = -1;
	
    public void robotInit() {
    	myDrive = new RobotDrive (1, 2, 3, 4);
    	driveStick = new Joystick(1); 
    }

    
    public void autonomousPeriodic() {

    }

    public void operatorControl() { 
    	while (isOperatorControl() && isEnabled()) { 
    		myDrive.arcadeDrive(driveStick);
    		Timer.delay(0.01);
    	}
    }
    public void teleopPeriodic() {
        
    }
/*    
    public void moveArm()
	{	 Piston = new DoubleSolenoid(0,1 );
		
		if(gameStick.button[0].get() == true) {
			
			Piston.set(DoubleSolenoid.Value.kForward);	
		
			System.out.println("'A' button is pressed: Piston moves forward");
		}
	  else if(gameStick.button[1].get() ==true)
		{
			Piston.set(DoubleSolenoid.Value.kReverse); 
	
			System.out.println("'B' button is pressed: Piston moves backward");
		}
		else
		{
			Piston.set(DoubleSolenoid.Value.kOff);		
		}
	}
    
    public void FrontArm()
   	{	 Piston = new DoubleSolenoid(2,3 );
   			
   		if(gameStick.button[2].get() == true) {
   			
   			Piston.set(DoubleSolenoid.Value.kForward);	
   			System.out.println("'X' button is pressed: Piston moves forward");
   		}
   	  else if(gameStick.button[3].get() ==true)
   		{
   			Piston.set(DoubleSolenoid.Value.kReverse); 
   			System.out.println("'Y' button is pressed: Piston moves backward");
   		}
   		else
   		{
   			Piston.set(DoubleSolenoid.Value.kOff);	
   		}
   	}

    
    public void pickerArm()
	{	 Piston = new DoubleSolenoid(4,5 );
		
		if(gameStick.button[4].get() == true) {
			
			Piston.set(DoubleSolenoid.Value.kForward);	
		
			System.out.println("LB' button is pressed: Piston moves forward");
		}
	  else if(gameStick.button[5].get() ==true)
		{
			Piston.set(DoubleSolenoid.Value.kReverse); 
			
			System.out.println("'RB' button is pressed: Piston moves backward");
		}
		else
		{
			Piston.set(DoubleSolenoid.Value.kOff);
		}
	}
    */
  
    public void testPeriodic() {
    
    }
    
}
Hmm... as I was making suggested comments, I noticed that you are using iterative Robot, but relying on operatorControl() to actually drive. I'm not sure if/how operatorControl() is used in IterativeRobot. Normally one would put that code in teleopPeriodic and not implement operatorControl()

Code:
   /*
    public void operatorControl() { 
    	while (isOperatorControl() && isEnabled()) { 
    		myDrive.arcadeDrive(driveStick);
    		Timer.delay(0.01);
    	}
    }
   */
    public void teleopPeriodic() {
          myDrive.arcadeDrive(driveStick); 
    }
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 00:41.

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