From bd96a93b14d17d71668ed10f7ef0032367d5c3e0 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 21 Mar 2022 19:29:59 -0600 Subject: [PATCH] fixes --- src/main/java/frc4388/robot/Constants.java | 6 +++--- src/main/java/frc4388/robot/Robot.java | 4 ++-- src/main/java/frc4388/robot/RobotContainer.java | 12 ++++++------ .../robot/commands/ShooterCommands/TrackTarget.java | 2 +- .../java/frc4388/robot/subsystems/SwerveDrive.java | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/frc4388/robot/Constants.java b/src/main/java/frc4388/robot/Constants.java index 650a28d..62b8598 100644 --- a/src/main/java/frc4388/robot/Constants.java +++ b/src/main/java/frc4388/robot/Constants.java @@ -85,7 +85,7 @@ public final class Constants { // swerve auto constants public static final PIDController X_CONTROLLER = new PIDController(0.5, 0.0, 0.0); public static final PIDController Y_CONTROLLER = new PIDController(2.0, 0.0, 0.0); - public static final ProfiledPIDController THETA_CONTROLLER = new ProfiledPIDController(15.0, 0.1, 0.3, + public static final ProfiledPIDController THETA_CONTROLLER = new ProfiledPIDController(1.0, 0.0, 0.0, new TrapezoidProfile.Constraints(Math.PI, Math.PI)); public static final boolean PATH_RECORD_VELOCITY = true; public static final double PATH_MAX_VELOCITY = 5.0; @@ -326,8 +326,8 @@ public final class Constants { public static final double TARGET_RADIUS = 4*12; //TODO: Convert to metric (does this still need to be converted?) public static final double H_FOV = 59.6; public static final double V_FOV = 45.7; - public static final double LIME_HIXELS = 920; - public static final double LIME_VIXELS = 720; + public static final double LIME_HIXELS = 640; + public static final double LIME_VIXELS = 480; public static final double TURRET_kP = 0.1; public static final double POINTS_THRESHOLD = 400; diff --git a/src/main/java/frc4388/robot/Robot.java b/src/main/java/frc4388/robot/Robot.java index 9929191..4825709 100644 --- a/src/main/java/frc4388/robot/Robot.java +++ b/src/main/java/frc4388/robot/Robot.java @@ -121,7 +121,7 @@ public class Robot extends TimedRobot { }); desmosServer.start(); - m_robotContainer.m_robotVisionOdometry.setLEDs(false); + m_robotContainer.m_robotVisionOdometry.setLEDs(true); // DesmosServer.putTable("table", "x1", new double[] {44}, "y1", new double[] {0}); } @@ -183,7 +183,7 @@ public class Robot extends TimedRobot { LOGGER.log(Level.SEVERE, "Unable to record path to {0}", outputFile.getPath()); } - m_robotContainer.m_robotVisionOdometry.setLEDs(false); + m_robotContainer.m_robotVisionOdometry.setLEDs(true); } @Override diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index c509da2..adbc00d 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -267,8 +267,8 @@ public class RobotContainer { .whenPressed(new InstantCommand(() -> m_robotClaws.toggleClaws(), m_robotClaws)); // X > Toggles extender in and out - // new JoystickButton(getOperatorController(), XboxController.Button.kX.value) - // .whenPressed(new ExtenderIntakeGroup(m_robotIntake, m_robotExtender)); + new JoystickButton(getOperatorController(), XboxController.Button.kX.value) + .whenPressed(new ExtenderIntakeGroup(m_robotIntake, m_robotExtender)); // A > Spit Out Ball new JoystickButton(getOperatorController(), XboxController.Button.kA.value) @@ -281,10 +281,10 @@ public class RobotContainer { //! Test Buttons - new JoystickButton(getOperatorController(), XboxController.Button.kY.value) - .whenPressed(new Shoot(m_robotSwerveDrive, m_robotBoomBoom, m_robotTurret, m_robotHood, m_robotVisionOdometry, false, false)); + // new JoystickButton(getOperatorController(), XboxController.Button.kY.value) + // .whenPressed(new Shoot(m_robotSwerveDrive, m_robotBoomBoom, m_robotTurret, m_robotHood, m_robotVisionOdometry, false, false)); - new JoystickButton(getOperatorController(), XboxController.Button.kX.value) + new JoystickButton(getOperatorController(), XboxController.Button.kY.value) .whileHeld(new TrackTarget(m_robotSwerveDrive, m_robotTurret, m_robotBoomBoom, m_robotHood, m_robotVisionOdometry)); // new JoystickButton(getOperatorController(), XboxController.Button.kY.value) @@ -425,7 +425,7 @@ public class RobotContainer { // * new SequentialCommandGroup(buildAuto(5.0, 5.0, "Path1", "Path2", "Path3")), // * new RunCommand(() -> m_robotIntake.runAtOutput(0.5)))); - return new SequentialCommandGroup(buildAuto(1.0, 1.0, new InstantCommand(() -> m_robotSwerveDrive.m_gyro.reset()), "Move Forward")); // test command + return new SequentialCommandGroup(buildAuto(0.5, 0.5, new InstantCommand(() -> m_robotSwerveDrive.m_gyro.reset()), "Move Forward")); // test command } public static XboxController getDriverController() { diff --git a/src/main/java/frc4388/robot/commands/ShooterCommands/TrackTarget.java b/src/main/java/frc4388/robot/commands/ShooterCommands/TrackTarget.java index 3c83331..17b76fd 100644 --- a/src/main/java/frc4388/robot/commands/ShooterCommands/TrackTarget.java +++ b/src/main/java/frc4388/robot/commands/ShooterCommands/TrackTarget.java @@ -74,7 +74,7 @@ public class TrackTarget extends CommandBase { Point average = VisionOdometry.averagePoint(points); double output = (average.x - VisionConstants.LIME_HIXELS/2.d) / VisionConstants.LIME_HIXELS; - output *= 2; + output *= 1.3; m_turret.runTurretWithInput(output); double position = m_turret.m_boomBoomRotateEncoder.getPosition(); diff --git a/src/main/java/frc4388/robot/subsystems/SwerveDrive.java b/src/main/java/frc4388/robot/subsystems/SwerveDrive.java index ed9c193..76d5597 100644 --- a/src/main/java/frc4388/robot/subsystems/SwerveDrive.java +++ b/src/main/java/frc4388/robot/subsystems/SwerveDrive.java @@ -228,7 +228,7 @@ public class SwerveDrive extends SubsystemBase { * Updates the field relative position of the robot. */ public void updateOdometry() { - m_poseEstimator.update( getRegGyro(), + m_poseEstimator.update( new Rotation2d( (Math.PI * 2)- getRegGyro().getRadians()), modules[0].getState(), modules[1].getState(), modules[2].getState(),