2026-01-27 18:16:23 -08:00
|
|
|
package frc4388.robot.subsystems.intake;
|
|
|
|
|
|
|
|
|
|
import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
|
|
|
|
|
import com.ctre.phoenix6.configs.MotorOutputConfigs;
|
|
|
|
|
import com.ctre.phoenix6.configs.Slot0Configs;
|
|
|
|
|
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-27 18:16:23 -08:00
|
|
|
import frc4388.utility.status.CanDevice;
|
|
|
|
|
|
|
|
|
|
public class IntakeConstants {
|
|
|
|
|
// Motor conversions
|
|
|
|
|
|
2026-02-14 10:55:51 -08:00
|
|
|
public static final double ARM_MOTOR_GEAR_RATIO = 125;
|
2026-02-10 17:33:39 -08:00
|
|
|
public static final double ROLLER_MOTOR_GEAR_RATIO = 3;
|
2026-01-27 18:16:23 -08:00
|
|
|
|
2026-01-29 16:59:53 -07:00
|
|
|
|
2026-02-14 15:00:40 -07:00
|
|
|
|
2026-01-29 16:59:53 -07:00
|
|
|
//IDs
|
|
|
|
|
|
2026-02-09 16:03:48 -08:00
|
|
|
public static final CanDevice ARM_ID = new CanDevice("ARM", 20);
|
|
|
|
|
public static final CanDevice ROLLER_ID = new CanDevice("INTAKE_ROLLER", 21);
|
2026-02-14 15:57:33 -07:00
|
|
|
public static final int ARM_LIMIT_SWITCH_CHANNEL = 9;
|
2026-01-29 16:59:53 -07:00
|
|
|
|
2026-01-27 18:16:23 -08:00
|
|
|
// Limits
|
|
|
|
|
|
|
|
|
|
// 0 is the forward angle on the robot.
|
|
|
|
|
// negative is left, positive is right
|
2026-02-07 14:51:05 -07:00
|
|
|
|
|
|
|
|
//when testing the negative output of 10% made the robot put the intake up
|
|
|
|
|
|
2026-02-09 17:18:54 -08:00
|
|
|
// public static final Angle ARM_LIMIT_LOWER = Degrees.of(90);
|
|
|
|
|
// public static final Angle ARM_LIMIT_UPPER = Degrees.of(-90);
|
|
|
|
|
|
2026-02-21 12:54:16 -08:00
|
|
|
public static final ConfigurableDouble ARM_LIMIT_RETRACTED = new ConfigurableDouble("Arm angle retracted", 0.1);
|
2026-02-19 18:55:00 -08:00
|
|
|
public static final ConfigurableDouble ARM_LIMIT_EXTENDED = new ConfigurableDouble("Arm angle extended", 0.3);
|
2026-02-28 13:36:49 -07:00
|
|
|
public static final ConfigurableDouble ARM_EXTEND_PERCENT_OUTPUT = new ConfigurableDouble("Arm extend % output", 0.4);
|
2026-02-19 18:55:00 -08:00
|
|
|
public static final ConfigurableDouble ARM_RETRACT_PERCENT_OUTPUT = new ConfigurableDouble("Arm retract % output", -0.4);
|
2026-03-06 22:52:06 -07:00
|
|
|
public static final ConfigurableDouble ROLLER_PERCENT_OUTPUT = new ConfigurableDouble("Roller Percent Output", .70);
|
2026-02-09 17:18:54 -08:00
|
|
|
// public static final ConfigurableDouble ROLL = new ConfigurableDouble("Arm angle extended", 0.25);
|
|
|
|
|
|
|
|
|
|
// public static final AngularVelocity ROLLER_MAX_VELOCITY = RotationsPerSecond.of(4.0);
|
|
|
|
|
// public static final AngularVelocity ROLLER_STOP = RotationsPerSecond.of(0.0);
|
2026-01-29 18:07:19 -07:00
|
|
|
|
2026-01-27 18:16:23 -08:00
|
|
|
|
|
|
|
|
public static final Slot0Configs ARM_PID = new Slot0Configs()
|
2026-02-28 12:57:00 -07:00
|
|
|
.withKP(0.08)
|
2026-01-27 18:16:23 -08:00
|
|
|
.withKI(0.0)
|
2026-02-28 13:36:49 -07:00
|
|
|
.withKD(0.05);
|
2026-01-27 18:16:23 -08:00
|
|
|
|
2026-02-17 18:53:26 -08:00
|
|
|
|
2026-01-27 18:16:23 -08:00
|
|
|
|
2026-02-28 12:05:13 -07:00
|
|
|
public static ConfigurableDouble arm_kP = new ConfigurableDouble("ARM KP", 0.08);
|
2026-02-10 17:33:39 -08:00
|
|
|
public static ConfigurableDouble arm_kI = new ConfigurableDouble("ARM KI", 0);
|
2026-02-28 13:36:49 -07:00
|
|
|
public static ConfigurableDouble arm_kD = new ConfigurableDouble("ARM KD", 0.05);
|
2026-02-09 18:38:55 -08:00
|
|
|
|
2026-02-17 18:53:26 -08:00
|
|
|
|
2026-02-09 18:38:55 -08:00
|
|
|
|
|
|
|
|
|
2026-01-27 18:16:23 -08:00
|
|
|
// 0 is paralell to the ground, 90 is directly up
|
|
|
|
|
// public static final Angle PITCH_LIMIT_UPPER = Degrees.of(90);
|
|
|
|
|
// public static final Angle PITCH_LIMIT_LOWER = Degrees.of(0);
|
|
|
|
|
|
|
|
|
|
// Motor configs
|
|
|
|
|
public static final TalonFXConfiguration ARM_MOTOR_CONFIG = new TalonFXConfiguration()
|
|
|
|
|
.withCurrentLimits(
|
|
|
|
|
new CurrentLimitsConfigs()
|
2026-02-14 10:55:51 -08:00
|
|
|
.withStatorCurrentLimit(15) // TODO: tune???
|
2026-01-27 18:16:23 -08:00
|
|
|
.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
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
public static final TalonFXConfiguration ROLLER_MOTOR_CONFIG = new TalonFXConfiguration()
|
|
|
|
|
.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
|
|
|
|
|
);
|
|
|
|
|
}
|