VS Code isn't finding any errors, but Driver Station is immediately disabling my Teleop

My robotics team just made a new drive train for our 2022 season. It has four motors, and we are using 4 Victor SPX speed controllers. All of these speed controllers are updated with the 2022 season firmware. I have made a DriveTrain class, a class to get data from the controller we are using, and a very simple class to make our robot drive like a tank (TankDrive) along with Robot.java and Main.java. All of this code successfully builds and deploys in VS Code. I open up my Driver Station, I see that I have good communications, a controller, and robot code on my robot. I can enable autonomous, practice, test. However, when I enable teleop it works for about 1 second, and then it disables teleop. Does anyone know what is going on? I am stuck because VS Code isn’t finding any errors because it is building and deploying successfully.

Does your driver station print anything when you enable and it automatically disables, it would usually print the location and line of number of what crashed, I would also double check all hardware on your robot is updated such pdp, roborio, radio, motorcontrollers, encoders etc.

Compiling only throws compilation errors, but won’t catch runtime errors. Examples of runtime exceptions might be accessing an array index outside the bounds of the array, or dividing by zero, though there’s a near infinite supply of other causes.

Can you share your code? Also, as @mohd mentioned, providing the actual error output (if there is any) would be beneficial.

1 Like

I do not have the robot currently in front of me, I can get the message at the start of next week, but I do remember a little bit. It said that startCompetition() method or methods using it would have help, but I tried this and nothing worked. I remember that it also said something like warning at edu.first.wpilib. (lots of other stuff) and then it talked about an iterative robot base. I’m sorry that I can’t get the exact message since I do not have the bot.

Take a look at this, it can help you isolate your problem once you get the stacktrace:

1 Like

And the most likely culprit, the NullPointerException.

1 Like

Have you tried running your code in simulation? You probably don’t need your robot to reproduce the crash.

How can you use driver station in a simulation without the robot? I have never done that before, but it would be a great tool.

Put your code in Github and post a link here, we can take a look to help you as well.