mirror of
https://github.com/Team4388/2026KPopRobotHunters.git
synced 2026-06-09 00:38:03 -06:00
Switch Motor type
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package frc4388.robot.subsystems.intake;
|
||||
|
||||
import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
|
||||
import com.ctre.phoenix6.configs.MotorOutputConfigs;
|
||||
import com.ctre.phoenix6.configs.TalonFXConfiguration;
|
||||
import com.ctre.phoenix6.signals.NeutralModeValue;
|
||||
import com.revrobotics.spark.FeedbackSensor;
|
||||
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||
import com.revrobotics.spark.config.LimitSwitchConfig.Behavior;
|
||||
@@ -85,7 +89,7 @@ public class IntakeConstants {
|
||||
// Motor configs
|
||||
|
||||
public static final SparkMaxConfig ARM_MOTOR_CONFIG = new SparkMaxConfig();
|
||||
public static final SparkMaxConfig ROLELR_MOTOR_CONFIG = new SparkMaxConfig();
|
||||
public static final CanDevice ROLLER_MOTOR_ID = new CanDevice("INTAKE_ROLLER", 21);
|
||||
|
||||
static {
|
||||
ARM_MOTOR_CONFIG.limitSwitch
|
||||
@@ -101,7 +105,7 @@ public class IntakeConstants {
|
||||
ARM_MOTOR_CONFIG.idleMode(IdleMode.kBrake);
|
||||
|
||||
|
||||
ROLELR_MOTOR_CONFIG.idleMode(IdleMode.kCoast);
|
||||
// ROLLER_MOTOR_CONFIG.idleMode(IdleMode.kCoast);
|
||||
}
|
||||
|
||||
// public static final TalonFXConfiguration ARM_MOTOR_CONFIG = new TalonFXConfiguration()
|
||||
@@ -115,14 +119,14 @@ public class IntakeConstants {
|
||||
// .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
|
||||
// );
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,17 +21,18 @@ import edu.wpi.first.units.measure.Angle;
|
||||
import edu.wpi.first.units.measure.Velocity;
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.DutyCycleEncoder;
|
||||
import frc4388.robot.subsystems.shooter.ShooterConstants;
|
||||
import frc4388.utility.compute.JankCoder;
|
||||
|
||||
public class IntakeReal implements IntakeIO {
|
||||
|
||||
SparkMax m_armMotor;
|
||||
SparkMax m_rollerMotor;
|
||||
TalonFX m_rollerMotor;
|
||||
JankCoder m_encoder;
|
||||
|
||||
public IntakeReal(
|
||||
SparkMax armMotor,
|
||||
SparkMax rollerMotor,
|
||||
TalonFX rollerMotor,
|
||||
JankCoder jankCoder
|
||||
) {
|
||||
// m_angleMotor = angleMotor;
|
||||
@@ -41,7 +42,7 @@ public class IntakeReal implements IntakeIO {
|
||||
m_encoder = jankCoder;
|
||||
|
||||
m_armMotor.configure(IntakeConstants.ARM_MOTOR_CONFIG, ResetMode.kNoResetSafeParameters, PersistMode.kPersistParameters);
|
||||
m_rollerMotor.configure(IntakeConstants.ROLELR_MOTOR_CONFIG, ResetMode.kNoResetSafeParameters, PersistMode.kPersistParameters);
|
||||
m_rollerMotor.getConfigurator().apply(IntakeConstants.ROLLER_MOTOR_CONFIG);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +114,7 @@ public class IntakeReal implements IntakeIO {
|
||||
state.armMotorCurrent = Amps.of(m_armMotor.getOutputCurrent());
|
||||
|
||||
state.rollerOutput = m_rollerMotor.get();
|
||||
state.rollerMotorCurrent = Amps.of(m_rollerMotor.getOutputCurrent());
|
||||
// state.rollerMotorCurrent = Amps.of(m_rollerMotor.getOutputCurrent());
|
||||
|
||||
state.retractedSoftLimit = retractedLimit();
|
||||
state.extendedSoftLimit = extendedLimit();
|
||||
|
||||
Reference in New Issue
Block a user