Go to Post 1. If I had a nickel for every time I heard "But we passed at XXXX regional" I would have retired a long time ago. - Al Skierkiewicz [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 11-03-2015, 20:21
seshaw415 seshaw415 is offline
Registered User
AKA: Seiji Shaw
FRC #6000 (Firehawk Robotics)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Los Angeles
Posts: 8
seshaw415 is an unknown quantity at this point
Unexpected Error when Running Robot Code

Hello,

After trying to clean up my code utilizing an IO class with static instances of all my objects, I am running into a few problems.

When I upload the robot code and enable, I get this error in the driver station:

Code:
ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4159.robot.IO.<clinit>(IO.java:15), org.usfirst.frc.team4159.robot.Robot.teleopInit(Robot.java:58), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:142), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:234)]
Here is the code referenced first in the error: (line 15 is the line is where OctoDrive is instantiated)

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

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.I2C;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.networktables.NetworkTable;

public class IO {
	public static Joystick leftStick = new Joystick(1);                           //Joystick Declaration
	public static Joystick rightStick = new Joystick(2);
	public static Joystick secondaryStick = new Joystick(3);
	
	private static DriveWheels wheelSet = new DriveWheels(0, 1, 2, 3);			  //Drivetrain Declarations
	private static DrivePistons pistonSet = new DrivePistons(0, 1, 2, 3);		  
	public static OctoDrive mainDrive = new OctoDrive(wheelSet, pistonSet);
	static {
		mainDrive.octoShift(true);
		mainDrive.invertMotor("rearRight", true);
    	mainDrive.invertMotor("frontRight", true);
    	mainDrive.invertMotor("leftSide", true);
	}
	
	public static ToteLifter elevator = new ToteLifter(4, 5);					  //ToteLifter Declarations
	public static DigitalInput lowLimit = new DigitalInput(8);
	public static DigitalInput highLimit = new DigitalInput(9);
	static {
		elevator.setHighLow(lowLimit, highLimit);
	}
	
	public static GyroManager mainGyro = new GyroManager(new gyroSampler          //Gyro Declaration
				(new GyroITG3200(I2C.Port.kOnboard)));
	
	
	public static NetworkTable imageValues;											  //RoboRealm NetworkTable Declaration
	static {
		imageValues = NetworkTable.getTable("");
	}
	public static DigitalInput toteSensor = new DigitalInput(10);
	
}

Is there something I am doing wrong here? All the people I am asking are saying that it looks fine.

Thanks in advance!
Reply With Quote
  #2   Spotlight this post!  
Unread 11-03-2015, 20:28
Ben Wolsieffer Ben Wolsieffer is offline
Dartmouth 2020
AKA: lopsided98
FRC #2084 (Robots by the C)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Manchester, MA (Hanover, NH)
Posts: 520
Ben Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud of
Re: Unexpected Error when Running Robot Code

Below the stack trace for the ExceptionInInitalizerError you should find another stack trace which will tell you the real error. There should be a line that had "caused by:" or something like that in it.

Posting that, along with the code for OctoDrive, would help. It looks like there is something wrong in the OctoDrive constructor.
__________________



2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
Reply With Quote
  #3   Spotlight this post!  
Unread 12-03-2015, 19:27
seshaw415 seshaw415 is offline
Registered User
AKA: Seiji Shaw
FRC #6000 (Firehawk Robotics)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Los Angeles
Posts: 8
seshaw415 is an unknown quantity at this point
Re: Unexpected Error when Running Robot Code

We actually figured out the problem with our IO class, which was something that could was not indicated in the stacktrace error. The static blocks were not running properly when we wanted to, so we made a quick fix...

Code:
private static DriveWheels wheelSet = new DriveWheels(0, 1, 2, 3);			  //Drivetrain Declarations
private static DrivePistons pistonSet = new DrivePistons(0, 1, 2, 3);		  
public static OctoDrive mainDrive = new OctoDrive(wheelSet, pistonSet)
        .octoShift(true)
	.invertMotor("rearRight", true)
        .invertMotor("frontRight", true) 
        .invertMotor("leftSide", true);
by method chaining!

Thanks for your help!
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 10:26.

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