Our understanding is that:
- robotInit() is called only once per reboot/deploy (don't put any code in here that you want to run without rebooting the robot).
- disabled() is called when you transition between states.
- You can not execute any code in either of these methods which actuate devices on your robot. In other words, you can probably read sensors, but you can't drive motors or pneumatics.
When using the SimpleRobot framework, we typically implement robotInit() for the following purposes:
- Construct the various parts used in the robot (Talons, Relays, Counters, etc).
- Perform initialization tasks that only need to be done once per boot (initialize gyro, set up camera, etc).
- The addition of our own System.out.println() message so we can see that our deploy was successful and ready to run in the NetBeans console.
Often we don't implement our own version of disabled(), but when we do we use it for purposes that don't involve controlling motors or pneumatics. Sometimes we will update the smart dashboard for sensor readings (for example, if we want to see how accurate the gyro is, we can put the value to the smart dashboard and have a few kids pick up and rotate the robot a few revolutions while the robot is disabled).
We've found that the SimpleRobot framework is excellent for quickly creating small programs to test specific electrical components. As projects grow and become more complex, switching to the CommandBase frame work pays off in the end.