Frequently Asked Questions

How does one use the navX-Sensor Android library?

Android Library (FTC)

android2

NOTE: The 2016 Version of the navX-Micro Android Library for FTC is tested with the current 2016 version of the “ftc_app” library.

The navx_ftc Android software library supports access to navX-Model devices via the I2C communication interface. Several example programs are provided, demonstrating how to use a navX-Model device in a FTC-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 is available.

Getting Started

Before getting started, ensure you have installed Android Studio and the latest FTC Robot Controller Application (“ftc_app”) package.

Several sample Java Robot Applications are provided. After running the setup program included in the latest build, the libraries and samples will be installed to the following location:

\navx-micro\android
For example, if your user name is Robot, the directory name will be C:\Users\Robot\navx-micro\android.

Within this directory, the “examples” sub-directory contains several example programs. Select the example you wish to start with and copy it into your project as follows:

  • Copy one or more of the example navX-Model “op modes” files from the \navx-micro\android\examples directory into your project’s “TeamCode” top-level directory. (i.e., org.firstinspires.ftc.teamcode).
Next, several configuration changes must be made in order that the Android Studio ftc_app-based project can locate the navx_ftc library:

  • Modify the op mode example file to change the following line near the top of the file to match the I2C port on the Core Device Interface Module to which you have connected the navX-Model device:
    private final int NAVX_DIM_I2C_PORT = 0; /* See the installation page for details on port numbering. */
    	
  • Modify your robot application’s (the “TeamCode” project) build.release.gradle file repository list to add a reference the directory where the navx_ftc library is installed:
    repositories {
        flatDir {
            dirs 'libs', 'C:\\Users\\Robot\\navx-micro\\android\\libs'
        }
    }
    	
  • Again in the same build.release.gradle file, add the navx_ftc library to the list of libraries the ftc_app will link to – by adding this line near the bottom of the gradle build file, in the dependencies section:
    dependencies {
      ...
      compile (name:'navx_ftc-release', ext:'aar')
    }
    	

Last Updated 7 years ago

Please Wait!

Please wait... it will take a second!