Class NavxJNI


public final class NavxJNI extends StudicaJNIWrapper
Raw JNI bindings for the NavX3 driver. Use Navx instead.

Create methods return a positive handle, or a negative status code on failure. Other methods return a status code (0 on success) unless noted.

  • Nested Class Summary

    Nested classes/interfaces inherited from class StudicaJNIWrapper

    StudicaJNIWrapper.Helper
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Index of continuous angle, degrees.
    static final int
    Index of angular velocity (3 values: x y z), rad/s.
    static final int
    Index of the at-rest flag (0 or 1).
    static final int
    Minimum length of the array passed to getData().
    static final int
    Index of the gyro bias estimate (3 values: x y z).
    static final int
    Index of linear acceleration (3 values: x y z), m/s^2.
    static final int
    Index of the magnetic field (4 values: x y z norm), microtesla.
    static final int
    Index of the candidate magnetic dip angle.
    static final int
    Index of the candidate magnetic field magnitude.
    static final int
    Index of the reference magnetic dip angle.
    static final int
    Index of the reference magnetic field magnitude.
    static final int
    Index of the magnetometer-undisturbed flag (0 or 1).
    static final int
    Index of pitch, degrees.
    static final int
    Index of the 6-axis quaternion (4 values: w x y z).
    static final int
    Index of the 9-axis quaternion (4 values: w x y z).
    static final int
    Index of roll, degrees.
    static final int
    Index of the temperature, Celsius.
    static final int
    Index of 1 if TIMESTAMP_NS is the measurement time, else 0.
    static final int
    Index of the newest sample's robot time, nanoseconds (see STUDICA_NavxData).
    static final int
    For createUsb: the NavX3 on any USB port.
    static final int
    Index of yaw, degrees.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    createCan(int busId, int deviceId, int updateRateHz)
    Opens a NavX3 on CAN.
    static int
    createSerial(String devicePath, int updateRateHz)
    Opens a NavX3 on a serial device path.
    static int
    createUsb(int usbPort, int updateRateHz)
    Opens a NavX3 on USB.
    static void
    destroy(int handle)
    Closes a device.
    static int
    enableMessages(int handle, int mask)
    Chooses which message groups stream.
    static int
    getData(int handle, double[] out)
    Fills out (at least DATA_SIZE long) with the latest data.
    static int
    getFirmwareVersion(int handle, int[] out)
    Reads the firmware version.
    static int
    getSensorUuid(int handle, int[] out)
    Reads the 96-bit sensor ID.
    static boolean
    isConnected(int handle)
    Returns whether data arrived recently.
    static int
    resetYaw(int handle)
    Resets yaw to zero.
    static int
    selfTest(int handle, int[] out)
    Runs the IMU self test.
    static int
    setOutputRate(int handle, int hz)
    Sets the output data rate.
    static int
    setYawAxes(int handle, int axes)
    Selects 6-axis or 9-axis yaw.

    Methods inherited from class StudicaJNIWrapper

    forceLoad

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • YAW

      public static final int YAW
      Index of yaw, degrees.
      See Also:
    • PITCH

      public static final int PITCH
      Index of pitch, degrees.
      See Also:
    • ROLL

      public static final int ROLL
      Index of roll, degrees.
      See Also:
    • ANGLE

      public static final int ANGLE
      Index of continuous angle, degrees.
      See Also:
    • QUAT6

      public static final int QUAT6
      Index of the 6-axis quaternion (4 values: w x y z).
      See Also:
    • QUAT9

      public static final int QUAT9
      Index of the 9-axis quaternion (4 values: w x y z).
      See Also:
    • ANGULAR_VEL

      public static final int ANGULAR_VEL
      Index of angular velocity (3 values: x y z), rad/s.
      See Also:
    • LINEAR_ACCEL

      public static final int LINEAR_ACCEL
      Index of linear acceleration (3 values: x y z), m/s^2.
      See Also:
    • MAG

      public static final int MAG
      Index of the magnetic field (4 values: x y z norm), microtesla.
      See Also:
    • GYRO_BIAS

      public static final int GYRO_BIAS
      Index of the gyro bias estimate (3 values: x y z).
      See Also:
    • AT_REST

      public static final int AT_REST
      Index of the at-rest flag (0 or 1).
      See Also:
    • MAG_UNDISTURBED

      public static final int MAG_UNDISTURBED
      Index of the magnetometer-undisturbed flag (0 or 1).
      See Also:
    • MAG_REF_NORM

      public static final int MAG_REF_NORM
      Index of the reference magnetic field magnitude.
      See Also:
    • MAG_CANDIDATE_NORM

      public static final int MAG_CANDIDATE_NORM
      Index of the candidate magnetic field magnitude.
      See Also:
    • MAG_REF_DIP

      public static final int MAG_REF_DIP
      Index of the reference magnetic dip angle.
      See Also:
    • MAG_CANDIDATE_DIP

      public static final int MAG_CANDIDATE_DIP
      Index of the candidate magnetic dip angle.
      See Also:
    • TEMPERATURE

      public static final int TEMPERATURE
      Index of the temperature, Celsius.
      See Also:
    • TIMESTAMP_NS

      public static final int TIMESTAMP_NS
      Index of the newest sample's robot time, nanoseconds (see STUDICA_NavxData).
      See Also:
    • TIME_SYNCED

      public static final int TIME_SYNCED
      Index of 1 if TIMESTAMP_NS is the measurement time, else 0.
      See Also:
    • DATA_SIZE

      public static final int DATA_SIZE
      Minimum length of the array passed to getData().
      See Also:
    • USB_ANY

      public static final int USB_ANY
      For createUsb: the NavX3 on any USB port.
      See Also:
  • Method Details

    • createCan

      public static int createCan(int busId, int deviceId, int updateRateHz)
      Opens a NavX3 on CAN.
      Parameters:
      busId - CAN bus index
      deviceId - CAN device ID, 0-63
      updateRateHz - output data rate, 1-200 Hz
      Returns:
      a handle, or a negative status code
    • createUsb

      public static int createUsb(int usbPort, int updateRateHz)
      Opens a NavX3 on USB.
      Parameters:
      usbPort - SystemCore USB port label 0-3, or USB_ANY
      updateRateHz - output data rate, 1-200 Hz
      Returns:
      a handle, or a negative status code
    • createSerial

      public static int createSerial(String devicePath, int updateRateHz)
      Opens a NavX3 on a serial device path.
      Parameters:
      devicePath - e.g. "/dev/ttyACM0"
      updateRateHz - output data rate, 1-200 Hz
      Returns:
      a handle, or a negative status code
    • destroy

      public static void destroy(int handle)
      Closes a device. Safe with an invalid handle.
      Parameters:
      handle - the device
    • isConnected

      public static boolean isConnected(int handle)
      Returns whether data arrived recently.
      Parameters:
      handle - the device
      Returns:
      true if connected
    • getData

      public static int getData(int handle, double[] out)
      Fills out (at least DATA_SIZE long) with the latest data.
      Parameters:
      handle - the device
      out - destination array, laid out by the index constants
      Returns:
      the mask of fresh message groups, or a negative status code
    • resetYaw

      public static int resetYaw(int handle)
      Resets yaw to zero.
      Parameters:
      handle - the device
      Returns:
      status code
    • setOutputRate

      public static int setOutputRate(int handle, int hz)
      Sets the output data rate.
      Parameters:
      handle - the device
      hz - rate, 1-200 Hz
      Returns:
      status code
    • enableMessages

      public static int enableMessages(int handle, int mask)
      Chooses which message groups stream.
      Parameters:
      handle - the device
      mask - message group bits
      Returns:
      status code
    • setYawAxes

      public static int setYawAxes(int handle, int axes)
      Selects 6-axis or 9-axis yaw.
      Parameters:
      handle - the device
      axes - 6 or 9
      Returns:
      status code
    • getFirmwareVersion

      public static int getFirmwareVersion(int handle, int[] out)
      Reads the firmware version.
      Parameters:
      handle - the device
      out - receives major, minor, patch
      Returns:
      status code
    • getSensorUuid

      public static int getSensorUuid(int handle, int[] out)
      Reads the 96-bit sensor ID.
      Parameters:
      handle - the device
      out - receives three words
      Returns:
      status code
    • selfTest

      public static int selfTest(int handle, int[] out)
      Runs the IMU self test.
      Parameters:
      handle - the device
      out - receives 8 result codes
      Returns:
      status code