Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit ee3da31

Browse files
authored
change motor to TalonSRX (#44)
1 parent 8b20a29 commit ee3da31

File tree

3 files changed

+172
-14
lines changed

3 files changed

+172
-14
lines changed

src/main/java/frc/robot/subsystems/Shooter.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,44 @@
44

55
package frc.robot.subsystems;
66

7-
import com.ctre.phoenix6.hardware.TalonFX;
7+
import com.ctre.phoenix.motorcontrol.ControlMode;
8+
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
9+
// import com.ctre.phoenix6.hardwareTalonSRX;
810

11+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
912
import edu.wpi.first.wpilibj2.command.SubsystemBase;
1013
import frc.robot.RobotMap;
1114

1215
public class Shooter extends SubsystemBase {
1316
/** Creates a new Shooter. */
14-
TalonFX propelMotor;
15-
TalonFX spiralMotor;
17+
TalonSRX propelMotor;
18+
TalonSRX spiralMotor;
1619

1720
public Shooter() {
18-
propelMotor = new TalonFX(RobotMap.mapShooter.PROPEL_MOTOR_CAN);
19-
spiralMotor = new TalonFX(RobotMap.mapShooter.SPIRAL_MOTOR_CAN);
21+
propelMotor = new TalonSRX(RobotMap.mapShooter.PROPEL_MOTOR_CAN);
22+
spiralMotor = new TalonSRX(RobotMap.mapShooter.SPIRAL_MOTOR_CAN);
2023
}
2124

2225
public void setSpiralMotorVelocity(double velocity) {
23-
spiralMotor.set(velocity);
26+
spiralMotor.set(ControlMode.PercentOutput, velocity);
2427
}
2528

2629
public double getSpiralMotorVelocity() {
27-
return spiralMotor.get();
30+
return spiralMotor.getMotorOutputVoltage();
2831
}
2932

3033
public void setPropelMotorVelocity(double velocity) {
31-
propelMotor.set(velocity);
34+
propelMotor.set(ControlMode.PercentOutput, velocity);
3235
}
3336

3437
public double getPropelMotorVelocity() {
35-
return propelMotor.get();
38+
return propelMotor.getMotorOutputVoltage();
3639
}
3740

3841
@Override
3942
public void periodic() {
4043
// This method will be called once per scheduler run
44+
SmartDashboard.putNumber("propelMotorSpeed", getPropelMotorVelocity());
45+
SmartDashboard.putNumber("spiralMotorSpeed", getSpiralMotorVelocity());
4146
}
4247
}

src/main/java/frc/robot/subsystems/Stager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,30 @@
44

55
package frc.robot.subsystems;
66

7-
import com.ctre.phoenix6.hardware.TalonFX;
7+
import com.ctre.phoenix.motorcontrol.ControlMode;
8+
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
9+
// import com.ctre.phoenix6.hardware.TalonSRX;
810

911
import edu.wpi.first.wpilibj.DigitalInput;
1012
import edu.wpi.first.wpilibj2.command.SubsystemBase;
1113
import frc.robot.RobotMap;
1214

1315
public class Stager extends SubsystemBase {
1416
/** Creates a new Stager. */
15-
TalonFX stagerMotor;
17+
TalonSRX stagerMotor;
1618
DigitalInput hasGP;
1719

1820
public Stager() {
19-
stagerMotor = new TalonFX(RobotMap.mapStager.STAGER_MOTOR_CAN);
21+
stagerMotor = new TalonSRX(RobotMap.mapStager.STAGER_MOTOR_CAN);
2022
hasGP = new DigitalInput(RobotMap.mapStager.HAS_GP_DIO);
2123
}
2224

2325
public void setStagerMotorVelocity(double velocity) {
24-
stagerMotor.set(velocity);
26+
stagerMotor.set(ControlMode.PercentOutput, velocity);
2527
}
2628

2729
public void setStagerMotorVelocityNuetralOutput() {
28-
stagerMotor.set(0);
30+
stagerMotor.set(ControlMode.PercentOutput, 0);
2931
}
3032

3133
public boolean getHasGP() {

vendordeps/Phoenix5.json

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
{
2+
"fileName": "Phoenix5.json",
3+
"name": "CTRE-Phoenix (v5)",
4+
"version": "5.33.1",
5+
"frcYear": 2024,
6+
"uuid": "ab676553-b602-441f-a38d-f1296eff6537",
7+
"mavenUrls": [
8+
"https://maven.ctr-electronics.com/release/"
9+
],
10+
"jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2024-latest.json",
11+
"requires": [
12+
{
13+
"uuid": "e995de00-2c64-4df5-8831-c1441420ff19",
14+
"errorMessage": "Phoenix 5 requires low-level libraries from Phoenix 6. Please add the Phoenix 6 vendordep before adding Phoenix 5.",
15+
"offlineFileName": "Phoenix6.json",
16+
"onlineUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-latest.json"
17+
}
18+
],
19+
"javaDependencies": [
20+
{
21+
"groupId": "com.ctre.phoenix",
22+
"artifactId": "api-java",
23+
"version": "5.33.1"
24+
},
25+
{
26+
"groupId": "com.ctre.phoenix",
27+
"artifactId": "wpiapi-java",
28+
"version": "5.33.1"
29+
}
30+
],
31+
"jniDependencies": [
32+
{
33+
"groupId": "com.ctre.phoenix",
34+
"artifactId": "cci",
35+
"version": "5.33.1",
36+
"isJar": false,
37+
"skipInvalidPlatforms": true,
38+
"validPlatforms": [
39+
"windowsx86-64",
40+
"linuxx86-64",
41+
"linuxathena"
42+
],
43+
"simMode": "hwsim"
44+
},
45+
{
46+
"groupId": "com.ctre.phoenix.sim",
47+
"artifactId": "cci-sim",
48+
"version": "5.33.1",
49+
"isJar": false,
50+
"skipInvalidPlatforms": true,
51+
"validPlatforms": [
52+
"windowsx86-64",
53+
"linuxx86-64",
54+
"osxuniversal"
55+
],
56+
"simMode": "swsim"
57+
}
58+
],
59+
"cppDependencies": [
60+
{
61+
"groupId": "com.ctre.phoenix",
62+
"artifactId": "wpiapi-cpp",
63+
"version": "5.33.1",
64+
"libName": "CTRE_Phoenix_WPI",
65+
"headerClassifier": "headers",
66+
"sharedLibrary": true,
67+
"skipInvalidPlatforms": true,
68+
"binaryPlatforms": [
69+
"windowsx86-64",
70+
"linuxx86-64",
71+
"linuxathena"
72+
],
73+
"simMode": "hwsim"
74+
},
75+
{
76+
"groupId": "com.ctre.phoenix",
77+
"artifactId": "api-cpp",
78+
"version": "5.33.1",
79+
"libName": "CTRE_Phoenix",
80+
"headerClassifier": "headers",
81+
"sharedLibrary": true,
82+
"skipInvalidPlatforms": true,
83+
"binaryPlatforms": [
84+
"windowsx86-64",
85+
"linuxx86-64",
86+
"linuxathena"
87+
],
88+
"simMode": "hwsim"
89+
},
90+
{
91+
"groupId": "com.ctre.phoenix",
92+
"artifactId": "cci",
93+
"version": "5.33.1",
94+
"libName": "CTRE_PhoenixCCI",
95+
"headerClassifier": "headers",
96+
"sharedLibrary": true,
97+
"skipInvalidPlatforms": true,
98+
"binaryPlatforms": [
99+
"windowsx86-64",
100+
"linuxx86-64",
101+
"linuxathena"
102+
],
103+
"simMode": "hwsim"
104+
},
105+
{
106+
"groupId": "com.ctre.phoenix.sim",
107+
"artifactId": "wpiapi-cpp-sim",
108+
"version": "5.33.1",
109+
"libName": "CTRE_Phoenix_WPISim",
110+
"headerClassifier": "headers",
111+
"sharedLibrary": true,
112+
"skipInvalidPlatforms": true,
113+
"binaryPlatforms": [
114+
"windowsx86-64",
115+
"linuxx86-64",
116+
"osxuniversal"
117+
],
118+
"simMode": "swsim"
119+
},
120+
{
121+
"groupId": "com.ctre.phoenix.sim",
122+
"artifactId": "api-cpp-sim",
123+
"version": "5.33.1",
124+
"libName": "CTRE_PhoenixSim",
125+
"headerClassifier": "headers",
126+
"sharedLibrary": true,
127+
"skipInvalidPlatforms": true,
128+
"binaryPlatforms": [
129+
"windowsx86-64",
130+
"linuxx86-64",
131+
"osxuniversal"
132+
],
133+
"simMode": "swsim"
134+
},
135+
{
136+
"groupId": "com.ctre.phoenix.sim",
137+
"artifactId": "cci-sim",
138+
"version": "5.33.1",
139+
"libName": "CTRE_PhoenixCCISim",
140+
"headerClassifier": "headers",
141+
"sharedLibrary": true,
142+
"skipInvalidPlatforms": true,
143+
"binaryPlatforms": [
144+
"windowsx86-64",
145+
"linuxx86-64",
146+
"osxuniversal"
147+
],
148+
"simMode": "swsim"
149+
}
150+
]
151+
}

0 commit comments

Comments
 (0)