Look at the RIOlog in driverstation or VScode (or whatever IDE youâre using), it will tell you where the crash happened. This is called the âstacktraceâ and it will tell you what caused the code failure. If your code doesnât build, itâll tell you any uncaught exceptions (such as nullPointerExcpetion at [file and line#] or something like that. Itâs a lot to look at, but in general if you look for any red text in the output section of driverstation or your IDE, just above or below that is where you can find the error
I agree that the RobotContainer should not be static, but the reason they did that, I believe, was so that they could write code like this:
import static frc.robot.Robot.m_robotContainer;
public class shootingCommand extends CommandBase{
@Override
public void initialize() {
addRequirements(m_robotContainer.getShootingSubsys());
super.initialize();
}
The correct way to do this is to pass the subsystem to the constructor of the class and then store it in a member variable. I note in passing that, by convention, Java class names should always start with an upper case letter. Also, this isnât well-documented, but the requirements of a command are determined when it is scheduled, not after initialization, so the call to addRequirements also belongs in the constructor.
The problem here is that making RobotContainer static in this case is more than just bad style, itâs literally the cause of this crash: static members are created on class load, which (in this case) is before the HAL is initialized. Hence, crash.