Go to Post I hope you realize that by starting this thread you have earned yourself a permanent place at the "WOEWITWISTFT" ("What On Earth Was I Thinking When I Started THAT FIRST Trend?") table. It's members are few, but the conversation is the most honest and amusing in the entire place. ;) - Jessica Boucher [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 22-01-2016, 17:13
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Extremely Broken Code Please Help!

I have no idea why the issue with this program escapes me. I have been looking at it for days with no headway. Maybe a new set of eyes can see the problem. The program is simple. It uses my XBox class to control a four motor arcade drive system using one of the joysticks on the controller. Some buttons then control a couple accessory motors.

Here is the code: https://github.com/FranklinMarquette/Robot2016

Here is what the driver station says when I try to enable the robot:

Quote:
ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 3), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]
The whole thing compiles and uploads just fine but fails at run-time.

Thanks so much,
Franklin
Reply With Quote
  #2   Spotlight this post!  
Unread 22-01-2016, 17:36
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Extremely Broken Code Please Help!

So I notice code breaks here and the motor1Stop class has
Code:
public static Motor1 motor = new Motor1();
while the motor1Move class does not. Try removing this?
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #3   Spotlight this post!  
Unread 23-01-2016, 13:34
kgross kgross is offline
Registered User
no team
 
Join Date: Jan 2016
Location: Idaho
Posts: 1
kgross is an unknown quantity at this point
Re: Extremely Broken Code Please Help!

Not sure what is causing your error yet, but it sounds like an undefined pointer.

But you should move a few lines around in your Motor1 and Motor2 classes. Right now you have the instantiation of the SpeedController above your constructor.


SpeedController motor = new Victor(4);

public Motor1() {


}

change it to.
Private SpeedController motor;
public Motor1(){
motor = new Victor(4);
}
Reply With Quote
  #4   Spotlight this post!  
Unread 25-01-2016, 16:46
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Re: Extremely Broken Code Please Help!

Okay so I applied those changes and have updated the code here:

https://github.com/FranklinMarquette/Robot2016

And it returns this error:

Quote:
ERROR Unhandled exception: java.lang.IllegalArgumentException: Subsystem must not be null. at [edu.wpi.first.wpilibj.command.Command.requires(Com mand.java:194), org.usfirst.frc.team4623.robot.commands.Extend.<in it>(Extend.java:16), org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 6), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:44), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]
Thanks for the help
Reply With Quote
  #5   Spotlight this post!  
Unread 25-01-2016, 19:23
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Extremely Broken Code Please Help!

Just a quick question. Are you reading the errors or just posting them here? It's ok if you are because they aren't the most lovely things to read (though you should try. It'll be much faster) What it's giving you is what's called a stack trace. It basically tells you the path the code took before it got an error. I've added a comment on what the error tells you.

Code:
ERROR Unhandled exception: java.lang.IllegalArgumentException: Subsystem must not be null. at [
edu.wpi.first.wpilibj.command.Command.requires(Com mand.java:194),  #6
org.usfirst.frc.team4623.robot.commands.Extend.<in it>(Extend.java:16), #5
^------------This is the file-------------------------^---------------Line #- ^
org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 6), #4
org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:44), #3
du.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), #2
edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)] #1
So you start at the bottom and read up. Notice how it goes to robotInit at #3, then goes into OI at 4, then to the Extend class. At Line 16 (note my comment in the code) is where the error is. Looking at line 16 in the code shows

Code:
requires(Robot.pnue);
Looking in the Robot class I can see pneu, but the problem is it's initialized AFTER OI. So OI is looking for a null object, hence the error. Try putting OI after everything.
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP

Last edited by TimTheGreat : 25-01-2016 at 20:25.
Reply With Quote
  #6   Spotlight this post!  
Unread 25-01-2016, 20:29
twiggzee twiggzee is offline
Registered User
FRC #3502 (Octo-(PI)-Rates)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2011
Location: Tallahassee, FL
Posts: 55
twiggzee is an unknown quantity at this point
Re: Extremely Broken Code Please Help!

