From 26ef775088f9255de34081f4e073ecfa454d1d74 Mon Sep 17 00:00:00 2001 From: Team2890HawkCollective <2890frc@gmail.com> Date: Sat, 21 Feb 2026 09:23:04 -0500 Subject: [PATCH] fixed intake and indexer along with their RPM updates from elastic --- src/main/java/frc/robot/Constants.java | 38 +++++++------------ src/main/java/frc/robot/Robot.java | 6 ++- src/main/java/frc/robot/RobotContainer.java | 9 +---- .../frc/robot/subsystems/IntakeSubsystem.java | 8 ++-- 4 files changed, 22 insertions(+), 39 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index e9c5feb..7e952c1 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -68,13 +68,13 @@ public final class Constants { } public static class ShooterConstants { - private static GenericEntry shooterVelocity = programmingTab.add("Desired Shooter RPM", -1000) + private static GenericEntry shooterRPM = programmingTab.add("Desired Shooter RPM", -5000) .withWidget(BuiltInWidgets.kNumberBar).getEntry(); public static double SHOOTER_RPM; - public static void getShooterVelocity() { - SHOOTER_RPM = shooterVelocity.getDouble(-1000); + public static void updateShooterRPM() { + SHOOTER_RPM = shooterRPM.getDouble(-5000); } public static final int CENTER_SHOOTER_MOTOR_ID = 42; @@ -87,27 +87,24 @@ public final class Constants { public static double SHOOTER_MOTOR_I = 0; public static double SHOOTER_MOTOR_D = 0; - private static GenericEntry indexerAndRampRPM = programmingTab.add("Desired Ramp + Indexer Speed", 1000) + private static GenericEntry indexerAndRampRPM = programmingTab.add("Desired Ramp + Indexer Speed", 2000) .withWidget(BuiltInWidgets.kNumberBar).getEntry(); // this method called in robot periodic so values updated in elastic are // constantly read and applied to RAMP_MOTOR_SPEED - public static void getIndexerAndRampMotorRPM() { - INDEXER_AND_RAMP_MOTOR_RPM = indexerAndRampRPM.getDouble(1000); + public static void updateIndexerAndRampMotorRPM() { + INDEXER_AND_RAMP_MOTOR_RPM = indexerAndRampRPM.getDouble(2000); } } public static class IntakeConstants { - private static GenericEntry intakeSpeed = programmingTab.add("Desired Intake Speed", -0.65) - .withWidget(BuiltInWidgets.kNumberBar).getEntry(); - public static double INTAKE_WHEELS_MOTOR_SPEED; private static GenericEntry intakeRPM = programmingTab.add("Desired Intake RPM", -1000) .withWidget(BuiltInWidgets.kNumberBar).getEntry(); public static double INTAKE_WHEELS_MOTOR_RPM; - public static void getIntakeWheelsSpeed() { + public static void updateIntakeWheelsRPM() { INTAKE_WHEELS_MOTOR_RPM = intakeRPM.getDouble(-1000); } @@ -119,31 +116,20 @@ public final class Constants { public static final double INTAKE_ROTATOR_I = 0; public static final double INTAKE_ROTATOR_D = 0; } + public static final double INTAKE_MOTOR_P = 0.01; + public static final double INTAKE_MOTOR_I = 0; + public static final double INTAKE_MOTOR_D = 0; public static final double INTAKE_COLLECT_ENCODER_VALUE = 4.1290459632873535; public static final double INTAKE_MIDDLE_ENCODER_VALUE = 1.2550222873687744; public static final double INTAKE_RETRACT_ENCODER_VALUE = 0; } - public static class RampConstants { - public static final int RAMP_MOTOR_ID = 45; - // create object and a new widget under programming tab in Elastic where object - // retrieves value from widget - private static GenericEntry rampSpeed = programmingTab.add("Desired Ramp Speed", 0.4) - .withWidget(BuiltInWidgets.kNumberBar).getEntry(); - - // this method called in robot periodic so values updated in elastic are - // constantly read and applied to RAMP_MOTOR_SPEED - public static void getRampMotorSpeed() { - RAMP_MOTOR_SPEED = rampSpeed.getDouble(0.4); - } - - public static double RAMP_MOTOR_SPEED = .6; // create object and a new widget under programming tab in Elastic where object // retrieves value from widget - } + public static class TargetingConstants { public static final Pose2d RIGHT_CLIMB_POSE = new Pose2d(1.075, 4.75, Rotation2d.fromDegrees(90)); @@ -154,6 +140,8 @@ public final class Constants { public static final PhotonCamera RED_PHOTON_CAM = new PhotonCamera("Arducam_OV9281_USB_Camera"); public static final PhotonCamera PURPLE_PHOTON_CAM = new PhotonCamera("Arducam_OV9281_USB_Camera"); + public static final Pose2d HUB_POSE = new Pose2d(4.625, 4.03, new Rotation2d()); + public static final Transform3d ORANGE_ROBOT_TO_CAM = new Transform3d(new Translation3d(0, 0, 0), new Rotation3d(0, 0, 0)); public static final Transform3d BLACK_ROBOT_TO_CAM = new Transform3d(new Translation3d(0, 0, 0), diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index ad3215a..c06db05 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -87,8 +87,10 @@ public class Robot extends TimedRobot { CommandScheduler.getInstance().run(); // Constants.ShooterConstants.getRampAndIndexerMotorSpeed(); - Constants.IntakeConstants.getIntakeWheelsSpeed(); - Constants.ShooterConstants.getShooterVelocity(); + Constants.IntakeConstants.updateIntakeWheelsRPM(); + Constants.ShooterConstants.updateShooterRPM(); + Constants.ShooterConstants.updateIndexerAndRampMotorRPM(); + TargetingSubsystems.updateRobotPose(Constants.TargetingConstants.ORANGE_PHOTON_CAM, Constants.TargetingConstants.ORANGE_PHOTON_ESTIMATOR, m_robotContainer.getSwerveDrive()); TargetingSubsystems.updateRobotPose(Constants.TargetingConstants.BLACK_PHOTON_CAM, diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index bec6a7c..b715c8a 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -175,7 +175,7 @@ public class RobotContainer { Command driveSetpointGenKeyboard = drivebase.driveWithSetpointGeneratorFieldRelative( driveDirectAngleKeyboard); - driverXbox.leftTrigger().onTrue(m_IntakeSubsystem.startIntakeMotorCommand()) + driverXbox.leftTrigger().whileTrue(m_IntakeSubsystem.startIntakeMotorCommand()) .onFalse(m_IntakeSubsystem.stopIntakeMotorCommand()); driverXbox.leftBumper().whileTrue(m_IntakeSubsystem.reverseIntakeMotorCommand()) .onFalse(m_IntakeSubsystem.stopIntakeMotorCommand()); @@ -202,13 +202,6 @@ public class RobotContainer { .andThen(m_IntakeSubsystem.deployintakeCommand())); // driverXbox.a().whileTrue(aimAtHopperCommand(() -> -driverXbox.getLeftY(), // () -> -driverXbox.getLeftX())); - if (driverXbox.getRightY() < -0.4) { - m_ClimberSubsystem.liftRobotCommand(); - } else if (driverXbox.getRightY() > 0.4) { - m_ClimberSubsystem.lowerRobotCommand(); - } else { - m_ClimberSubsystem.stopClimberCommand(); - } // driverXbox.b().whileTrue(m_TargetingSubsystems.aimAndRangeToPose(Constants.TargetingConstants.LEFT_CLIMB_POSE)); diff --git a/src/main/java/frc/robot/subsystems/IntakeSubsystem.java b/src/main/java/frc/robot/subsystems/IntakeSubsystem.java index e7e04e0..6952760 100644 --- a/src/main/java/frc/robot/subsystems/IntakeSubsystem.java +++ b/src/main/java/frc/robot/subsystems/IntakeSubsystem.java @@ -38,9 +38,9 @@ public class IntakeSubsystem extends SubsystemBase { com.revrobotics.PersistMode.kNoPersistParameters); intakeRotatorPIDController = intakeRotatorMotor.getClosedLoopController(); - intakeWheelsMotorConfig.closedLoop.pid(Constants.ShooterConstants.SHOOTER_MOTOR_P, - Constants.ShooterConstants.SHOOTER_MOTOR_I, - Constants.ShooterConstants.SHOOTER_MOTOR_D); + intakeWheelsMotorConfig.closedLoop.pid(Constants.IntakeConstants.INTAKE_MOTOR_P, + Constants.IntakeConstants.INTAKE_MOTOR_I, + Constants.IntakeConstants.INTAKE_MOTOR_D); intakeWheelsMotor.configure(intakeWheelsMotorConfig, com.revrobotics.ResetMode.kNoResetSafeParameters, com.revrobotics.PersistMode.kNoPersistParameters); intakeWheelsMotorPIDController = intakeWheelsMotor.getClosedLoopController(); @@ -55,7 +55,7 @@ public class IntakeSubsystem extends SubsystemBase { } public void stopIntakeMotor() { - intakeWheelsMotorPIDController.setSetpoint(Constants.IntakeConstants.INTAKE_WHEELS_MOTOR_RPM * -1, ControlType.kVelocity); + intakeWheelsMotor.set(0); } public Command startIntakeMotorCommand() {