Add indexer current

This commit is contained in:
mimigamin
2026-04-02 18:27:51 -06:00
parent 82be568dc4
commit 3750a97424
4 changed files with 8 additions and 20 deletions
@@ -44,6 +44,6 @@ public class ClimberConstants {
).withMotorOutput( ).withMotorOutput(
new MotorOutputConfigs() new MotorOutputConfigs()
.withNeutralMode(NeutralModeValue.Brake) // Must be break because this has to be accurate .withNeutralMode(NeutralModeValue.Brake) // Must be break because this has to be accurate
.withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means .withDutyCycleNeutralDeadband(0.04) // This sets the minimum output of motor so if its less than 4% it wont move
); );
} }
@@ -116,7 +116,7 @@ public class IntakeConstants {
// ).withMotorOutput( // ).withMotorOutput(
// new MotorOutputConfigs() // new MotorOutputConfigs()
// .withNeutralMode(NeutralModeValue.Brake) // Must be break because this has to be accurate // .withNeutralMode(NeutralModeValue.Brake) // Must be break because this has to be accurate
// .withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means // .withDutyCycleNeutralDeadband(0.04) // This sets the minimum output of motor so if its less than 4% it wont move
// ); // );
public static final TalonFXConfiguration ROLLER_MOTOR_CONFIG = new TalonFXConfiguration() public static final TalonFXConfiguration ROLLER_MOTOR_CONFIG = new TalonFXConfiguration()
@@ -127,6 +127,6 @@ public class IntakeConstants {
).withMotorOutput( ).withMotorOutput(
new MotorOutputConfigs() new MotorOutputConfigs()
.withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny .withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny
.withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means .withDutyCycleNeutralDeadband(0.04) // This sets the minimum output of motor so if its less than 4% it wont move
); );
} }
@@ -1,27 +1,15 @@
package frc4388.robot.subsystems.intake; package frc4388.robot.subsystems.intake;
import static edu.wpi.first.units.Units.Amps; import static edu.wpi.first.units.Units.Amps;
import static edu.wpi.first.units.Units.Rotation;
import static edu.wpi.first.units.Units.Rotations; import static edu.wpi.first.units.Units.Rotations;
import static edu.wpi.first.units.Units.RotationsPerSecond; import static edu.wpi.first.units.Units.RotationsPerSecond;
import static edu.wpi.first.units.Units.RotationsPerSecondPerSecond;
import com.ctre.phoenix6.controls.DutyCycleOut;
import com.ctre.phoenix6.controls.PositionDutyCycle;
import com.ctre.phoenix6.controls.PositionVoltage;
import com.ctre.phoenix6.hardware.TalonFX; import com.ctre.phoenix6.hardware.TalonFX;
import com.revrobotics.PersistMode; import com.revrobotics.PersistMode;
import com.revrobotics.ResetMode; import com.revrobotics.ResetMode;
import com.revrobotics.spark.SparkMax; import com.revrobotics.spark.SparkMax;
import edu.wpi.first.math.trajectory.TrapezoidProfile;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.units.measure.Acceleration;
import edu.wpi.first.units.measure.Angle; 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; import frc4388.utility.compute.JankCoder;
public class IntakeReal implements IntakeIO { public class IntakeReal implements IntakeIO {
@@ -114,7 +102,7 @@ public class IntakeReal implements IntakeIO {
state.armMotorCurrent = Amps.of(m_armMotor.getOutputCurrent()); state.armMotorCurrent = Amps.of(m_armMotor.getOutputCurrent());
state.rollerOutput = m_rollerMotor.get(); state.rollerOutput = m_rollerMotor.get();
// state.rollerMotorCurrent = Amps.of(m_rollerMotor.getOutputCurrent()); state.rollerMotorCurrent = m_rollerMotor.getStatorCurrent().getValue();
state.retractedSoftLimit = retractedLimit(); state.retractedSoftLimit = retractedLimit();
state.extendedSoftLimit = extendedLimit(); state.extendedSoftLimit = extendedLimit();
@@ -16,7 +16,7 @@ public class ShooterConstants {
// Motor conversions // Motor conversions
public static final double SHOOTERMOTOR_GEAR_RATIO = 1.286; // TODO: supposed to be 9 rotations in to 7 out -- 0.77 or 1.29 public static final double SHOOTERMOTOR_GEAR_RATIO = 1.286; // TODO: supposed to be 9 rotations in to 7 out -- 0.77 or 1.29
public static final double INDEXER_GEAR_RATIO = 1.72; // TODO: change it is supposed to be 18 to 31 // public static final double INDEXER_GEAR_RATIO = 1.;
public static final double T_CONSTANT = 2; public static final double T_CONSTANT = 2;
public static final double SHOOTER_RADIUS = 2/39.37; public static final double SHOOTER_RADIUS = 2/39.37;
public static final double INDEXER_RADIUS = 0.625/39.37; public static final double INDEXER_RADIUS = 0.625/39.37;
@@ -116,7 +116,7 @@ public class ShooterConstants {
).withMotorOutput( ).withMotorOutput(
new MotorOutputConfigs() new MotorOutputConfigs()
.withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny .withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny
.withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means .withDutyCycleNeutralDeadband(0.04) // This sets the minimum output of motor so if its less than 4% it wont move
); );
public static final TalonFXConfiguration SHOOTER2_MOTOR_CONFIG = new TalonFXConfiguration() public static final TalonFXConfiguration SHOOTER2_MOTOR_CONFIG = new TalonFXConfiguration()
.withCurrentLimits( .withCurrentLimits(
@@ -126,7 +126,7 @@ public class ShooterConstants {
).withMotorOutput( ).withMotorOutput(
new MotorOutputConfigs() new MotorOutputConfigs()
.withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny .withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny
.withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means .withDutyCycleNeutralDeadband(0.04) // This sets the minimum output of motor so if its less than 4% it wont move
); );
public static final TalonFXConfiguration INDEXER_MOTOR_CONFIG = new TalonFXConfiguration() public static final TalonFXConfiguration INDEXER_MOTOR_CONFIG = new TalonFXConfiguration()
@@ -137,6 +137,6 @@ public class ShooterConstants {
).withMotorOutput( ).withMotorOutput(
new MotorOutputConfigs() new MotorOutputConfigs()
.withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny .withNeutralMode(NeutralModeValue.Coast) // Must be coast because this is spinny spinny
.withDutyCycleNeutralDeadband(0.04) // TODO: Figure out what this means .withDutyCycleNeutralDeadband(0.04) // This sets the minimum output of motor so if its less than 4% it wont move
); );
} }