001/* Copyright (C) Cross The Road Electronics 2024 */ 002/* 003 * Software License Agreement 004 * 005 * Copyright (C) Cross The Road Electronics. All rights 006 * reserved. 007 * 008 * Cross The Road Electronics (CTRE) licenses to you the right to 009 * use, publish, and distribute copies of CRF (Cross The Road) firmware files ( *.crf) and Software 010 * API Libraries ONLY when in use with Cross The Road Electronics hardware products. 011 * 012 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT 013 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT 014 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A 015 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL 016 * CROSS THE ROAD ELECTRONICS BE LIABLE FOR ANY INCIDENTAL, SPECIAL, 017 * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF 018 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS 019 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE 020 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER 021 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT 022 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE 023 */ 024package com.ctre.phoenix.sensors; 025import com.ctre.phoenix.CTREJNIWrapper; 026 027 028public class PigeonImuJNI extends CTREJNIWrapper { 029 030 public static native long JNI_new_PigeonImu_Talon(int talonID, String version); 031 032 public static native long JNI_new_PigeonImu(int deviceNumber, String version, String canbus); 033 034 public static native int JNI_destroy_PigeonImu(long handle); 035 036 //public static native void JNI_destroy_AllPigeonImus(); 037 038 public static native int JNI_ConfigSetCustomParam(long handle, int newValue, int paramIndex, int timeoutMs); 039 040 public static native int JNI_ConfigGetCustomParam(long handle, int paramIndex, int timoutMs); 041 042 public static native int JNI_ConfigSetParameter(long handle, int param, double value, int subValue, int ordinal, 043 int timeoutMs); 044 045 public static native double JNI_ConfigGetParameter(long handle, int param, int ordinal, int timeoutMs); 046 047 public static native int JNI_ConfigFactoryDefault(long handle, int timeoutMs); 048 049 public static native int JNI_SetStatusFramePeriod(long handle, int statusFrame, int periodMs, int timeoutMs); 050 051 public static native int JNI_SetYaw(long handle, double angleDeg, int timeoutMs); 052 053 public static native int JNI_AddYaw(long handle, double angleDeg, int timeoutMs); 054 055 public static native int JNI_SetYawToCompass(long handle, int timeoutMs); 056 057 public static native int JNI_SetFusedHeading(long handle, double angleDeg, int timeoutMs); 058 059 public static native int JNI_AddFusedHeading(long handle, double angleDeg, int timeoutMs); 060 061 public static native int JNI_SetFusedHeadingToCompass(long handle, int timeoutMs); 062 063 public static native int JNI_SetAccumZAngle(long handle, double angleDeg, int timeoutMs); 064 065 public static native int JNI_SetTemperatureCompensationDisable(long handle, int bTempCompDisable, int timeoutMs); 066 067 public static native int JNI_SetCompassDeclination(long handle, double angleDegOffset, int timeoutMs); 068 069 public static native int JNI_SetCompassAngle(long handle, double angleDeg, int timeoutMs); 070 071 public static native int JNI_EnterCalibrationMode(long handle, int calMode, int timeoutMs); 072 073 public static native int JNI_GetGeneralStatus(long handle, double [] params); 074 075 public static native int JNI_Get6dQuaternion(long handle, double [] wxyz ); 076 077 public static native int JNI_GetYawPitchRoll(long handle, double [] ypr); 078 079 public static native int JNI_GetYawPitchRoll2(long handle, double [] ypr); 080 081 public static native double JNI_GetYaw(long handle); 082 083 public static native double JNI_GetPitch(long handle); 084 085 public static native double JNI_GetRoll(long handle); 086 087 public static native int JNI_GetGravityVector(long handle, double [] gravityVector); 088 089 public static native int JNI_GetAccumGyro(long handle, double [] xyz_deg); 090 091 public static native double JNI_GetAbsoluteCompassHeading(long handle); 092 093 public static native double JNI_GetCompassHeading(long handle); 094 095 public static native double JNI_GetCompassFieldStrength(long handle); 096 097 public static native double JNI_GetTemp(long handle); 098 099 public static native int JNI_GetUpTime(long handle); 100 101 public static native int JNI_GetRawMagnetometer(long handle, short [] rm_xyz); 102 103 public static native int JNI_GetBiasedMagnetometer(long handle, short [] bm_xyz); 104 105 public static native int JNI_GetBiasedAccelerometer(long handle, short [] ba_xyz); 106 107 public static native int JNI_GetRawGyro(long handle, double [] xyz_dps); 108 109 public static native int JNI_GetAccelerometerAngles(long handle, double [] tiltAngles); 110 111 public static native int JNI_GetFusedHeading(long handle, double [] params); 112 113 public static native int JNI_GetState(long handle); 114 115 public static native int JNI_GetResetCount(long handle); 116 117 public static native int JNI_GetResetFlags(long handle); 118 119 public static native int JNI_GetFirmwareVersion(long handle); 120 121 public static native int JNI_GetLastError(long handle); 122 123 public static native double JNI_GetLastTimestamp(long handle); 124 125 public static native boolean JNI_HasResetOccurred(long handle); 126 127 public static native int JNI_GetStatusFramePeriod(long handle, int frame, int timeoutMs); 128 129 public static native int JNI_SetControlFramePeriod(long handle, int frame, int periodMs); 130 131 public static native int JNI_GetFaults(long handle); 132 133 public static native int JNI_GetStickyFaults(long handle); 134 135 public static native int JNI_ClearStickyFaults(long handle, int timeoutMs); 136 137}