Thanks for your help
I haven't been able to test it out yet, but I am thinking that I fixed it. (Which of course means that it won't work

) What I did was just instead of creating all of the objects in init with new ClassName(); , I made static methods in each called getInstance(); That checks if it has already been initialized or not and if it hasn't, returns the object.
Figuring as I have not tested this out, I am curious about this :
Quote:
EXCEPT, you have at least 3 joystickAndXbox fields as part of at least 3 instances of MainRobotFunctions:
The one created by WPILib - your actual robot.
|
Maybe I'm just brain-dead, but I don't quite understand why that is true. I was not aware that WPILib created all of the objects. It seems to me that if that were at all true, EVERY object would be initialized twice (because of the robotInit() method)
And on your third point, I actually thought about that last night on how to call the methods or objects from our main program by just storing a reference in any class that will need to access it. Not difficult
Well since I have not tested, I just have a question of how this error actually occurs (even if the error is because of the nullpointerror I was curious)
Code:
protected final void startApp() throws MIDletStateChangeException {
boolean errorOnExit = false;
Watchdog.getInstance().setExpiration(0.1);
Watchdog.getInstance().setEnabled(false);
FRCControl.observeUserProgramStarting();
UsageReporting.report(UsageReporting.kResourceType_Language, UsageReporting.kLanguage_Java);
try {
this.startCompetition();
} catch (Throwable t) {
t.printStackTrace();
errorOnExit = true;
} finally {
// startCompetition never returns unless exception occurs....
System.err.println("WARNING: Robots don't quit!");
if (errorOnExit) {
System.err.println("---> The startCompetition() method (or methods called by it) should have handled the exception above.");
} else {
System.err.println("---> Unexpected return from startCompetition() method.");
}
}
}
That is the error I was encountering, in the RobotBase class. I assume it tries to run startCompetition() (which should loop forever) and if that gets interrupted goes into my error. Something must have been interrupting it, but are you sure it's a nullPointerException? That means somewhat unrelated. At least to me it does.
I'm curious, for all of you guys who have been doing this for a while now, is it normal to try and operate from the ground up, to increase efficiency ? Or maybe even just for the challenge. I was looking into the build scripts too, and since I am .xml illiterate, I really had no idea what kind of dependencies are going on between the build script and the FRC libraries. Yeah, well I just curious what the norm is out there, if you guys just take what's given to you or if you really go down to the deeper stuff. Even though I'm new to all of this, I love a good challenge. Maybe a next year thing.
