RoboRIO crashes when I press programmed buttons

Hi, I just got our first PID subsystem to work with help from the previous thread but now that i have added in our other subsystems and commands, the robot crashes and gives an error whenever we start teleop. On the off chance that it does work only the buttons set for the PID commands function while the others cause crashes. One other thing I’ve noticed is that the compressor doesn’t even turn on. Please take a look at our code and see if you can find any issues. Thank you.

Code: https://github.com/Phred7/PIDArmTestsII/tree/master/src/org/usfirst/frc/team2906/robot

Errors:
ERROR Unhandled exception: java.lang.NullPointerException at
[org.usfirst.frc.team2906.robot.subsystems.Wheels.ballIn(Wheels.java:29),
org.usfirst.frc.team2906.robot.commands.BallIn.execute(BallIn.java:20),
edu.wpi.first.wpilibj.command.Command.run(Command.java:243),
edu.wpi.first.wpilibj.command.Scheduler.run(Scheduler.java:206),
org.usfirst.frc.team2906.robot.Robot.teleopPeriodic(Robot.java:89),
edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:130),
edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:247)]

ERROR Unhandled exception: java.lang.NullPointerException at
[org.usfirst.frc.team2906.robot.subsystems.DriveTrain.arcadeDrive(DriveTrain.java:22),
org.usfirst.frc.team2906.robot.subsystems.DriveTrain.driveWithJoysicks(DriveTrain.java:30),
org.usfirst.frc.team2906.robot.commands.DriveJoys.execute(DriveJoys.java:22),
edu.wpi.first.wpilibj.command.Command.run(Command.java:243),
edu.wpi.first.wpilibj.command.Scheduler.run(Scheduler.java:206),
org.usfirst.frc.team2906.robot.Robot.teleopPeriodic(Robot.java:89),
edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:130),
edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:247)]
WARNING: Robots don’t quit!

1 Like

You need to call RobotMap.init() before being able to use anything in it. Calling RobotMap.init() at the beginning of Robot.robotInit() should fix your problem.

Thank you! That fixed the issue.