Skip to content

Commit e06112e

Browse files
committed
Align to Amp and RobotContainer Cleanup
Remapped align to source to align to the amp, removed excess comments from robotcontainer
1 parent eb43714 commit e06112e

7 files changed

Lines changed: 32 additions & 312 deletions

File tree

src/main/java/frc/robot/BuildConstants.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ public final class BuildConstants {
55
public static final String MAVEN_GROUP = "";
66
public static final String MAVEN_NAME = "2024RobotCode";
77
public static final String VERSION = "unspecified";
8-
public static final int GIT_REVISION = 347;
9-
public static final String GIT_SHA = "ce72e903bd56c27c1efd826909dae699468e1732";
10-
public static final String GIT_DATE = "2024-08-18 23:42:15 EDT";
8+
public static final int GIT_REVISION = 348;
9+
public static final String GIT_SHA = "eb437146e720e43f1e7b134ae90f118a354d22da";
10+
public static final String GIT_DATE = "2024-08-29 21:18:58 EDT";
1111
public static final String GIT_BRANCH = "pre-goonettes";
12-
public static final String BUILD_DATE = "2024-08-29 21:12:59 EDT";
13-
public static final long BUILD_UNIX_TIME = 1724980379162L;
12+
public static final String BUILD_DATE = "2024-09-05 14:52:13 EDT";
13+
public static final long BUILD_UNIX_TIME = 1725562333869L;
1414
public static final int DIRTY = 1;
1515

1616
private BuildConstants() {}

src/main/java/frc/robot/RobotContainer.java

Lines changed: 7 additions & 286 deletions
Large diffs are not rendered by default.

src/main/java/frc/robot/commands/AimbotTele.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public AimbotTele(
5656

5757
switch (Constants.currentMode) {
5858
case REAL:
59-
gains[0] = 3.7;
59+
gains[0] = 3.2;
6060
gains[1] = 0;
6161
gains[2] = 0;
6262
break;
@@ -113,22 +113,22 @@ public void angleShooter() {
113113
// } else {
114114
// shooter.setFlywheelRPMs(5700, 5400);
115115
// }
116-
} else if (Units.metersToFeet(distanceToSpeakerMeter) > 11.6) {
116+
} else if (Units.metersToFeet(distanceToSpeakerMeter) > 12.5) {
117117
// double shootingSpeed =
118118
// MathUtil.clamp(
119119
// calculateShooterSpeed(Units.metersToFeet(distanceToSpeakerMeter)), 3250, 5400);
120120
double shootingSpeed = calculateShooterSpeed(Units.metersToFeet(distanceToSpeakerMeter));
121121

122-
shooter.setFlywheelRPMs(shootingSpeed, shootingSpeed + 100);
123-
} else shooter.setFlywheelRPMs(5700, 5400);
122+
shooter.setFlywheelRPMs(shootingSpeed, shootingSpeed + 400);
123+
} else shooter.setFlywheelRPMs(5700, 5000);
124124

125125
pivot.setPivotGoal(calculatePivotAngleDeg(distanceToSpeakerMeter));
126126
}
127127

128128
private double calculateShooterSpeed(double distanceToSpeakerFeet) {
129129
double shooterSpeed = -986.49 * distanceToSpeakerFeet + 17294.6;
130130
// shooterSpeed = MathUtil.clamp(shooterSpeed, 3850, 5400);
131-
shooterSpeed = MathUtil.clamp(shooterSpeed, 4400, 5400);
131+
shooterSpeed = MathUtil.clamp(shooterSpeed, 4400, 5300);
132132
// if (distanceToSpeakerFeet >= 11) {
133133
// return -430.7 * distanceToSpeakerFeet + 8815;
134134
// } else return -600. * distanceToSpeakerFeet + 10406;
@@ -147,8 +147,8 @@ private double calculatePivotAngleDeg(double distanceToSpeakerMeter) {
147147
// }
148148
// Logger.recordOutput("pivot target auto", pivotSetpointDeg);
149149
// return pivotSetpointDeg + 3.3;
150-
pivotSetpointDeg = Units.radiansToDegrees(Math.atan(2.1 / distanceToSpeakerMeter));
151-
if (Units.metersToFeet(distanceToSpeakerMeter) > 11.6) {
150+
pivotSetpointDeg = Units.radiansToDegrees(Math.atan(2.1 / distanceToSpeakerMeter)) + 0.5;
151+
if (Units.metersToFeet(distanceToSpeakerMeter) > 12.5) {
152152
return 32;
153153
}
154154
pivotSetpointDeg = MathUtil.clamp(pivotSetpointDeg, 32, 62);

src/main/java/frc/robot/commands/DriveCommands.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ public static Command joystickDrive(
132132
DoubleSupplier ySupplier,
133133
DoubleSupplier omegaSupplier,
134134
BooleanSupplier intakeAssistSupplier,
135-
BooleanSupplier turnToSourceSupplier) {
135+
BooleanSupplier turnToAmpSupplier) {
136136
return Commands.run(
137137
() -> {
138-
rotationPID.setTolerance(5);
138+
rotationPID.setTolerance(1);
139139
rotationPID.enableContinuousInput(-180, 180);
140140
sidewaysPID.setTolerance(0.05460);
141141
// Apply deadband
@@ -178,14 +178,15 @@ public static Command joystickDrive(
178178

179179
sideWaysError = 0 - drive.getNotePositionRobotRelative().getY();
180180

181-
if (turnToSourceSupplier.getAsBoolean()) {
181+
if (turnToAmpSupplier.getAsBoolean()) {
182182
Rotation2d curreRotation2d = drive.getRotation();
183183
Rotation2d targeRotation2d;
184-
if (DriverStation.getAlliance().get() == Alliance.Blue) {
185-
targeRotation2d = Rotation2d.fromDegrees(-60);
186-
} else {
187-
targeRotation2d = Rotation2d.fromDegrees(240);
188-
}
184+
// if (DriverStation.getAlliance().get() == Alliance.Blue) {
185+
// targeRotation2d = Rotation2d.fromDegrees(-60); //-60 for blue source
186+
// } else {
187+
// targeRotation2d = Rotation2d.fromDegrees(240); //240 for red source
188+
// }
189+
targeRotation2d = Rotation2d.fromDegrees(90); // TODO 90 or -90 for amp, need to test
189190
rotationPID.setSetpoint(targeRotation2d.getDegrees());
190191

191192
wantedRotationVelocity =

src/main/java/frc/robot/commands/TurnToAmpCorner.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ public TurnToAmpCorner(
6363
}
6464

6565
pid = new PIDController(gains[0], gains[1], gains[2], 0.02);
66-
pid.setTolerance(4);
66+
pid.setTolerance(2);
6767
pid.enableContinuousInput(-180, 180);
6868
}
6969

7070
// Called when the command is initially scheduled.
7171
@Override
7272
public void initialize() {
73-
pivot.setPivotGoal(45);
74-
shooter.setFlywheelRPMs(4800, 4200);
73+
pivot.setPivotGoal(50);
74+
shooter.setFlywheelRPMs(3700, 2700);
7575
}
7676

7777
// Called every time the scheduler runs while the command is scheduled.

src/main/java/frc/robot/subsystems/Shooter/Shooter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public NoteState seesNote() {
196196
lastNoteState = NoteState.SENSOR;
197197
return NoteState.SENSOR;
198198

199-
} else if (feedInputs.currentAmps > 13) {
199+
} else if (feedInputs.currentAmps > 13) { //TODO add additional check to filter out false positives
200200
// } else if (feedInputs.currentAmps > 10000) {
201201
Logger.recordOutput("see note val", "current");
202202
lastNoteState = NoteState.CURRENT;

src/main/java/frc/robot/subsystems/drive/Drive.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ public void periodic() {
208208
module.periodic();
209209
}
210210

211-
Logger.recordOutput("test trans", new Translation2d(2, 4));
212-
213211
// Stop moving when disabled
214212
if (DriverStation.isDisabled()) {
215213
for (var module : modules) {

0 commit comments

Comments
 (0)