This repository was archived by the owner on May 19, 2024. It is now read-only.
File tree 3 files changed +11
-4
lines changed
src/main/java/frc/robot/shooter
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 101
101
"useGamepad" : true
102
102
},
103
103
{
104
- "guid" : " 030000006d0400001dc2000014400000" ,
105
- "useGamepad" : true
104
+ "guid" : " Keyboard0"
106
105
}
107
106
]
108
107
}
Original file line number Diff line number Diff line change 188
188
0.0 ,
189
189
0.8500000238418579
190
190
],
191
- "height" : 338 ,
191
+ "height" : 0 ,
192
192
"series" : [
193
193
{
194
194
"color" : [
Original file line number Diff line number Diff line change 4
4
import com .ctre .phoenix6 .configs .TalonFXConfiguration ;
5
5
import com .ctre .phoenix6 .hardware .TalonFX ;
6
6
import com .ctre .phoenix6 .signals .NeutralModeValue ;
7
+
8
+ import edu .wpi .first .math .controller .SimpleMotorFeedforward ;
7
9
import frc .lib .Configurator ;
8
10
9
11
/** Flywheel motor using TalonFX. */
@@ -13,11 +15,15 @@ public class FlywheelMotorIOTalonFX implements FlywheelMotorIO {
13
15
14
16
private final StatusSignal <Double > velocityRotationsPerSecond , statorCurrentAmps ;
15
17
18
+ private final SimpleMotorFeedforward velocityFeedforward ;
19
+
16
20
public FlywheelMotorIOTalonFX () {
17
21
talonFX = new TalonFX (30 );
18
22
19
23
velocityRotationsPerSecond = talonFX .getVelocity ();
20
24
statorCurrentAmps = talonFX .getStatorCurrent ();
25
+
26
+ velocityFeedforward = new SimpleMotorFeedforward (0 , 0 );
21
27
}
22
28
23
29
@ Override
@@ -40,6 +46,8 @@ public void update(FlywheelMotorIOValues values) {
40
46
41
47
@ Override
42
48
public void setSetpoint (double velocityRotationsPerSecond ) {
43
- // TODO Implement velocity setpoint
49
+ double volts = velocityFeedforward .calculate (velocityRotationsPerSecond );
50
+
51
+ talonFX .setVoltage (volts );
44
52
}
45
53
}
You can’t perform that action at this time.
0 commit comments