Skip to content

Commit 3e27099

Browse files
committed
musical krakens
1 parent 268efe7 commit 3e27099

File tree

3 files changed

+66
-3
lines changed

3 files changed

+66
-3
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@
5656
"edu.wpi.first.math.proto.*",
5757
"edu.wpi.first.math.**.proto.*",
5858
"edu.wpi.first.math.**.struct.*",
59-
]
59+
],
60+
"java.compile.nullAnalysis.mode": "automatic"
6061
}

src/main/java/org/frc6423/frc2025/subsystems/swerve/module/ModuleIO.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ public class ModuleIOInputs {
3636
/** Update module hardware */
3737
public void periodic();
3838

39-
public void setPivotVolts(double volts, boolean focEnabled);
39+
public default void setPivotVolts(double volts, boolean focEnabled) {
40+
setPivotVolts(volts);
41+
}
4042

41-
public void setDriveVolts(double volts, boolean focEnabled);
43+
public default void setDriveVolts(double volts, boolean focEnabled) {
44+
setDriveVolts(volts);
45+
}
4246

4347
/** Set Pivot motor voltage */
4448
public default void setPivotVolts(double volts) {
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package org.frc6423.frc2025.util.motorUtil;
2+
3+
import java.util.Arrays;
4+
import java.util.Random;
5+
6+
import com.ctre.phoenix6.Orchestra;
7+
import com.ctre.phoenix6.hardware.TalonFX;
8+
9+
/** A class that's responsible for configuring all talons to do things */
10+
public class TalonFXUtil {
11+
private static final Orchestra robotOrchestra = new Orchestra();
12+
private static TalonFX[] globalTalonArray;
13+
14+
/** Register Talon to global talon array */
15+
public static void registerMotor(TalonFX talon) {
16+
globalTalonArray[globalTalonArray.length] = talon;
17+
}
18+
19+
/** Initalizes Talon orchestra */
20+
public static void initOrchestra() {
21+
Arrays.stream(globalTalonArray)
22+
.forEach((t) -> robotOrchestra.addInstrument(t));
23+
}
24+
25+
/** Plays song */
26+
public static void playSong() {
27+
robotOrchestra.play();
28+
}
29+
30+
/** Pause song */
31+
public static void pauseSong() {
32+
robotOrchestra.pause();
33+
}
34+
35+
/** Stop song */
36+
public static void stopSong() {
37+
robotOrchestra.stop();
38+
}
39+
40+
/** Loads song of songID */
41+
public static void loadSong(int songID) {
42+
var status = robotOrchestra.loadMusic(robotSongArray[songID]);
43+
44+
if (!status.isOK()) {
45+
System.out.println("SongID requested is out of bounds");
46+
}
47+
}
48+
49+
/** Requests a random song from song array */
50+
public static void playRandomSong() {
51+
loadSong(new Random().nextInt(robotSongArray.length));
52+
}
53+
54+
public static final String[] robotSongArray = new String[] {
55+
"Test 1",
56+
"Test 2"
57+
};
58+
}

0 commit comments

Comments
 (0)