This commit is contained in:
Ryan
2022-03-21 19:29:59 -06:00
parent f8092825f6
commit bd96a93b14
5 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -85,7 +85,7 @@ public final class Constants {
// swerve auto constants // swerve auto constants
public static final PIDController X_CONTROLLER = new PIDController(0.5, 0.0, 0.0); 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 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)); new TrapezoidProfile.Constraints(Math.PI, Math.PI));
public static final boolean PATH_RECORD_VELOCITY = true; public static final boolean PATH_RECORD_VELOCITY = true;
public static final double PATH_MAX_VELOCITY = 5.0; 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 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 H_FOV = 59.6;
public static final double V_FOV = 45.7; public static final double V_FOV = 45.7;
public static final double LIME_HIXELS = 920; public static final double LIME_HIXELS = 640;
public static final double LIME_VIXELS = 720; public static final double LIME_VIXELS = 480;
public static final double TURRET_kP = 0.1; public static final double TURRET_kP = 0.1;
public static final double POINTS_THRESHOLD = 400; public static final double POINTS_THRESHOLD = 400;
+2 -2
View File
@@ -121,7 +121,7 @@ public class Robot extends TimedRobot {
}); });
desmosServer.start(); 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}); // 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()); 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 @Override
@@ -267,8 +267,8 @@ public class RobotContainer {
.whenPressed(new InstantCommand(() -> m_robotClaws.toggleClaws(), m_robotClaws)); .whenPressed(new InstantCommand(() -> m_robotClaws.toggleClaws(), m_robotClaws));
// X > Toggles extender in and out // X > Toggles extender in and out
// new JoystickButton(getOperatorController(), XboxController.Button.kX.value) new JoystickButton(getOperatorController(), XboxController.Button.kX.value)
// .whenPressed(new ExtenderIntakeGroup(m_robotIntake, m_robotExtender)); .whenPressed(new ExtenderIntakeGroup(m_robotIntake, m_robotExtender));
// A > Spit Out Ball // A > Spit Out Ball
new JoystickButton(getOperatorController(), XboxController.Button.kA.value) new JoystickButton(getOperatorController(), XboxController.Button.kA.value)
@@ -281,10 +281,10 @@ public class RobotContainer {
//! Test Buttons //! Test Buttons
new JoystickButton(getOperatorController(), XboxController.Button.kY.value) // new JoystickButton(getOperatorController(), XboxController.Button.kY.value)
.whenPressed(new Shoot(m_robotSwerveDrive, m_robotBoomBoom, m_robotTurret, m_robotHood, m_robotVisionOdometry, false, false)); // .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)); .whileHeld(new TrackTarget(m_robotSwerveDrive, m_robotTurret, m_robotBoomBoom, m_robotHood, m_robotVisionOdometry));
// new JoystickButton(getOperatorController(), XboxController.Button.kY.value) // 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 SequentialCommandGroup(buildAuto(5.0, 5.0, "Path1", "Path2", "Path3")),
// * new RunCommand(() -> m_robotIntake.runAtOutput(0.5)))); // * 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() { public static XboxController getDriverController() {
@@ -74,7 +74,7 @@ public class TrackTarget extends CommandBase {
Point average = VisionOdometry.averagePoint(points); Point average = VisionOdometry.averagePoint(points);
double output = (average.x - VisionConstants.LIME_HIXELS/2.d) / VisionConstants.LIME_HIXELS; double output = (average.x - VisionConstants.LIME_HIXELS/2.d) / VisionConstants.LIME_HIXELS;
output *= 2; output *= 1.3;
m_turret.runTurretWithInput(output); m_turret.runTurretWithInput(output);
double position = m_turret.m_boomBoomRotateEncoder.getPosition(); double position = m_turret.m_boomBoomRotateEncoder.getPosition();
@@ -228,7 +228,7 @@ public class SwerveDrive extends SubsystemBase {
* Updates the field relative position of the robot. * Updates the field relative position of the robot.
*/ */
public void updateOdometry() { public void updateOdometry() {
m_poseEstimator.update( getRegGyro(), m_poseEstimator.update( new Rotation2d( (Math.PI * 2)- getRegGyro().getRadians()),
modules[0].getState(), modules[0].getState(),
modules[1].getState(), modules[1].getState(),
modules[2].getState(), modules[2].getState(),