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.