diff --git a/simgui-ds.json b/simgui-ds.json index 8ddf38c..acf3b7e 100644 --- a/simgui-ds.json +++ b/simgui-ds.json @@ -101,8 +101,7 @@ "useGamepad": true }, { - "guid": "030000006d0400001dc2000014400000", - "useGamepad": true + "guid": "Keyboard0" } ] } diff --git a/simgui.json b/simgui.json index e60a306..b891371 100644 --- a/simgui.json +++ b/simgui.json @@ -188,7 +188,7 @@ 0.0, 0.8500000238418579 ], - "height": 338, + "height": 0, "series": [ { "color": [ diff --git a/src/main/java/frc/robot/shooter/FlywheelMotorIOTalonFX.java b/src/main/java/frc/robot/shooter/FlywheelMotorIOTalonFX.java index cb09bc7..5ea0cd8 100644 --- a/src/main/java/frc/robot/shooter/FlywheelMotorIOTalonFX.java +++ b/src/main/java/frc/robot/shooter/FlywheelMotorIOTalonFX.java @@ -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. */ @@ -13,11 +15,15 @@ public class FlywheelMotorIOTalonFX implements FlywheelMotorIO { private final StatusSignal velocityRotationsPerSecond, statorCurrentAmps; + private final SimpleMotorFeedforward velocityFeedforward; + public FlywheelMotorIOTalonFX() { talonFX = new TalonFX(30); velocityRotationsPerSecond = talonFX.getVelocity(); statorCurrentAmps = talonFX.getStatorCurrent(); + + velocityFeedforward = new SimpleMotorFeedforward(0, 0); } @Override @@ -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); } }