Skip to content

Commit

Permalink
Add relocalize button to CD controller
Browse files Browse the repository at this point in the history
  • Loading branch information
frc1987 committed May 31, 2024
1 parent 4873f1d commit 671f901
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.GenericHID.RumbleType;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
Expand Down Expand Up @@ -360,6 +361,20 @@ private void configureCoDriverController() {
new ParallelDeadlineGroup(
new IntakeNoteSequence(SHOOTER, INTAKE, WRIST, ELEVATOR),
new DriveToNoteAuto(DRIVETRAIN, INTAKE_PHOTON, SHOOTER, INTAKE, WRIST, ELEVATOR)));

CO_DRIVER_CONTROLLER
.leftStick()
.onTrue(
new InstantCommand(
() -> {
if (CommandSwerveDrivetrain.getAlliance() == Alliance.Blue) {
DRIVETRAIN.seedFieldRelative(
new Pose2d(1.37, 5.52, Rotation2d.fromDegrees(0.0)));
} else {
DRIVETRAIN.seedFieldRelative(
new Pose2d(15.2, 5.5, Rotation2d.fromDegrees(-180)));
}
}));
}

private void configureDrivetrain() {
Expand Down

0 comments on commit 671f901

Please sign in to comment.