Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
feat(shooter): Add Kraken (TalonFX) implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenheroux committed Feb 21, 2024
1 parent c92502c commit 8d45f14
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions src/main/java/frc/robot/shooter/FlywheelMotorIOTalonFX.java
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);
}

}
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/shooter/ShooterFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static SerializerMotorIO createSerializerMotor() {
*/
public static FlywheelMotorIO createFlywheelMotor() {
if (Robot.isReal() && RobotConstants.REAL_SUBSYSTEMS.contains(Subsystem.SHOOTER))
return new FlywheelMotorIOSparkMax(); // TODO
return new FlywheelMotorIOTalonFX();

return new FlywheelMotorIOSim();
}
Expand Down

0 comments on commit 8d45f14

Please sign in to comment.