Running the program on the robot
Once the program is finished and NetBeans is configured the program can be run very easily. There are a few things you should know about running the program immediately after flashing a new image onto the cRIO that are described here.
Running the program
Make sure the program is set as the main program, indicated in bold in the left pane (see instructions in the previous article). To run the program simply click on the green right-facing triangle. When you do this you'll see messages about the program building in the "Output" window (usually at the bottom of NetBeans). Then the robot reboots, and the program starts. These steps with their associated messages are shown below.
Getting ready to transfer the program to the robot
NetBeans verifies that there is a network interface on the development computer that is on the same subnet as the robot. In this case since we have set NetBeans and the robot to Team 190, then NetBeans notices that the development computer assigned IP address is 10.1.90.100 the same subnet as the robot (10.1.90.2).
Transfering the program to the robot
Rebooting the cRIO
It takes about 12 seconds before the cRIO has rebooted enough to start echoing status message in the NetBeans Output window. You can see the NetBeans plugin counting the time as the robot is rebooting. When it finally starts running again, the counting messages stop and are replaced by status messages.
Important: the first time you run a program after reimaging the cRIO you'll see the counting messages going on forever. This is because the OTA server (the robot code that handles rebooting the cRIO) hasn't yet started. It gets downloaded with the first program you try to run, but it only starts when the robot reboots. So if you just reimaged the cRIO you must manually reboot the robot manually the first time you run a program to get the OTA server started, then subsequent downloads with that image will work correctly. When you see the "Waiting for cRIO" messages going well past 12 seconds, manually reboot the robot and everything should start working properly after that.
Robot program is now running
After a number of status messages you should see an announcement from the OTA Server that it is running. You might also see some messages indicating that the "Default robotInit() method is running" and "Default disabled() method is running". This tells you that your program hasn't supplied your own implementation of these methods in the SimpleRobot main class. This is not important and would only be a problem if you thought that your program was overriding those built-in methods.
You can now test your robot program by enabling the robot in either teleop or autonomous modes using the Driver Station. You might see additional messages in this window if your program throws an exception or if you have some debug printing.
Caution: when testing a robot be sure that it is on blocks and the wheels are free to turn. This will prevent the robot from driving away from you in case there are programming errors.
If you've programmed a robot with this sample program it can be tested at this point. Set the robot in Teleop mode and verify that the joysticks control the motors. You can operate the left joystick and verify that pushing forward operates the left side motor(s) in the forward direction. If the left joystick operates the right motors then either the joysticks need to be swapped or the PWM cables going to the speed controllers. Pulling the joysticks back the motors should operate backwards. If the motor directions are reversed look for the setInvertedMotors() method on the RobotDrive class to invert the direction of one or more motors.
Verify that the autonomous program works by setting the robot into Autonomous mode and the robot should drive forwards for 2 seconds.