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 class
static class
static class
static class
static class
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
static void
JNI_AddVisionMeasurement
(int id, double xMeters, double yMeters, double rotationRad, double timestampSeconds) static void
JNI_AddVisionMeasurementWithStdDev
(int id, double xMeters, double yMeters, double rotationRad, double timestampSeconds, double[] visionMeasurementStdDevs) static int
JNI_ConfigNeutralMode
(int id, int neutralMode) static int
JNI_CreateDrivetrain
(long drivetrainConstants, long moduleConstants, int numModules) static long
JNI_CreateDrivetrainConstants
(String canbusName, int pigeon2Id) static int
JNI_CreateDrivetrainWithFreq
(long drivetrainConstants, double odometryUpdateFreqHz, long moduleConstants, int numModules) static int
JNI_CreateDrivetrainWithStddev
(long drivetrainConstants, double odometryUpdateFreqHz, double[] odometryStandardDeviation, double[] visionStandardDeviation, long moduleConstants, int numModules) static long
JNI_CreateModuleConstantsArr
(long numModules) static void
JNI_DestroyConstants
(long constants) static void
JNI_DestroyControl
(long handle) static void
JNI_DestroyDrivetrain
(int id) static void
JNI_DestroyTelemetry
(long handle) static double
JNI_GetOdometryFrequency
(int id) static double
JNI_GetOperatorForwardDirection
(int id) void
JNI_GetState
(int id) static boolean
JNI_IsOdometryValid
(int id) static boolean
JNI_IsOnCANFD
(int id) void
JNI_Module_Apply
(int id, int idx) void
JNI_Module_GetCachedPosition
(int id, int idx) void
JNI_Module_GetCurrentState
(int id, int idx) void
JNI_Module_GetPosition
(int id, int idx, boolean refresh) void
JNI_Module_GetTargetState
(int id, int idx) static void
JNI_Module_ResetPosition
(int id, int idx) static void
JNI_Odom_SetThreadPriority
(int id, int priority) static void
JNI_Odom_Start
(int id) static void
JNI_Odom_Stop
(int id) long
JNI_RegisterTelemetry
(int id, Runnable telemetryFunc) 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) 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) 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) static int
JNI_Request_Apply_Idle
(int id) static int
JNI_Request_Apply_PointWheelsAt
(int id, double moduleDirection, int driveRequestType, int steerRequestType) 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) static int
JNI_Request_Apply_SwerveDriveBrake
(int id, int driveRequestType, int steerRequestType) static void
JNI_ResetPose
(int id, double xMeters, double yMeters, double rotationRad) static void
JNI_ResetRotation
(int id, double rotationRad) static void
JNI_ResetTranslation
(int id, double xMeters, double yMeters) static double[]
JNI_SamplePoseAt
(int id, double timestampSeconds) static void
JNI_SeedFieldCentric
(int id) long
JNI_SetControl
(int id, IntSupplier request) 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) 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) 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) static void
JNI_SetControl_Idle
(int id) static void
JNI_SetControl_PointWheelsAt
(int id, double moduleDirection, int driveRequestType, int steerRequestType) 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) static void
JNI_SetControl_SwerveDriveBrake
(int id, int driveRequestType, int steerRequestType) 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) static void
JNI_SetOperatorPerspectiveForward
(int id, double rotationRad) static void
JNI_SetStateStdDevs
(int id, double[] stateStdDevs) static void
JNI_SetVisionMeasurementStdDevs
(int id, double[] visionMeasurementStdDevs) static void
JNI_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_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)
-