|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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)] 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() {
}
}
|
|
#2
|
|||
|
|||
|
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... |
|
#3
|
|||
|
|||
|
Re: Build Errors
At first thank you, well we are a complete rookie team. Oke what exactly would that do?
|
|
#4
|
||||
|
||||
|
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. |
|
#5
|
||||
|
||||
|
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)] |
|
#6
|
|||
|
|||
|
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...
|
|
#7
|
|||
|
|||
|
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???
|
|
#8
|
||||
|
||||
|
Re: Build Errors
When you put your code on the robot, does it work now?
|
|
#9
|
|||
|
|||
|
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...
|
|
#10
|
|||
|
|||
|
Quote:
|
|
#11
|
|||
|
|||
|
Re: Build Errors
oke I will. Its just weird because it was working yesterday.....
|
|
#12
|
|||
|
|||
|
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...
|
|
#13
|
|||
|
|||
|
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() {
}
}
Code:
/*
public void operatorControl() {
while (isOperatorControl() && isEnabled()) {
myDrive.arcadeDrive(driveStick);
Timer.delay(0.01);
}
}
*/
public void teleopPeriodic() {
myDrive.arcadeDrive(driveStick);
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|