At a glance I can't see anything wrong with your code, but here are some suggestions
- If you lost communications, check your connection to the robot. Communications aren't typically dependant on the presence of robot code (although robot code that crashes very quickly combined with auto-restart causes some problems in roboRIO responsiveness from experience)
- If your robot code is crashing very quickly for some reason, the driverstation usually doesn't have a chance to grab the log. Instead, open up an SSH session (with PuTTY on Windows and ssh on Linux, or whatever client you prefer) to "roborio-3211-frc.local" (default username is admin; password is blank [so hit enter directly on the prompt]) and use
Code:
tail -f /home/lvuser/FRC_UserProgram.log
This might allow you to catch some stack trace you're not seeing
- Try using the debugger. It will probably trigger a breakpoint on any error, so this might also allow you to see if anything's causing a crash