Skip to content

Commit

Permalink
improved scoring logic, fixed the bug in intake
Browse files Browse the repository at this point in the history
  • Loading branch information
catr1xLiu committed Sep 13, 2024
1 parent 5d4a171 commit 3f069aa
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@
}
],
"rotationTargets": [
{
"waypointRelativePos": 1,
"rotationDegrees": 180.0,
"rotateFast": false
},
{
"waypointRelativePos": 0.25,
"rotationDegrees": 180.0,
Expand All @@ -75,6 +70,11 @@
"waypointRelativePos": 2.8,
"rotationDegrees": -171.25383773744474,
"rotateFast": true
},
{
"waypointRelativePos": 1,
"rotationDegrees": 180.0,
"rotateFast": true
}
],
"constraintZones": [
Expand Down Expand Up @@ -114,9 +114,9 @@
"rotateFast": false
},
"reversed": false,
"folder": "Amp Side Six Note",
"folder": null,
"previewStartingState": {
"rotation": -151.29115678153866,
"rotation": -155.55562093631892,
"velocity": 0
},
"useDefaultConstraints": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public void configureButtonBindings() {
driveInput, drive,
FieldConstants.SPEAKER_POSITION_SUPPLIER,
shooterOptimization,
0.5
0.3
);
final Command semiAutoAimAndShoot = new AimAndShootSequence(
pitch, flyWheels, intake, shooterOptimization, drive,
Expand All @@ -422,7 +422,10 @@ public void configureButtonBindings() {
ledStatusLight,
visualizerForShooter
).ifNotePresent();
driverXBox.rightTrigger(0.5).whileTrue(semiAutoAimAndShoot.deadlineWith(faceTargetWhileDrivingLowSpeed));
driverXBox.rightTrigger(0.5).whileTrue(semiAutoAimAndShoot
.deadlineWith(faceTargetWhileDrivingLowSpeed)
.finallyDo(() -> joystickDrive.setCurrentRotationalMaintenance(drive.getFacing()))
);

driverXBox.rightBumper().whileTrue(new PathFindToPoseAndShootSequence(
intake, pitch, flyWheels, shooterOptimization, drive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public AimAndShootSequence(
super.addRequirements(pitch, flyWheels, intake);
super.addCommands(Commands.runOnce(intake::runIdle));

super.addCommands(
new PrepareToAim(flyWheels, pitch, shooterOptimization, ledStatusLight, robotScoringPositionSupplier, targetPositionSupplier)
.untilReady()
);
// super.addCommands(
// new PrepareToAim(flyWheels, pitch, shooterOptimization, ledStatusLight, robotScoringPositionSupplier, targetPositionSupplier)
// .untilReady()
// );
final AimAtSpeakerContinuously aimAtSpeakerContinuously = new AimAtSpeakerContinuously(
flyWheels, pitch, ledStatusLight, shooterOptimization, drive, targetPositionSupplier, externalShootCondition
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public class DriveTrainConstants {

/* for collision detection in simulation */
public static final double
BUMPER_WIDTH_METERS = Units.inchesToMeters(34.5),
BUMPER_LENGTH_METERS = Units.inchesToMeters(36),
BUMPER_WIDTH_METERS = Units.inchesToMeters(32),
BUMPER_LENGTH_METERS = Units.inchesToMeters(32),
/* https://en.wikipedia.org/wiki/Friction#Coefficient_of_friction */
BUMPER_COEFFICIENT_OF_FRICTION = 0.65,
/* https://simple.wikipedia.org/wiki/Coefficient_of_restitution */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import edu.wpi.first.math.geometry.Translation2d;
import frc.robot.Robot;
import frc.robot.constants.DriveTrainConstants;
import frc.robot.utils.CompetitionFieldUtils.Simulations.IntakeSimulation;

public class IntakeIOSim extends IntakeSimulation implements IntakeIO {
Expand All @@ -17,8 +18,8 @@ public class IntakeIOSim extends IntakeSimulation implements IntakeIO {
private boolean shooterRunning = false;
public IntakeIOSim() {
super(
new Translation2d(-0.9144/2-0.01, 0.3),
new Translation2d(-0.9144/2-0.01, -0.3),
new Translation2d(-DriveTrainConstants.BUMPER_LENGTH_METERS/2, 0.3),
new Translation2d(-DriveTrainConstants.BUMPER_LENGTH_METERS/2, -0.3),
1
);
}
Expand Down

0 comments on commit 3f069aa

Please sign in to comment.