This repository has been archived by the owner on May 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shooter): Add Kraken (TalonFX) implementation.
- Loading branch information
1 parent
c92502c
commit 8d45f14
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/main/java/frc/robot/shooter/FlywheelMotorIOTalonFX.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package frc.robot.shooter; | ||
|
||
import com.ctre.phoenix6.hardware.TalonFX; | ||
import com.ctre.phoenix6.signals.NeutralModeValue; | ||
|
||
public class FlywheelMotorIOTalonFX implements FlywheelMotorIO { | ||
|
||
private final TalonFX talonFX; | ||
|
||
public FlywheelMotorIOTalonFX() { | ||
int canId = 39; | ||
|
||
talonFX = new TalonFX(canId); | ||
} | ||
|
||
|
||
@Override | ||
public void configure() { | ||
talonFX.setInverted(false); | ||
|
||
talonFX.setNeutralMode(NeutralModeValue.Coast); | ||
} | ||
|
||
@Override | ||
public void update(FlywheelMotorIOValues values) { | ||
values.angularVelocityRotationsPerSecond = talonFX.getVelocity().getValue(); // TODO convert? | ||
values.currentAmps = talonFX.getStatorCurrent().getValue(); | ||
} | ||
|
||
@Override | ||
public void setVoltage(double volts) { | ||
talonFX.setVoltage(volts); | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
setVoltage(0); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters