Class NavxJNI
java.lang.Object
com.studica.frc.jni.StudicaJNIWrapper
com.studica.frc.jni.NavxJNI
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
FieldsModifier and TypeFieldDescriptionstatic final intIndex of continuous angle, degrees.static final intIndex of angular velocity (3 values: x y z), rad/s.static final intIndex of the at-rest flag (0 or 1).static final intMinimum length of the array passed to getData().static final intIndex of the gyro bias estimate (3 values: x y z).static final intIndex of linear acceleration (3 values: x y z), m/s^2.static final intIndex of the magnetic field (4 values: x y z norm), microtesla.static final intIndex of the candidate magnetic dip angle.static final intIndex of the candidate magnetic field magnitude.static final intIndex of the reference magnetic dip angle.static final intIndex of the reference magnetic field magnitude.static final intIndex of the magnetometer-undisturbed flag (0 or 1).static final intIndex of pitch, degrees.static final intIndex of the 6-axis quaternion (4 values: w x y z).static final intIndex of the 9-axis quaternion (4 values: w x y z).static final intIndex of roll, degrees.static final intIndex of the temperature, Celsius.static final intIndex of 1 if TIMESTAMP_NS is the measurement time, else 0.static final intIndex of the newest sample's robot time, nanoseconds (see STUDICA_NavxData).static final intFor createUsb: the NavX3 on any USB port.static final intIndex of yaw, degrees. -
Method Summary
Modifier and TypeMethodDescriptionstatic intcreateCan(int busId, int deviceId, int updateRateHz) Opens a NavX3 on CAN.static intcreateSerial(String devicePath, int updateRateHz) Opens a NavX3 on a serial device path.static intcreateUsb(int usbPort, int updateRateHz) Opens a NavX3 on USB.static voiddestroy(int handle) Closes a device.static intenableMessages(int handle, int mask) Chooses which message groups stream.static intgetData(int handle, double[] out) Fillsout(at least DATA_SIZE long) with the latest data.static intgetFirmwareVersion(int handle, int[] out) Reads the firmware version.static intgetSensorUuid(int handle, int[] out) Reads the 96-bit sensor ID.static booleanisConnected(int handle) Returns whether data arrived recently.static intresetYaw(int handle) Resets yaw to zero.static intselfTest(int handle, int[] out) Runs the IMU self test.static intsetOutputRate(int handle, int hz) Sets the output data rate.static intsetYawAxes(int handle, int axes) Selects 6-axis or 9-axis yaw.Methods inherited from class StudicaJNIWrapper
forceLoad
-
Field Details
-
YAW
public static final int YAWIndex of yaw, degrees.- See Also:
-
PITCH
public static final int PITCHIndex of pitch, degrees.- See Also:
-
ROLL
public static final int ROLLIndex of roll, degrees.- See Also:
-
ANGLE
public static final int ANGLEIndex of continuous angle, degrees.- See Also:
-
QUAT6
public static final int QUAT6Index of the 6-axis quaternion (4 values: w x y z).- See Also:
-
QUAT9
public static final int QUAT9Index of the 9-axis quaternion (4 values: w x y z).- See Also:
-
ANGULAR_VEL
public static final int ANGULAR_VELIndex of angular velocity (3 values: x y z), rad/s.- See Also:
-
LINEAR_ACCEL
public static final int LINEAR_ACCELIndex of linear acceleration (3 values: x y z), m/s^2.- See Also:
-
MAG
public static final int MAGIndex of the magnetic field (4 values: x y z norm), microtesla.- See Also:
-
GYRO_BIAS
public static final int GYRO_BIASIndex of the gyro bias estimate (3 values: x y z).- See Also:
-
AT_REST
public static final int AT_RESTIndex of the at-rest flag (0 or 1).- See Also:
-
MAG_UNDISTURBED
public static final int MAG_UNDISTURBEDIndex of the magnetometer-undisturbed flag (0 or 1).- See Also:
-
MAG_REF_NORM
public static final int MAG_REF_NORMIndex of the reference magnetic field magnitude.- See Also:
-
MAG_CANDIDATE_NORM
public static final int MAG_CANDIDATE_NORMIndex of the candidate magnetic field magnitude.- See Also:
-
MAG_REF_DIP
public static final int MAG_REF_DIPIndex of the reference magnetic dip angle.- See Also:
-
MAG_CANDIDATE_DIP
public static final int MAG_CANDIDATE_DIPIndex of the candidate magnetic dip angle.- See Also:
-
TEMPERATURE
public static final int TEMPERATUREIndex of the temperature, Celsius.- See Also:
-
TIMESTAMP_NS
public static final int TIMESTAMP_NSIndex of the newest sample's robot time, nanoseconds (see STUDICA_NavxData).- See Also:
-
TIME_SYNCED
public static final int TIME_SYNCEDIndex of 1 if TIMESTAMP_NS is the measurement time, else 0.- See Also:
-
DATA_SIZE
public static final int DATA_SIZEMinimum length of the array passed to getData().- See Also:
-
USB_ANY
public static final int USB_ANYFor 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 indexdeviceId- CAN device ID, 0-63updateRateHz- 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_ANYupdateRateHz- output data rate, 1-200 Hz- Returns:
- a handle, or a negative status code
-
createSerial
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) Fillsout(at least DATA_SIZE long) with the latest data.- Parameters:
handle- the deviceout- 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 devicehz- rate, 1-200 Hz- Returns:
- status code
-
enableMessages
public static int enableMessages(int handle, int mask) Chooses which message groups stream.- Parameters:
handle- the devicemask- 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 deviceaxes- 6 or 9- Returns:
- status code
-
getFirmwareVersion
public static int getFirmwareVersion(int handle, int[] out) Reads the firmware version.- Parameters:
handle- the deviceout- 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 deviceout- receives three words- Returns:
- status code
-
selfTest
public static int selfTest(int handle, int[] out) Runs the IMU self test.- Parameters:
handle- the deviceout- receives 8 result codes- Returns:
- status code
-