|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Unhandled exception instantiating robot - Code Not Showing on driver station
Our code deploys just fine (and simple robot code will run and we can drive the robot) but our current code deploys successfully, but the driver station does not recognize it and says we have no code. it also gives as this error:
ERROR Unhandled exception instantiating robot org.usfirst.frc.team5340.robot.Robot java.lang.ExceptionInInitializerError at [org.usfirst.frc.team5340.robot.Robot.<clinit>(Robo t.java:23), java.lang.Class.forName0(Native Method), java.lang.Class.forName(Class.java:259), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:197)] Please Help! |
|
#2
|
||||
|
||||
|
Re: Unhandled exception instantiating robot - Code Not Showing on driver station
I actually debugged this exact problem last night. For us, it was caused by attempting to two motor controllers on the same PWM channel. Pretty terrible error message.
What I think is happening is RobotBase attempts to load the Robot class by looking it up by name. The Robot class doesn't exist though because a runtime error occurred during its creation (in our case attempting to open two controllers on the same port number). I cant check your source code right now, on my phone, but I would start by checking all the port numbers for your hardware iare unique. |
|
#3
|
|||||
|
|||||
|
Re: Unhandled exception instantiating robot - Code Not Showing on driver station
The one thing that I don't like about the new system is that it is much harder to debug code exceptions. The errors you get aren't really helpful.
We had this same error, it turned out to be that we were trying to instantiate our OI class prior to our subsystems. |
|
#4
|
||||
|
||||
|
Re: Unhandled exception instantiating robot - Code Not Showing on driver station
Looking at your Robot.java. it looks like you are accessing accessing subsystems that are stored within the OI class?
You also never actually initialize your oi variable. So if you're likely running into dependency issues which are causing runtime errors. Instantiate your subsystems within the Robot class. Instantiate oi in robotInit(), then instantiate any commands after this. If you need an example of how drivetrain code should be laid out in a command base robot project, there's a foot example here from team 3019: https://github.com/fauge7/Firebird-R...team3019/robot Last edited by otherguy : 21-01-2015 at 09:55. Reason: added link to example code |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|