Programming Support

This area contains resources related to programming. In some cases topics are programming language dependant.

This page is to support both our team, as well as others, with programming guides and resources. A lot of knowledge is available across the web and we hope to collect what we find useful here. If you have a reference we should add, please feel free to contact us!

eclipseThis tutorial provides step-by-step instructions on how to set up Eclipse and the necessary tools to get started programming your robot in Java. 

Note: This procedure was written for the 2012 FRC season, and updated for the 2013 season. While these steps haven't been revised for the 2014 season, they should work largely unmodified. There will likely be slightly different steps from year to year.

 

Our team prefers to use Eclipse as our development enviroment, the tutorial below reflects that. The officially supported development environment for FRC Java programming by FIRST is Netbeans. A detailed guide on setting up Netbeans for use with FRC can be found here.

 

This tutorial is written for use on a windows machine. Installation steps will be slightly different for other OSs, but should follow the same general steps.

Required Software:

  • Java JDK v6
  • Eclipse
  • Eclipse Plugins for FRC
 

Install the Java JDK

Download the Java SE 6 JDK, either 32 bit (x86) or 64 bit (x64), whichever your computer supports. when in doubt get the 32bit version.

Note, there are some issues with version 7 of the JDK during code deployment when run on Windows 7. Be sure to download version 6 to avoid any unnecessary headaches.

Install this package with the default options.

 

Install Eclipse

Download the latest version of Eclipse. I would suggest getting Eclipse IDE for Java Developers as it comes with the JDT and plugins you may need for collaborative code development. However, any version of Eclipse with the plugin JDT installed should work.

Make sure that your jdk and eclipse application are compatible, either both 32-bit or 64-bit. If they don't match, you'll run into a number of unhelpful error messages when trying to load eclipse.

The Eclipse program doesn't have an installer, what you download from Sun is just a zip with an executeable and its dependencies. I would recommend extracting the package to a location where you install your programs (such as "C:\Program Files\eclipse") and then creating a shortcut to the eclipse execuable for easy access later on.

 

Configure FRC Libraries

The following video walks you through setting up the environment. Please note this video was created prior to the 2013 season, and some items have changed. These are mostly minor differences, and the same general steps are still required to get up and running. The steps below the video reflect the appropriate actions which you should perform for the 2013 season.

Note: if you have previously installed an FRC plugin in eclipse it must be uninstalled. Do so from the Help > Install New Software. Click the "What is already installed?" link. After selecting the FRC plugins to uninstall, you should be prompted to restart Eclipse.

Installation steps
  • Make sure old FRC plugins are uninstalled (see instructions in the note above).
  • Set your JRE to the JDK we installed earlier
  • Window -> Preferences -> Java -> Installed JREs
    Add -> Standard VM -> Directory
    Choose the JDK you installed (e.g. C:\program files\Java\jdk1.6.0_35), Click OK
    Click Finish
    Check the box next to the jdk you just added in the list of installed JREs.
    Click OK
  • Create a new project (File -> New Java Project)
    Use a specific JRE -> select the jdk you installed
    Click OK
  • Download one of the project templates: SimpleRobot, IterativeRobot, CommandBasedRobot
    Or clone them from our github repository
  • If importing from a zip file (Note: the below steps are probably easier to follow in the video):
    Delete the "src" directory in the Java project you just created.
    File -> Import
    Select General -> Archive File
    Click Next
    Browse to the zip file you downloaded
    Select the project you created in the previour step in the "Into Folder" box.
    Click Finish 
    Drag the contents of the imported directory into the root of the project directory.
    Delete the "nbproject" directory
    Right click on the "src" directory. Click Build Path -> Use As Source Folder
    You should have errors in your code, because we haven't told eclipse where all the FRC libraries are. 
  • Download the sunspot FRC SDK (2014 version)
    Extract this zip file to your local computer (e.g. %HOMEPATH%)
  • There is a file withing the zip you just extracted that needs to be edited
    Open %HOMEPATH%/.sunspotfrc.properties in notepad
    Edit the first line, changing <USERNAME> to your username. This line should contain the  path to the sunspotfrcsdk directory when complete.
    Edit the second line to set the ip address of the crio. Replace XX.YY with  your team number (2168 = 10.21.68.2, 23 = 10.0.23.2, 766 = 10.7.66.2).
    Save the file 
  • Configure your build path:
    Right click on the project directory and select Build Path -> Configure Build Path
    Click the Libraries Tab
    Click Add External Jars
    Navigate to the directory you extracted the sunspotfrcsdk to earlier (e.g. %HOMEPATH%/sunspotfrcsdk/lib)
    Select wpilib.jar, squak.jar, and networktables-crio.jar
    Click OK 
    Code errors should all go away at this point if you completed this step correctly. 
  • Next we need to configure eclipse to be able to build our code.
    Run -> External Tools -> External Tools Configuration 
    Select "Ant build"
    Click the "New launch configuration" icon
    Name it "2013 Build"  
  • Set "Buildfile" to: ${workspace_loc:/${project_name}/build.xml}
    This will allow you to use this configuration to build any FRC project you have open.
  • Click the Targets tab
    Check the box next to "jar-app"
    Click Run
    You should see "BUILD SUCCESSFUL"
    If this fails, you probably dont have the .sunspotfrc.properties file (mentioned earlier) configured correctly. 
  • Next we will create a configuration that will deploy our code.
    Run -> External Tools -> External Tools Configuration 
    Select "Ant build"
    Click the "New launch configuration" icon
    Name it "2013 Delpoy+Run"
  • Set "Buildfile" to: ${workspace_loc:/${project_name}/build.xml}
  • Click the Targets tab
    Check the boxes next to "deploy" and "run" in that order
    Click Run
    You should see the code build and attempt to FTP into the IP address you defined in the previous step.
    If you dont have your local IP set correctly, or if you are not connected to a cRIO, this step will time out. 

 

Install FIRST Files

In addition to the above files, you should also install the FIRST provided files and updates if you plan on using your development laptop to configure your cRIO or to conenct to your robot via driverstation (you're probably going to want to use the driverstation at a minimum). Good instructions are available here.

 
 
 
 

Accessibility

Valid XHTML 1.0 Transitional  

See your web site through colorblind eyes with the colorblind web page filter.