highlanders changes

This commit is contained in:
Shikhar
2026-04-04 20:41:00 -06:00
parent 74009b86bb
commit f9b9a7dd30
9 changed files with 138 additions and 74 deletions
@@ -158,9 +158,9 @@ public class RobotContainer {
//new AutoAlign(m_robotSwerveDrive, m_vision, new Pose2d(FieldPositions.HUB_POSITION, new Rotation2d(0)), false),
new WaitUntilCommand(m_robotShooter::isShooterUpToSpeed),
new InstantCommand(()-> m_robotShooter.allowShooting(), m_robotShooter),
new WaitCommand(5),
new WaitCommand(4),
IntakeRetracted,
new WaitCommand(10),
new WaitCommand(7),
new InstantCommand(() -> m_robotShooter.denyShooting(), m_robotShooter),
new InstantCommand(()->m_robotShooter.spinUpIdle(), m_robotShooter)
);
@@ -375,7 +375,13 @@ public class RobotContainer {
.onTrue(new InstantCommand(() -> {
m_robotIntake.setMode(IntakeMode.ExtendingRolling);
}));
new JoystickButton(getDeadbandedOperatorController(), XboxController.B_BUTTON)
.onTrue(new InstantCommand(() -> {
m_robotIntake.setMode(IntakeMode.LabubuGrowl);
}))
.onFalse(new InstantCommand(() -> {
m_robotIntake.setMode(IntakeMode.ExtendingRolling);
}));
new JoystickButton(getDeadbandedOperatorController(), XboxController.Y_BUTTON)
.onTrue(new InstantCommand(() -> {
m_robotIntake.setMode(IntakeMode.Retracting);
@@ -7,12 +7,12 @@ public final class BuildConstants {
public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "2026KPopRobotHunters";
public static final String VERSION = "unspecified";
public static final int GIT_REVISION = 216;
public static final String GIT_SHA = "8fb8d8d43669f24867bc94d6e4175a7325ec72c8";
public static final String GIT_DATE = "2026-04-04 13:03:52 MDT";
public static final int GIT_REVISION = 218;
public static final String GIT_SHA = "74009b86bbde67d814d16020ce4cec00b8267411";
public static final String GIT_DATE = "2026-04-04 16:17:27 MDT";
public static final String GIT_BRANCH = "New-Intake";
public static final String BUILD_DATE = "2026-04-04 15:23:52 MDT";
public static final long BUILD_UNIX_TIME = 1775337832371L;
public static final String BUILD_DATE = "2026-04-04 19:50:19 MDT";
public static final long BUILD_UNIX_TIME = 1775353819651L;
public static final int DIRTY = 1;
private BuildConstants(){}
@@ -42,7 +42,8 @@ public class Intake extends SubsystemBase {
Idle,
RectractTorque,
Bouncing,
ExpelBalls
ExpelBalls,
LabubuGrowl
}
private boolean overCompressed = false;
@@ -101,20 +102,20 @@ public class Intake extends SubsystemBase {
public void periodic() {
// FaultReporter.register(this); // TODO Implement fault reporter
// System.out.println(m_armLimitSwitch.get());
ChassisSpeeds chassisSpeeds = m_SwerveDrive.chassisSpeeds;
// ChassisSpeeds chassisSpeeds = m_SwerveDrive.chassisSpeeds;
double ChassisOverallSpeed = Math.hypot(chassisSpeeds.vxMetersPerSecond, chassisSpeeds.vyMetersPerSecond);
// double ChassisOverallSpeed = Math.hypot(chassisSpeeds.vxMetersPerSecond, chassisSpeeds.vyMetersPerSecond);
Logger.processInputs("Intake", state);
Logger.recordOutput("Intake/IntakeState", this.mode);
io.updateInputs(state);
overCompressed =
Math.abs(state.armMotorCurrent.in(Amps)) > IntakeConstants.INTAKE_BOUNCE_CURRENT_LIMIT.get();
// Math.abs(state.armMotorVelocity.in(RotationsPerSecond)) < IntakeConstants.INTAKE_BOUNCE_VELOCITY_LIMIT.get();
// overCompressed =
// Math.abs(state.armMotorCurrent.in(Amps)) > IntakeConstants.INTAKE_BOUNCE_CURRENT_LIMIT.get();
// // Math.abs(state.armMotorVelocity.in(RotationsPerSecond)) < IntakeConstants.INTAKE_BOUNCE_VELOCITY_LIMIT.get();
Logger.recordOutput("overCompressed", overCompressed);
// Logger.recordOutput("overCompressed", overCompressed);
// getCurrentTime
@@ -196,6 +197,10 @@ public class Intake extends SubsystemBase {
io.armOutput(0);
io.setRollerOutput(state, IntakeConstants.ROLLER_EJECT_PERCENT_OUTPUT.get());
break;
case LabubuGrowl:
io.armOutput(0);
io.setRollerOutput(state, IntakeConstants.ROLLER_LABUBU_GROWL_PERCENT_OUTPUT.get());
break;
}
// if (state.retractedLimit){
// this.mode = IntakeMode.Retracted;
@@ -63,6 +63,7 @@ public class IntakeConstants {
public static final ConfigurableDouble ARM_REVERSE_ROLLER_RANGE = new ConfigurableDouble("Arm reverse roller range", 1.17);
public static final ConfigurableDouble ROLLER_PERCENT_OUTPUT = new ConfigurableDouble("Roller Percent Output", .50);
public static final ConfigurableDouble ROLLER_LABUBU_GROWL_PERCENT_OUTPUT = new ConfigurableDouble("Roller Labubu Growl Percent Output", .75);
public static final ConfigurableDouble ROLLER_EJECT_PERCENT_OUTPUT = new ConfigurableDouble("Roller eject Percent Output", -.20);
public static final ConfigurableDouble ROLLER_IDLE_PERCENT_OUTPUT = new ConfigurableDouble("Roller IDLE Percent Output", .20);
public static final ConfigurableDouble ROLLER_RETRACT_PERCENT_OUTPUT = new ConfigurableDouble("Roller Retract Output", .40);
@@ -7,6 +7,8 @@ import static edu.wpi.first.units.Units.RotationsPerSecond;
import com.ctre.phoenix6.hardware.TalonFX;
import com.revrobotics.PersistMode;
import com.revrobotics.ResetMode;
import com.revrobotics.RelativeEncoder;
import com.revrobotics.spark.SparkLimitSwitch;
import com.revrobotics.spark.SparkMax;
import edu.wpi.first.units.measure.Angle;
@@ -15,6 +17,8 @@ import frc4388.utility.compute.JankCoder;
public class IntakeReal implements IntakeIO {
SparkMax m_armMotor;
RelativeEncoder arm_encoder;
SparkLimitSwitch reverse_limit;
TalonFX m_rollerMotor;
JankCoder m_encoder;
@@ -26,6 +30,8 @@ public class IntakeReal implements IntakeIO {
// m_angleMotor = angleMotor;
// m_pitchMotor = pitchMotor;
m_armMotor = armMotor;
arm_encoder = m_armMotor.getEncoder();
reverse_limit = m_armMotor.getReverseLimitSwitch();
m_rollerMotor = rollerMotor;
m_encoder = jankCoder;
@@ -96,8 +102,8 @@ public class IntakeReal implements IntakeIO {
m_encoder.update();
state.armAngle = Rotations.of(m_armMotor.getEncoder().getPosition()).div(IntakeConstants.ARM_MOTOR_GEAR_RATIO);
state.armMotorVelocity = RotationsPerSecond.of(m_armMotor.getEncoder().getVelocity()).div(IntakeConstants.ARM_MOTOR_GEAR_RATIO);
state.armAngle = Rotations.of(arm_encoder.getPosition()).div(IntakeConstants.ARM_MOTOR_GEAR_RATIO);
state.armMotorVelocity = RotationsPerSecond.of(arm_encoder.getVelocity()).div(IntakeConstants.ARM_MOTOR_GEAR_RATIO);
// state.armMotorAcceleration = RotationsPerSecondPerSecond.of(m_armMotor.getEncoder().ge);
state.armMotorCurrent = Amps.of(m_armMotor.getOutputCurrent());
@@ -110,7 +116,7 @@ public class IntakeReal implements IntakeIO {
state.intakeEncoder = m_encoder.getRotations();
state.encoderConnected = m_encoder.isConnected();
state.retractedLimitSwitch = m_armMotor.getReverseLimitSwitch().isPressed();
state.retractedLimitSwitch = reverse_limit.isPressed();
if(state.retractedLimitSwitch) {
m_encoder.resetRotations();