When we (the programmers) try to run our robot’s Java code, it waits for a few seconds, then the program crashes. Can anybody help us with this? Any help is greatly appreciated!!
That thread may be useful to you. It seems like since the DS is printing a NullPointerException that something in your code is being referenced before initialization, specifically, during the period that the robot code is trying to start.
Sorry I forgot to paste my code in; I was in such a hurry I guess I forgot. Here it is: https://pastebin.com/kX8LdUTg
Mitch Stokes, it crashes a few seconds after hitting ‘enable’ in the Driver Station. Here’s the process: I deploy the error-free code; the driver station looks good to go; then I hit enable; I can’t drive the robot at all; then like 2 seconds later, it crashes and puts it back to disabled.
This sounds like a null pointer being called in either TeleopInit or TeleopPeriodic since the error comes when you enable in the teleoperated mode. Check all of your calls in those two methods to ensure they’re not referencing variables/objects that don’t exist.
That would be the problem (provided there’s not any other classes that modify speed). However, it is worth noting that the null pointer he/she is seeing isn’t from using an empty string (""), it’s from using a string with no value. That isn’t to say that using an empty string on the SmartDashboard wouldn’t throw a NullPointer or other exception, just that this specific null pointer is thrown by trying to access the value of a non-initialized field.
So what should I do? I tried looking and changing some things but it still doesn’t work. I really need some help and fast as we have to demonstrate our robot tomorrow.
The variable speed is still not being assigned after being declared on line 40. It is however still being used with the SmartDashboard on line 97. Likley throwing the NullPointer Error.