2017 FRC Control SystemFRC Java Programming Creating and Running Robot ProgramsBuilding and downloading a robot project to the roboRIO

Building and downloading a robot project to the roboRIO

There are two ways of running programs onto the roboRIO. You can

  1. Attach to the roboRIO and run the program using the debugger from your development system OR
  2. Load it onto the roboRIO flash drive so it will run on reboot.

For tournaments you should always download the program so that it will be there when the robot is restarted and the match is played. This article will cover loading the program onto the roboRIO to run on reboot. The next article will cover the debugger.

Building a robot program

The first step to getting the program on the roboRIO is to build the code. This will compile and link the project files. If you have set the option to build automatically as recommended in the Eclipse installation article, this step is done each time you save a file in the project. If not, this step will be done when you start the deploy process.

Loading a program to run on robot startup

Loading a program to run on robot startup

To have the program run automatically each time the roboRIO boots, it must be loaded in the roboRIO flash memory. For tournaments you should always download the program so that it will be there when the robot is restarted and the match is played. To do this:

  1. Right click on the project in the Project Explorer
  2. Select "Run As"
  3. Select "WPILib Java Deploy"

The deployment process will then begin and start outputting status information to the Console (generally located in the bottom center or bottom right of the window). After the program is downloaded it will be immediately launched, there is no need to reboot the roboRIO.

Program Download Process

After you click the WPILib Java Deploy button the deploy process will proceed through a number of steps.

Clean

Clean

The deploy process runs a "clean" each time it is run. This is needed to work around a bug in Ant that causes changes to static final constants to not always be picked up by the build.

Compile & Jar

Next the code is compiled and packed up into a jar file.

Get Target IP

In this step, the plugin determines the IP of the roboRIO. The plugin will try to reach the roboRIO via the following methods, in order:

  1. mDNS (roboRIO-TEAM-FRC.local where TEAM is your team number)
  2. DNS (roboRIO-TEAM-FRC.lan where TEAM is your team number)
  3. USB static IP (172.22.11.2)
  4. Ethernet static IP (10.TE.AM.2)

If the roboRIO is accessible via any of these methods, the deploy will proceed using that address as the target. If the roboRIO cannot be found using any of these methods, the deploy will abort. See Connection Failure in the Troubleshooting section below.

Dependencies

Dependencies

The dependencies section checks that the roboRIO contains any dependencies necessary for operation. For Java at this time, this consists of two components:

  1. Check of the roboRIO image version. If the validation succeeds you will get a message that the version was validated and the deploy will proceed. If the check fails, you will see a message indicating the allowed image version for this version of the plugins, see Image Check Failure under Troubleshooting below for more details.
  2. Check that the JRE is installed on the roboRIO. If this check fails, you need to install the JRE as described in Installing Java 8 on the RoboRIO (Java only).

Copy and Start code

The remaining parts of the deploy then proceed as follows:

  1. Copy user program and robotCommand file. The robotCommand file tells the framework that launches the code what to launch (C++ vs. Java and Debug vs deploy).
  2. Start code. The plugin calls a script file which kills the existing user program, then restarts the LabVIEW RT process. This starts the code in the same way it will be launched when the roboRIO is booted.

Deployed Code

There is no need to reboot the roboRIO to run the new code, it will begin running automatically. After the deploy completes, each time the roboRIO is rebooted it will run the deployed code until new code (from any FRC language) is downloaded.

Viewing program output

The console output from the program does not appear in the regular Eclipse console. To view the console output (System.out statements as well as WPILib output) see the next article, Using Riolog to view console output.

Next Steps

To continue Getting Started with the Control System, see Programming your radio for home use

To continue reading about Java, scroll down and click Next to read about Using Riolog to view console output.

Troubleshooting

This section contains troubleshooting steps for commonly encountered issues.

Javac invalid target or Javac not found

If you see an error that says "javac: invalid target release" or "unable to find a javac compiler" your JDK is not configured properly in Eclipse. Make sure you have installed a JDK and configured Eclipse to use that JDK as described in the Installing Eclipse document.

Build Failure

A "Compile failed" error as shown above indicates a failure building the code. The lines that start with "javac" will indicate the source of the error (a missing semicolon on line 37 of Robot.java in the example above).

Connection Failure

If the deploy process fails to connect to the roboRIO:

  • First verify that the roboRIO is powered on, connected to the PC and that the roboRIO is imaged and that your team number is set properly in Eclipse (Window->Preferences->WPILib Preferences).
  • The next step is to verify that your computer networking is configured in a way it can communicate with the roboRIO. Visit the roboRIO Network Troubleshooting document in the Troubleshooting section for more details.
  • Check that your firewall is disabled or that an exception has been added for Eclipse. For the Windows Firewall, see Configuring Windows Firewall in the Troubleshooting section for more details.

Image Check Failure

If the Image Check fails that means that the Image version on your roboRIO did not match the image version that the plugins were built against. To check for updates to the Eclipse plugins, make sure you installed the plugins from the web repository and that you have an active internet connection, then click Help->Check For Updates. To check for updates to the NI FRC Update Suite, which may contain a new roboRIO image, visit the URL from the Installing the FRC 2017 Update Suite (All Languages) document. If an updated version is available, after installing it as described in that document, re-image your roboRIO using the instructions in the Imaging your roboRIO document.

0 Report Errors

Use this form to report any errors with the documentation. For help with WPILib, please use the FIRST Forums at http://forums.usfirst.org For reporting WPILib bugs, please submit an issue on GitHub at https://github.com/wpilibsuite/allwpilib/issues/new

Ignore