Whenever we try to drive in teleop period we get the error below. We have the compressor unconnected thats why you see the can error. However, we try changing the code for driving either for arcade or tank apparently none of them works. What’s the problem? is it in our code or there is something else?
code:
public void _arcadeDrive(double j, double r){
drive.arcadeDrive(j, r);
}
Log:
ERROR 1 Unhandled exception: java.lang.NullPointerException org.usfirst.frc.team6593.robot.subsystems.DriveTrain._arcadedrive(DriveTrain.java:52)
Warning at edu.wpi.first.wpilibj.Notifier.lambda$new$1(Notifier.java:108): Robots should not quit, but yours did!
ERROR 1 The loopFunc() method (or methods called by it) should have handled the exception above. edu.wpi.first.wpilibj.Notifier.lambda$new$1(Notifier.java:109)
Did you initialize RobotMap.drive before copying its value to drive? We can’t see any scope here: are they even different things? You may have been copying the null value back into the variable.
I did that and it’s the same problem. It’s something to do with the DifferentialDrive. Here’s the code from the RobotMap that I wrote, this is not the exact copy of our RobotMap:
This is the error that keep on repeating itself when the enabled in teleop period.
ERROR 1 Unhandled exception: java.lang.NullPointerException org.usfirst.frc.team6593.robot.subsystems.DriveTrain._arcadeDrive(DriveTrain.java:46)
Warning at edu.wpi.first.wpilibj.Notifier.lambda$new$1(Notifier.java:108): Robots should not quit, but yours did!
ERROR 1 The loopFunc() method (or methods called by it) should have handled the exception above. edu.wpi.first.wpilibj.Notifier.lambda$new$1(Notifier.java:109)
RobotMap.init() has to be called in robotInit() in your main robot class, not in RobotMap
This will cause infinite recursion and throw a StackOverFlowError. This code will crash if you use it. You’re clearly not calling this method anywhere, otherwise your code would crash with a StackOverFlowError instead of a NullPointerException from attempting to use uninitialized variables.