I'm having the same problem. Compiles just fine but red light on driver station robot code.

When I comment out everything in public OI{}, I get green light on driver station robot code. But why??

TimTheGreat: What do you mean by "Try putting OI after everything"?

Thanks for your reply!
__________________
Wendy
Team 3502
Reply With Quote
  #7   Spotlight this post!  
Unread 25-01-2016, 20:39
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Extremely Broken Code Please Help!

Quote:
Originally Posted by twiggzee View Post
I'm having the same problem. Compiles just fine but red light on driver station robot code.

When I comment out everything in public OI{}, I get green light on driver station robot code. But why??

TimTheGreat: What do you mean by "Try putting OI after everything"?

Thanks for your reply!
So in LFRobotics' code he has

Code:
        oi = new OI();
        pnue = new Pnuematics();
The problem is when you create a new OI object, it looks for robot.pneu. But as you can see pneu hasn't been created because it is after new OI(). So put new OI below the creation of everything else (in this case swap them).
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #8   Spotlight this post!  
Unread 25-01-2016, 22:50
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Re: Extremely Broken Code Please Help!

Okay that makes perfect sense. I did trace it back and could deduct that it had something to do with the extend class but never thought of movie the onus constructor

Thanks
Reply With Quote
  #9   Spotlight this post!  
Unread 26-01-2016, 17:43
twiggzee twiggzee is offline
Registered User
FRC #3502 (Octo-(PI)-Rates)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2011
Location: Tallahassee, FL
Posts: 55
twiggzee is an unknown quantity at this point
Re: Extremely Broken Code Please Help!

Yes! That worked! Thanks so much, TimTheGreat!!!
__________________
Wendy
Team 3502
Reply With Quote
  #10   Spotlight this post!  
Unread 26-01-2016, 22:39
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Extremely Broken Code Please Help!

Quote:
Originally Posted by twiggzee View Post
Yes! That worked! Thanks so much, TimTheGreat!!!
Glad I could help
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #11   Spotlight this post!  
Unread 27-01-2016, 17:08
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Re: Extremely Broken Code Please Help!

Okay so moving that fixed it. Now the pnuematics are not working.

What does this error mean?

Quote:
ERROR Unhandled exception: edu.wpi.first.wpilibj.util.AllocationException: Solenoid channel 1 on module 0 is already allocated at [edu.wpi.first.wpilibj.DoubleSolenoid.initSolenoid( DoubleSolenoid.java:54), edu.wpi.first.wpilibj.DoubleSolenoid.<init>(Double Solenoid.java:81), org.usfirst.frc.team4623.robot.commands.Retract.<i nit>(Retract.java:12), org.usfirst.frc.team4623.robot.OI.<init>(OI.java:5 7), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:241)]
I have tried moving stuff around and changing simple things but it keeps throwing the same error.

Thanks again,
Franklin
Reply With Quote
  #12   Spotlight this post!  
Unread 27-01-2016, 17:21
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Extremely Broken Code Please Help!

Is your code up to date in the github repo?

PS: A good way of reaching me is on the Freenode IRC channel #robotpy. If you're on then you can have quick discussion which is a lot faster than CD
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP

Last edited by TimTheGreat : 27-01-2016 at 17:24.
Reply With Quote
  #13   Spotlight this post!  
Unread 27-01-2016, 21:45
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
That's not what I changed it to today but that code threw the same error - the ports for the double solenoid are 0 and 1
Reply With Quote
  #14   Spotlight this post!  
Unread 27-01-2016, 22:05
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Extremely Broken Code Please Help!

Quote:
Originally Posted by LFRobotics View Post
That's not what I changed it to today but that code threw the same error - the ports for the double solenoid are 0 and 1

Ok I think the problem is when you call the retract command you create a new solenoid on ports 0 and 1. Don't do this. If you call the retract command more than once (or call the extend command once) then you can't call it again because it tries to create a new solenoid. Create the solenoid somewhere and pass it to the command.
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
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:51.

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