Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/main/java/frc/robot/constants/ConstRotors.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import com.ctre.phoenix6.signals.InvertedValue;
import com.ctre.phoenix6.signals.NeutralModeValue;

import edu.wpi.first.units.measure.AngularVelocity;

import static edu.wpi.first.units.Units.RPM;

public class ConstRotors {
public static TalonFXConfiguration BALL_SHOOTER_CONFIG = new TalonFXConfiguration();

Expand All @@ -17,7 +21,21 @@ public class ConstRotors {
BALL_SHOOTER_CONFIG.CurrentLimits.SupplyCurrentLimit = 85; // TODO: tune current limits
BALL_SHOOTER_CONFIG.CurrentLimits.SupplyCurrentLowerLimit = 60; // TODO: tune current limits
BALL_SHOOTER_CONFIG.MotorOutput.Inverted = InvertedValue.Clockwise_Positive;

BALL_SHOOTER_CONFIG.MotorOutput.NeutralMode = NeutralModeValue.Coast;
BALL_SHOOTER_CONFIG.MotorOutput.Inverted = InvertedValue.CounterClockwise_Positive;

BALL_SHOOTER_CONFIG.Slot0.kS = 0;
BALL_SHOOTER_CONFIG.Slot0.kV = 0;
BALL_SHOOTER_CONFIG.Slot0.kS = 0;
BALL_SHOOTER_CONFIG.Slot0.kV = 0;
BALL_SHOOTER_CONFIG.Slot0.kA = 0;
BALL_SHOOTER_CONFIG.Slot0.kP = 0;

BALL_SHOOTER_CONFIG.MotionMagic.MotionMagicCruiseVelocity = 60;
BALL_SHOOTER_CONFIG.MotionMagic.MotionMagicAcceleration = 600;
BALL_SHOOTER_CONFIG.MotionMagic.MotionMagicJerk = 6000;
}

public static final double BALL_SHOOTER_SPEED = 0.2; // TODO: Replace with actual speed
public static final AngularVelocity BALL_SHOOTER_SPEED = RPM.of(0.2); // TODO: Replace with actual speed
}
4 changes: 3 additions & 1 deletion src/main/java/frc/robot/subsystems/Rotors.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package frc.robot.subsystems;

import com.ctre.phoenix6.controls.MotionMagicVelocityVoltage;
import com.ctre.phoenix6.hardware.TalonFX;

import edu.wpi.first.epilogue.Logged;
Expand All @@ -17,6 +18,7 @@ public class Rotors extends SubsystemBase {
/** Creates a new Rotors. */

TalonFX ballShooterMotor;
final MotionMagicVelocityVoltage flywheelVelocityRequest = new MotionMagicVelocityVoltage(0);

public Rotors() {
ballShooterMotor = new TalonFX(mapRotors.BALL_SHOOTER_CAN);
Expand All @@ -25,7 +27,7 @@ public Rotors() {
}

public void setBallShooterMotorSpeed(double speed) {
ballShooterMotor.set(speed);
ballShooterMotor.setControl(flywheelVelocityRequest.withVelocity(speed));
}

public double getBallShooterMotorVelocity() {
Expand Down