After the initial 10 seconds of the game, the robot is now controlled by us, the human players. The basic drive code allows us to control the robot with two joysticks, making it drive forward, backwards, turn, and accelerate/decelerate. The robot can be driven with either one or two joysticks.
BasicDrive allows us to use the joysticks to drive the robot.The Joystick class is used to get input from two joysticks that are connected to the Driver Station.The RobotDrive class is used to handle basic driving for the robot.
The SimpleRobot class knows the standard states for the FRC - disabled, autonomous, and operator control - and allows us to code for certain things to happen in specific states. In the case of the BasicDrive, we want the code to run only when the robot is enabled and is in operator control.
The Watchdog is designed as a safety mechanism; in the case that a program breaks, it will not feed the Watchdog. This signals to the Watchdog to shut the motors down, making it important to remember to feed the Watchdog.
The second step is to tell what kind of drive the robot will be driving in - arcade drive (which uses one joystick) or tank drive (which uses two), and states which joysticks will be involved in the steering process.
To check if the code is working, you can display the numbers returned when the joystick is moved to see if moving the joystick will actually cause a change. Pushing the joystick forward all the way results in the display of "1" while slowly pulling it back to original position will cause a decrease in the number until it reaches zero. Pulling the joystick back will result in negative numbers until "-1" where the joystick has reached its backwards limit.