2026-01-10 16:52:43 -07:00
|
|
|
package frc4388.robot.subsystems.shooter;
|
|
|
|
|
|
|
|
|
|
import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
|
|
|
|
|
import com.ctre.phoenix6.configs.MotorOutputConfigs;
|
2026-01-27 19:15:37 -07:00
|
|
|
import com.ctre.phoenix6.configs.Slot0Configs;
|
2026-01-10 16:52:43 -07:00
|
|
|
import com.ctre.phoenix6.configs.TalonFXConfiguration;
|
|
|
|
|
import com.ctre.phoenix6.signals.NeutralModeValue;
|
|
|
|
|
|
2026-02-09 17:18:54 -08:00
|
|
|
import frc4388.utility.configurable.ConfigurableDouble;
|
2026-01-13 10:08:44 -07:00
|
|
|
import frc4388.utility.status.CanDevice;
|
2026-01-10 16:52:43 -07:00
|
|
|
|
2026-02-10 17:33:39 -08:00
|
|
|
public class ShooterConstants {
|
2026-01-10 16:52:43 -07:00
|
|
|
// Motor conversions
|
2026-01-27 19:15:37 -07:00
|
|
|
|
2026-01-10 16:52:43 -07:00
|
|
|
public static final double FEEDER_INCHES_PER_ROT = 1.;
|
2026-01-27 18:13:51 -07:00
|
|
|
public static final double SHOOTERMOTOR1_GEAR_RATIO = 1.;
|
|
|
|
|
public static final double SHOOTERMOTOR2_GEAR_RATIO = 1.;
|
|
|
|
|
public static final double INDEXER_GEAR_RATIO = 1.;
|
2026-02-07 14:51:05 -07:00
|
|
|
|
2026-02-09 17:18:54 -08:00
|
|
|
// public static final AngularVelocity SHOOTER_ACTIVE_VELOCITY = RotationsPerSecond.of(30);
|
|
|
|
|
// public static final AngularVelocity SHOOTER_RESTING_VELOCITY = RotationsPerSecond.of(15);
|
|
|
|
|
// public static final AngularVelocity SHOOTER_INACTIVE_VELOCITY = RotationsPerSecond.of(0.0);
|
2026-01-29 18:07:19 -07:00
|
|
|
|
2026-02-09 17:18:54 -08:00
|
|
|
// public static final AngularVelocity INDEXER_ACTIVE_VELOCITY = RotationsPerSecond.of(10);
|
|
|
|
|
// public static final AngularVelocity INDEXER_INACTIVE_VELOCITY = RotationsPerSecond.of(0.0);
|
2026-01-29 18:07:19 -07:00
|
|
|
|
2026-02-09 17:18:54 -08:00
|
|
|
public static final ConfigurableDouble SHOOTER_ACTIVE_VELOCITY = new ConfigurableDouble("Shooter Active Velocity", 30);
|
|
|
|
|
public static final ConfigurableDouble SHOOTER_RESTING_VELOCITY = new ConfigurableDouble("Shooter Resting Velocity", 15);
|
|
|
|
|
|
2026-02-10 18:42:47 -08:00
|
|
|
public static final ConfigurableDouble INDEXER_FORWARD_VELOCITY = new ConfigurableDouble("Indexer FWD Velocity", 10);
|
|
|
|
|
public static final ConfigurableDouble INDEXER_REVERSE_VELOCITY = new ConfigurableDouble("Indexer reverse Velocity", 10);
|
|
|
|
|
|
2026-02-11 15:18:12 -07:00
|
|
|
|
2026-02-10 18:42:47 -08:00
|
|
|
// Tolerances
|
2026-02-11 15:18:12 -07:00
|
|
|
public static final ConfigurableDouble ROBOT_MIN_HUB = new ConfigurableDouble("Shoot min dist M", 0);
|
|
|
|
|
public static final ConfigurableDouble ROBOT_MAX_HUB = new ConfigurableDouble("Shoot max dist M", 99);
|
2026-02-10 18:42:47 -08:00
|
|
|
|
2026-02-11 15:18:12 -07:00
|
|
|
public static final ConfigurableDouble ROBOT_ANG_TOLERANCE = new ConfigurableDouble("Ang tolerance DEG", 360);
|
2026-02-10 18:42:47 -08:00
|
|
|
|
2026-02-11 15:18:12 -07:00
|
|
|
public static final ConfigurableDouble ROBOT_SPEED_TOLERANCE = new ConfigurableDouble("Speed tolerance MS", 1);
|
|
|
|
|
public static final ConfigurableDouble ROBOT_ANG_SPEED_TOLERANCE = new ConfigurableDouble("Shoot Ang speed tolerance DEG", 3);
|
2026-02-10 18:42:47 -08:00
|
|
|
|
2026-02-11 15:18:12 -07:00
|
|
|
public static final ConfigurableDouble SHOOTER_SPEED_TOLERANCE = new ConfigurableDouble("Shooter speed tolerance RPS", 1);
|
2026-02-10 18:42:47 -08:00
|
|
|
|
|
|
|
|
|
2026-01-29 18:07:19 -07:00
|
|
|
|
2026-01-27 19:15:37 -07:00
|
|
|
public static Slot0Configs SHOOTER_PID = new Slot0Configs()
|
|
|
|
|
.withKV(0.0)
|
|
|
|
|
.withKP(0.0)
|
|
|
|
|
.withKI(0.0)
|
2026-02-10 17:33:39 -08:00
|
|
|
.withKD(0.2);
|
2026-01-27 19:15:37 -07:00
|
|
|
|
2026-02-09 17:18:54 -08:00
|
|
|
public static Slot0Configs INDEXER_PID = new Slot0Configs()
|
|
|
|
|
.withKV(0.0)
|
|
|
|
|
.withKP(0.0)
|
|
|
|
|
.withKI(0.0)
|
2026-02-10 17:33:39 -08:00
|
|
|
.withKD(0.2);
|
2026-02-09 18:38:55 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public static ConfigurableDouble indexer_kP = new ConfigurableDouble("Indexer KP", 0.2);
|
2026-02-10 17:33:39 -08:00
|
|
|
public static ConfigurableDouble indexer_kI = new ConfigurableDouble("Indexer KI", 0);
|
|
|
|
|
public static ConfigurableDouble indexer_kD = new ConfigurableDouble("Indexer KD", 0);
|
2026-02-09 18:38:55 -08:00
|
|
|
|
|
|
|
|
public static ConfigurableDouble shooter_kP = new ConfigurableDouble("Shooter KP", 0.2);
|
|
|
|
|
public static ConfigurableDouble shooter_kI = new ConfigurableDouble("Shooter KI", 0);
|
|
|
|
|
public static ConfigurableDouble shooter_kD = new ConfigurableDouble("Shooter KD", 0);
|
2026-02-09 17:18:54 -08:00
|
|
|
|
2026-01-10 16:52:43 -07:00
|
|
|
// Limits
|
|
|
|
|
|
|
|
|
|
// 0 is the forward angle on the robot.
|
|
|
|
|
// negative is left, positive is right
|
2026-01-13 10:08:44 -07:00
|
|
|
// public static final Angle ANGLE_LIMIT_LEFT = Degrees.of(-180);
|
|
|
|
|
// public static final Angle ANGLE_LIMIT_RIGHT = Degrees.of(180);
|
2026-01-10 16:52:43 -07:00
|
|
|
|
|
|
|
|
// 0 is paralell to the ground, 90 is directly up
|
2026-02-09 17:18:54 -08:00
|
|
|
// public static final Angle PITCH_LIMIT_UPPER = Degrees.of(90);
|
|
|
|
|
// public static final Angle PITCH_LIMIT_LOWER = Degrees.of(0);
|
2026-01-10 16:52:43 -07:00
|
|
|
|
|
|
|
|
// Motor configs
|
2026-01-13 10:08:44 -07:00
|
|
|
// public static final TalonFXConfiguration ANGLE_MOTOR_CONFIG = new TalonFXConfiguration()
|
|
|
|
|
// .withCurrentLimits(
|
|
|
|
|
// new CurrentLimitsConfigs()
|
|
|
|
|
// .withStatorCurrentLimit(40) // TODO: tune???
|
|
|
|
|
// .withStatorCurrentLimitEnable(true)
|
|
|
|
|
// ).withMotorOutput(
|
|
|
|
|
// new MotorOutputConfigs()
|
|
|
|
|
// .withNeutralMode(NeutralModeValue.Brake) // Must be break because this has to be accurate
|
|
|
|
|
// .withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means
|
|
|
|
|
// );
|
|
|
|
|
|
2026-02-07 14:51:05 -07:00
|
|
|
|
2026-02-09 17:18:54 -08:00
|
|
|
public static final CanDevice SHOOTER1_ID = new CanDevice("SHOOTER 1", 22);
|
|
|
|
|
public static final CanDevice SHOOTER2_ID = new CanDevice("SHOOTER 2", 23);
|
|
|
|
|
public static final CanDevice INDEXER_ID = new CanDevice("INDEXER",24);
|
|
|
|
|
|
2026-01-13 10:08:44 -07:00
|
|
|
|
2026-01-27 18:13:51 -07:00
|
|
|
public static final TalonFXConfiguration SHOOTER1_MOTOR_CONFIG = new TalonFXConfiguration()
|
2026-01-10 16:52:43 -07:00
|
|
|
.withCurrentLimits(
|
|
|
|
|
new CurrentLimitsConfigs()
|
|
|
|
|
.withStatorCurrentLimit(40) // TODO: tune???
|
|
|
|
|
.withStatorCurrentLimitEnable(true)
|
|
|
|
|
).withMotorOutput(
|
|
|
|
|
new MotorOutputConfigs()
|
2026-02-09 17:18:54 -08:00
|
|
|
.withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny
|
2026-01-10 16:52:43 -07:00
|
|
|
.withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means
|
|
|
|
|
);
|
2026-01-27 18:13:51 -07:00
|
|
|
public static final TalonFXConfiguration SHOOTER2_MOTOR_CONFIG = new TalonFXConfiguration()
|
2026-01-10 16:52:43 -07:00
|
|
|
.withCurrentLimits(
|
|
|
|
|
new CurrentLimitsConfigs()
|
|
|
|
|
.withStatorCurrentLimit(40) // TODO: tune???
|
|
|
|
|
.withStatorCurrentLimitEnable(true) // TODO: Figure out what this means
|
|
|
|
|
).withMotorOutput(
|
|
|
|
|
new MotorOutputConfigs()
|
|
|
|
|
.withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny
|
|
|
|
|
.withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means
|
|
|
|
|
);
|
2026-02-09 17:18:54 -08:00
|
|
|
|
2026-01-27 18:13:51 -07:00
|
|
|
public static final TalonFXConfiguration INDEXER_MOTOR_CONFIG = new TalonFXConfiguration()
|
2026-01-10 16:52:43 -07:00
|
|
|
.withCurrentLimits(
|
|
|
|
|
new CurrentLimitsConfigs()
|
|
|
|
|
.withStatorCurrentLimit(40) // TODO: tune???
|
|
|
|
|
.withStatorCurrentLimitEnable(true)
|
|
|
|
|
).withMotorOutput(
|
|
|
|
|
new MotorOutputConfigs()
|
|
|
|
|
.withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny
|
|
|
|
|
.withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means
|
|
|
|
|
);
|
|
|
|
|
}
|