Package com.ctre.phoenix6.swerve.jni
Class SwerveJNI
java.lang.Object
com.ctre.phoenix6.jni.CtreJniWrapper
com.ctre.phoenix6.swerve.jni.SwerveJNI
- All Implemented Interfaces:
Cloneable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()static voidJNI_AddVisionMeasurement(int id, double xMeters, double yMeters, double rotationRad, double timestampSeconds) static voidJNI_AddVisionMeasurementWithStdDev(int id, double xMeters, double yMeters, double rotationRad, double timestampSeconds, double[] visionMeasurementStdDevs) static intJNI_ConfigNeutralMode(int id, int neutralMode) static intJNI_ConfigNeutralModeWithTimeout(int id, int neutralMode, double timeoutSeconds) static intJNI_CreateDrivetrain(long drivetrainConstants, long moduleConstants, int numModules) static longJNI_CreateDrivetrainConstants(String canbusName, int pigeon2Id) static intJNI_CreateDrivetrainWithFreq(long drivetrainConstants, double odometryUpdateFreqHz, long moduleConstants, int numModules) static intJNI_CreateDrivetrainWithStddev(long drivetrainConstants, double odometryUpdateFreqHz, double[] odometryStandardDeviation, double[] visionStandardDeviation, long moduleConstants, int numModules) static longJNI_CreateModuleConstantsArr(long numModules) static voidJNI_DestroyConstants(long constants) static voidJNI_DestroyControl(long handle) static voidJNI_DestroyDrivetrain(int id) static voidJNI_DestroyTelemetry(long handle) static doubleJNI_GetOdometryFrequency(int id) static doubleJNI_GetOperatorForwardDirection(int id) voidJNI_GetState(int id) static booleanJNI_IsOdometryValid(int id) static booleanJNI_IsOnCANFD(int id) voidJNI_Module_Apply(int id, int idx) voidJNI_Module_GetCachedPosition(int id, int idx) voidJNI_Module_GetCurrentState(int id, int idx) voidJNI_Module_GetPosition(int id, int idx, boolean refresh) voidJNI_Module_GetTargetState(int id, int idx) static voidJNI_Module_ResetPosition(int id, int idx) static voidJNI_Odom_SetThreadPriority(int id, int priority) static voidJNI_Odom_Start(int id) static voidJNI_Odom_Stop(int id) longJNI_RegisterTelemetry(int id, Runnable telemetryFunc) static intJNI_Request_Apply_ApplyFieldSpeeds(int id, double speedsVx, double speedsVy, double speedsOmega, double[] wheelForceFeedforwardsX_N, double[] wheelForceFeedforwardsY_N, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds, int forwardPerspective) static intJNI_Request_Apply_ApplyRobotSpeeds(int id, double speedsVx, double speedsVy, double speedsOmega, double[] wheelForceFeedforwardsX_N, double[] wheelForceFeedforwardsY_N, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds) static intJNI_Request_Apply_FieldCentric(int id, double velocityX_mps, double velocityY_mps, double rotationalRate_rad_per_s, double deadband_mps, double rotationalDeadband_rad_per_s, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds, int forwardPerspective) static intJNI_Request_Apply_Idle(int id) static intJNI_Request_Apply_PointWheelsAt(int id, double moduleDirection, int driveRequestType, int steerRequestType) static intJNI_Request_Apply_RobotCentric(int id, double velocityX_mps, double velocityY_mps, double rotationalRate_rad_per_s, double deadband_mps, double rotationalDeadband_rad_per_s, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds) static intJNI_Request_Apply_SwerveDriveBrake(int id, int driveRequestType, int steerRequestType) static voidJNI_ResetPose(int id, double xMeters, double yMeters, double rotationRad) static voidJNI_ResetRotation(int id, double rotationRad) static voidJNI_ResetTranslation(int id, double xMeters, double yMeters) static double[]JNI_SamplePoseAt(int id, double timestampSeconds) static voidJNI_SeedFieldCentric(int id, double rotationRad) longJNI_SetControl(int id, IntSupplier request) static voidJNI_SetControl_ApplyFieldSpeeds(int id, double speedsVx, double speedsVy, double speedsOmega, double[] wheelForceFeedforwardsX_N, double[] wheelForceFeedforwardsY_N, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds, int forwardPerspective) static voidJNI_SetControl_ApplyRobotSpeeds(int id, double speedsVx, double speedsVy, double speedsOmega, double[] wheelForceFeedforwardsX_N, double[] wheelForceFeedforwardsY_N, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds) static voidJNI_SetControl_FieldCentric(int id, double velocityX_mps, double velocityY_mps, double rotationalRate_rad_per_s, double deadband_mps, double rotationalDeadband_rad_per_s, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds, int forwardPerspective) static voidJNI_SetControl_Idle(int id) static voidJNI_SetControl_PointWheelsAt(int id, double moduleDirection, int driveRequestType, int steerRequestType) static voidJNI_SetControl_RobotCentric(int id, double velocityX_mps, double velocityY_mps, double rotationalRate_rad_per_s, double deadband_mps, double rotationalDeadband_rad_per_s, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds) static voidJNI_SetControl_SwerveDriveBrake(int id, int driveRequestType, int steerRequestType) static voidJNI_SetModuleConstants(long constantsArr, long moduleIdx, int steerMotorId, int driveMotorId, int encoderId, double encoderOffset_tr, double locationX_m, double locationY_m, boolean driveMotorInverted, boolean steerMotorInverted, boolean encoderInverted, double driveMotorGearRatio, double steerMotorGearRatio, double couplingGearRatio, double wheelRadius_m, int steerMotorClosedLoopOutput, int driveMotorClosedLoopOutput, double slipCurrent_A, double speedAt12Volts_mps, int driveMotorType, int steerMotorType, int feedbackSource, double steerInertia_kg_sq_m, double driveInertia_kg_sq_m, double steerFrictionVoltage_V, double driveFrictionVoltage_V) static voidJNI_SetOperatorPerspectiveForward(int id, double rotationRad) static voidJNI_SetStateStdDevs(int id, double[] stateStdDevs) static voidJNI_SetVisionMeasurementStdDevs(int id, double[] visionMeasurementStdDevs) static voidJNI_TareEverything(int id)
-
Field Details
-
driveState
-
controlParams
-
moduleApplyParams
-
moduleState
-
modulePosition
-
-
Constructor Details
-
SwerveJNI
public SwerveJNI()
-
-
Method Details
-
clone
-
JNI_CreateDrivetrain
public static int JNI_CreateDrivetrain(long drivetrainConstants, long moduleConstants, int numModules) -
JNI_CreateDrivetrainWithFreq
public static int JNI_CreateDrivetrainWithFreq(long drivetrainConstants, double odometryUpdateFreqHz, long moduleConstants, int numModules) -
JNI_CreateDrivetrainWithStddev
public static int JNI_CreateDrivetrainWithStddev(long drivetrainConstants, double odometryUpdateFreqHz, double[] odometryStandardDeviation, double[] visionStandardDeviation, long moduleConstants, int numModules) -
JNI_DestroyDrivetrain
-
JNI_IsOnCANFD
-
JNI_GetOdometryFrequency
-
JNI_IsOdometryValid
-
JNI_SetControl
-
JNI_DestroyControl
-
JNI_GetState
-
JNI_RegisterTelemetry
-
JNI_DestroyTelemetry
-
JNI_ConfigNeutralMode
-
JNI_ConfigNeutralModeWithTimeout
-
JNI_TareEverything
-
JNI_SeedFieldCentric
-
JNI_ResetPose
-
JNI_ResetTranslation
-
JNI_ResetRotation
-
JNI_SetOperatorPerspectiveForward
-
JNI_GetOperatorForwardDirection
-
JNI_AddVisionMeasurement
public static void JNI_AddVisionMeasurement(int id, double xMeters, double yMeters, double rotationRad, double timestampSeconds) -
JNI_AddVisionMeasurementWithStdDev
public static void JNI_AddVisionMeasurementWithStdDev(int id, double xMeters, double yMeters, double rotationRad, double timestampSeconds, double[] visionMeasurementStdDevs) -
JNI_SetVisionMeasurementStdDevs
-
JNI_SetStateStdDevs
-
JNI_SamplePoseAt
-
JNI_Odom_Start
-
JNI_Odom_Stop
-
JNI_Odom_SetThreadPriority
-
JNI_Module_Apply
-
JNI_Module_GetPosition
-
JNI_Module_GetCachedPosition
-
JNI_Module_GetCurrentState
-
JNI_Module_GetTargetState
-
JNI_Module_ResetPosition
-
JNI_CreateDrivetrainConstants
-
JNI_CreateModuleConstantsArr
-
JNI_SetModuleConstants
public static void JNI_SetModuleConstants(long constantsArr, long moduleIdx, int steerMotorId, int driveMotorId, int encoderId, double encoderOffset_tr, double locationX_m, double locationY_m, boolean driveMotorInverted, boolean steerMotorInverted, boolean encoderInverted, double driveMotorGearRatio, double steerMotorGearRatio, double couplingGearRatio, double wheelRadius_m, int steerMotorClosedLoopOutput, int driveMotorClosedLoopOutput, double slipCurrent_A, double speedAt12Volts_mps, int driveMotorType, int steerMotorType, int feedbackSource, double steerInertia_kg_sq_m, double driveInertia_kg_sq_m, double steerFrictionVoltage_V, double driveFrictionVoltage_V) -
JNI_DestroyConstants
-
JNI_SetControl_Idle
-
JNI_Request_Apply_Idle
-
JNI_SetControl_SwerveDriveBrake
public static void JNI_SetControl_SwerveDriveBrake(int id, int driveRequestType, int steerRequestType) -
JNI_Request_Apply_SwerveDriveBrake
public static int JNI_Request_Apply_SwerveDriveBrake(int id, int driveRequestType, int steerRequestType) -
JNI_SetControl_FieldCentric
public static void JNI_SetControl_FieldCentric(int id, double velocityX_mps, double velocityY_mps, double rotationalRate_rad_per_s, double deadband_mps, double rotationalDeadband_rad_per_s, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds, int forwardPerspective) -
JNI_Request_Apply_FieldCentric
public static int JNI_Request_Apply_FieldCentric(int id, double velocityX_mps, double velocityY_mps, double rotationalRate_rad_per_s, double deadband_mps, double rotationalDeadband_rad_per_s, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds, int forwardPerspective) -
JNI_SetControl_RobotCentric
public static void JNI_SetControl_RobotCentric(int id, double velocityX_mps, double velocityY_mps, double rotationalRate_rad_per_s, double deadband_mps, double rotationalDeadband_rad_per_s, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds) -
JNI_Request_Apply_RobotCentric
public static int JNI_Request_Apply_RobotCentric(int id, double velocityX_mps, double velocityY_mps, double rotationalRate_rad_per_s, double deadband_mps, double rotationalDeadband_rad_per_s, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds) -
JNI_SetControl_PointWheelsAt
public static void JNI_SetControl_PointWheelsAt(int id, double moduleDirection, int driveRequestType, int steerRequestType) -
JNI_Request_Apply_PointWheelsAt
public static int JNI_Request_Apply_PointWheelsAt(int id, double moduleDirection, int driveRequestType, int steerRequestType) -
JNI_SetControl_ApplyRobotSpeeds
public static void JNI_SetControl_ApplyRobotSpeeds(int id, double speedsVx, double speedsVy, double speedsOmega, double[] wheelForceFeedforwardsX_N, double[] wheelForceFeedforwardsY_N, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds) -
JNI_Request_Apply_ApplyRobotSpeeds
public static int JNI_Request_Apply_ApplyRobotSpeeds(int id, double speedsVx, double speedsVy, double speedsOmega, double[] wheelForceFeedforwardsX_N, double[] wheelForceFeedforwardsY_N, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds) -
JNI_SetControl_ApplyFieldSpeeds
public static void JNI_SetControl_ApplyFieldSpeeds(int id, double speedsVx, double speedsVy, double speedsOmega, double[] wheelForceFeedforwardsX_N, double[] wheelForceFeedforwardsY_N, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds, int forwardPerspective) -
JNI_Request_Apply_ApplyFieldSpeeds
public static int JNI_Request_Apply_ApplyFieldSpeeds(int id, double speedsVx, double speedsVy, double speedsOmega, double[] wheelForceFeedforwardsX_N, double[] wheelForceFeedforwardsY_N, double centerOfRotationX, double centerOfRotationY, int driveRequestType, int steerRequestType, boolean desaturateWheelSpeeds, int forwardPerspective)
-