which is printed every second or so into the driver station.
We have also tried simply deploying an empty robot project, and got these errors:
WARNING: Robots don't quit!
ERROR: Could not instantiate robot org.usfirst.frc.team449.robot.Robot!
The worst part is that it comes and goes for no apparent reason, in a setup that had worked before. Our roboRIO has the most recent roboRIO image and has the 1.8 JDK, and we tried power cycling the roboRIO and restarting the driver station. The diver station worked with another one of our roboRIOs with other code (although at one point it also had these errors that just disappeared for no apparent reason).
Anyone have any idea what might be going on?
My suggestion is trying to load on the sample robot code and seeing if your code is the problem. I assume that the difference between it working before and now is the changes you made to your code.
My suggestion is trying to load on the sample robot code and seeing if your code is the problem. I assume that the difference between it working before and now is the changes you made to your code.
So we did deploy the sample code that returned what is in the second code block in my first post. However, after we restarted the driver station and switched boards (to one with the same image and JDK), our code still threw the same errors, while the sample code stopped throwing errors. Not exactly sure what to infer from that.
One thing I remembered after searching ExceptionInInitializationError (which means that there was an error in a static initializer) was that previously we had sensors being initialized to the same port, but instead of seeing the exception stating that we had multiple sensors on the same ports, we saw this generic error. I double checked the code and removed all port overlaps I could find in our maps, but the error persisted.
Tomorrow I’ll try to catch the exceptions and print them and test this theory and post the results to this thread.
TL;DR
Exception handling in static init seems terrible, going to try and find the real error.
EDIT 2/6 2PM: Turns out there were exceptions thrown in the constructors of some of our subsystems that were initialized statically (since they were declared as final and therefore cannot be initialized in robotInit()). We didn’t notice they were there because of how static init exceptions are handled.
To solve this we will either make the variables not final and instantiate them in robotInit() or instantiate them in the constructor (since putting a try-catch block in every constructor is very cumbersome)