In Robot.java, DriveTrain is constructed, and then DriveJoystickCommand is constructed. It needs to be in that order because DriveJoystickCommand requires DriveTrain in the constructor. But I'm not sure whether setting the default command actually works, since it's null at the time of construction. Ostensibly, WPILib knows about this problem and that's why they have the initDefaultCommand() method (which is called later, maybe. It's 11pm and I'm not willing to browse the WPILib source right now 😴) instead of simply making teams do it in the constructor. This will need to be tested though.
In Robot.java, DriveTrain is constructed, and then DriveJoystickCommand is constructed. It needs to be in that order because DriveJoystickCommand requires DriveTrain in the constructor. But I'm not sure whether setting the default command actually works, since it's null at the time of construction. Ostensibly, WPILib knows about this problem and that's why they have the initDefaultCommand() method (which is called later, maybe. It's 11pm and I'm not willing to browse the WPILib source right now 😴) instead of simply making teams do it in the constructor. This will need to be tested though.