The immediate problem is that "joystickAndXbox" is null at line 15 in OperatorControl.java, just like the stack trace says.
This seems impossible, because you definitely initialize it in robotInit(), which does get called.
EXCEPT, you have at least 3 joystickAndXbox fields as part of at least 3 instances of MainRobotFunctions:
- The one created by WPILib - your actual robot.
- In robotInit() another one is created.
- OperatorControl extends MainRobotFunctions, so it IS a kind of MainRobotFunctions too.
I think you just want access to the robot state in MainRobotFunctions from your other classes. Some ways to do that are:
- Pass a reference to the MainRobotFunctions to the constructors of your other classes, and store a copy in the class.
- Create a singleton MainRobotFunctions object in MainRobotFunctions, and have a public static getInstance() method that you csn call from anywhere to access it.