Java

The SF2 Java software library supports access to navX-MXP and navX-Micro.  Example programs are provided, demonstrating how to use the navX-MXP in a RoboRIO-based robot control application.

To use the library, you can download the latest build of the libraries, or you can checkout the source code with Git.  To learn more about the library, online help for the SF2 core and FRC-specific components is available.

Getting Started

Before getting started, ensure you have installed Eclipse and the latest WPI Library Plugins and the latest navX-MXP build or navX-Micro build.

An example SF2 Application is provided.  After running the setup program included in the latest build, the libraries and samples will be installed to the following location:

<HomeDirectory>\sf2\

For example, if your user name is Robot, the directory name will be C:\Users\Robot\sf2.

Java examples can be found within the “java\frc\examples” directory.  Select the example you wish to start with and import the sample project into the Eclipse IDE.

The SF2 Java Library itself will be installed to the WPI Library “user” directory at <HomeDirectory>\wpilib\user\java\lib.

Configuring Eclipse Java Library Paths

Next, a few small configuration changes must be made in order that the Java compiler can locate the SF2 library, and that this library will be included in the files that are downloaded to the RoboRIO:

1) Add a Java Build Variable for the SF2 Java Library.  To set the build variable, from the Eclipse menu select Window->Preferences->Java->Build Path->Classpath Variables, then click on the “New…” button.  Then, in the “New Variable Entry” dialog, set the name to “navx-mxp” and set the Path to <HomeDirectory>\wpilib\user\java\lib\sf2-frc.jar.  Hit OK to save this change.

Next Steps

Once the Eclipse Java application is configured to access the SF2 LabVIEW, the next step is modify the Java robot application to incorporate features like those in the Video Processing Latency Correction Example.