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

Commit

Permalink
feat(shooter): Get ready to test shooter.
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenheroux committed Apr 2, 2024
1 parent 7b8c17b commit 29bd5aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions simgui-ds.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@
"useGamepad": true
},
{
"guid": "030000006d0400001dc2000014400000",
"useGamepad": true
"guid": "Keyboard0"
}
]
}
2 changes: 1 addition & 1 deletion simgui.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
0.0,
0.8500000238418579
],
"height": 338,
"height": 0,
"series": [
{
"color": [
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/frc/robot/shooter/FlywheelMotorIOTalonFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.ctre.phoenix6.configs.TalonFXConfiguration;
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.signals.NeutralModeValue;

import edu.wpi.first.math.controller.SimpleMotorFeedforward;
import frc.lib.Configurator;

/** Flywheel motor using TalonFX. */
Expand All @@ -13,11 +15,15 @@ public class FlywheelMotorIOTalonFX implements FlywheelMotorIO {

private final StatusSignal<Double> velocityRotationsPerSecond, statorCurrentAmps;

private final SimpleMotorFeedforward velocityFeedforward;

public FlywheelMotorIOTalonFX() {
talonFX = new TalonFX(30);

velocityRotationsPerSecond = talonFX.getVelocity();
statorCurrentAmps = talonFX.getStatorCurrent();

velocityFeedforward = new SimpleMotorFeedforward(0, 0);
}

@Override
Expand All @@ -40,6 +46,8 @@ public void update(FlywheelMotorIOValues values) {

@Override
public void setSetpoint(double velocityRotationsPerSecond) {
// TODO Implement velocity setpoint
double volts = velocityFeedforward.calculate(velocityRotationsPerSecond);

talonFX.setVoltage(volts);
}
}

0 comments on commit 29bd5aa

Please sign in to comment.