Hi! I have been working on my java robot code. It is Object Oriented, and I am using the Smart Dashboard for a GUI. I have tried to simulate the Robot Code, but I keep getting an error message that there is a Null Pointer Exception. I have set the Sendable chooser, which is what is giving me the error, to have a default option, but the error continues. The error message is
Error at frc.robot.Subsystems.GUI.getDrivingType(GUI.java:118): Unhandled exception: java.lang.NullPointerException
at frc.robot.Subsystems.GUI.getDrivingType(GUI.java:118)
at frc.robot.Subsystems.GUI.sayCurrentCommand(GUI.java:122)
at frc.robot.Robot.robotPeriodic(Robot.java:47)
at edu.wpi.first.wpilibj.IterativeRobotBase.loopFunc(IterativeRobotBase.java:328)
at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:131)
at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:373)
at edu.wpi.first.wpilibj.RobotBase.lambda$startRobot$0(RobotBase.java:443)
at java.base/java.lang.Thread.run(Thread.java:829)
I have attached the source code below, and if anyone could tell me what is going wrong, and why the vs code says that there is a null pointer exception when I have set a default option, that would be ever so helpful. Thank you!
example.txt (221 Bytes) SwitchDrive.java (2.7 KB) Main.java (775 Bytes) Robot.java (2.7 KB) DriveTrain.java (1.4 KB) GUI.java (5.0 KB) Gyroscope.java (1.0 KB) OI.java (504 Bytes) PixyCam.java (595 Bytes) RobotMap.java (718 Bytes) Voltage.java (961 Bytes)