lib/robolib/motors/Utils: Added util class for talonfx inversion
This commit is contained in:
parent
f90e2ac04d
commit
915b14b4c7
|
|
@ -1,5 +1,8 @@
|
||||||
wpiVersion = 2026.2.1
|
wpiVersion = 2026.2.1
|
||||||
|
|
||||||
ctreVersion = 26.1.0
|
ctreVersion = 26.1.1
|
||||||
|
ctre5Version = 5.36.0
|
||||||
|
|
||||||
advantageKitVersion = 4.0.0
|
revlibVersion=2026.0.4
|
||||||
|
|
||||||
|
advantageKitVersion = 26.0.1
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
|
||||||
maven {url "https://maven.ctr-electronics.com/release/"}
|
maven {url "https://maven.ctr-electronics.com/release/"}
|
||||||
|
maven {url "https://maven.revrobotics.com/"}
|
||||||
maven {url "https://frcmaven.wpi.edu/artifactory/littletonrobotics-mvn-release/"}
|
maven {url "https://frcmaven.wpi.edu/artifactory/littletonrobotics-mvn-release/"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,6 +49,13 @@ dependencies {
|
||||||
// CTRE Phoenix 6
|
// CTRE Phoenix 6
|
||||||
implementation "com.ctre.phoenix6:wpiapi-java:${ctreVersion}"
|
implementation "com.ctre.phoenix6:wpiapi-java:${ctreVersion}"
|
||||||
|
|
||||||
|
// CTRE Phoenix 5
|
||||||
|
implementation "com.ctre.phoenix:api-java:${ctre5Version}"
|
||||||
|
implementation "com.ctre.phoenix:wpiapi-java:${ctre5Version}"
|
||||||
|
|
||||||
|
// Revlib
|
||||||
|
implementation "com.revrobotics.frc:REVLib-java:2026.0.4"
|
||||||
|
|
||||||
// AdvantageKit
|
// AdvantageKit
|
||||||
implementation "org.littletonrobotics.akit:akit-java:${advantageKitVersion}"
|
implementation "org.littletonrobotics.akit:akit-java:${advantageKitVersion}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.fairportrobotics.frc.robolib.motors;
|
||||||
|
|
||||||
|
import com.ctre.phoenix6.configs.MotorOutputConfigs;
|
||||||
|
import com.ctre.phoenix6.configs.TalonFXConfigurator;
|
||||||
|
import com.ctre.phoenix6.hardware.TalonFX;
|
||||||
|
import com.ctre.phoenix6.signals.InvertedValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class defining static helper methods for motors
|
||||||
|
*/
|
||||||
|
public class Utils {
|
||||||
|
public static void SetMotorDirection(TalonFX motor, InvertedValue direction) {
|
||||||
|
MotorOutputConfigs outputConfigs = new MotorOutputConfigs();
|
||||||
|
TalonFXConfigurator configurator = motor.getConfigurator();
|
||||||
|
configurator.refresh(outputConfigs);
|
||||||
|
outputConfigs.Inverted = direction;
|
||||||
|
configurator.apply(outputConfigs);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue