Using Java to program the RoboRIO in 2015

Last year Team 4931 used Java to program the cRIO, and it worked great. All of our codebase is on GitHub, where the “CompetitionRobot” project is the program we used for competition. (There are several other projects, but most just show different styles of programming the robot.)

In 2014 we used Java 6 or 7, Eclipse Kepler, GitHub, Git, and Ant; see our instructions for setting up the tooling and the steps we used throughout development to branch, commit, and create/review/merge pull-requests to coordinate the changes to the code. Here’s a presentation that covers the concepts of Java development and how to use Git and GitHub:

We expect much of this to be similar for 2015, though we expect a number of changes:

  • Java 8 – Note that any code developed using Java language features introduced in Java 1.4 or later will not be deployable to a cRIO. We think the many(!) features in Java 8 are worth having RoboRIO-specific code, and we’re diving in headfirst.
  • Eclipse Luna with FRC plugins – Instructions should be released by FIRST on (or hopefully slightly before) kickoff.
  • Git – Be sure to use the latest version that fixes the security vulnerability announced on Dec 19.
  • GitHub – This is unchanged, though we’ll be using a different repository
  • Ant – We anticipate that the FRC plugins will still use Ant under the covers, so we install the latest and plan to augment the build file so we can run JUnit tests.
  • RoboRIO – There are a lot of changes here, nicely summarized by Team 2168. For example, it looks like we should be able to SSH and FTP into the RoboRIO to access files, install software, and more. The RoboRIO also includes a web server, which will be important to clear sticky faults and to adjust the CAN parameters. There’s also mDNS, which should make it easier to connect from development machines, since everything can use DHCP as normal. We’ll still probably use a few static IP addresses for specific devices, like onboard cameras.

For the most part, we’ll probably continue with everything we did last year, including using command-style code. We may use some Java 8 features in our code, but since the WPILib doesn’t really use any of these features (like lambdas, functional interfaces, collection streams, etc.) we’ll be limited to using them in our codebase. We’re definitely going to use collections and enums, though.

We do plan on making a lot of changes to make the whole codebase as testable as possible, especially off-robot. We also hope to build a real-time data collection system so we can monitor and record the performance metrics of the robot in real time.

We’ll provide an update when FIRST releases the instructions for the Eclipse plugins.