Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit f2d2862

Browse files
nvm i needed the constant
1 parent 824588a commit f2d2862

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.spikes2212.util.UnifiedControlMode;
88
import edu.wpi.first.math.geometry.Pose2d;
99
import edu.wpi.first.math.geometry.Rotation2d;
10+
import edu.wpi.first.math.geometry.Translation2d;
1011
import edu.wpi.first.wpilibj.DriverStation;
1112
import edu.wpi.first.wpilibj.RobotController;
1213
import edu.wpi.first.wpilibj2.command.*;
@@ -22,6 +23,9 @@
2223

2324
public class Shoot extends ParallelDeadlineGroup {
2425

26+
private static final Pose2d BLUE_SPEAKER_POSE = new Pose2d(new Translation2d(0.52, 5.59), new Rotation2d());
27+
private static final Pose2d RED_SPEAKER_POSE = new Pose2d(new Translation2d(16.07, 5.59), new Rotation2d());
28+
2529
// formula which translates the distance of the robot from the speaker to the required height to shoot
2630
private static final Function<Double, Double> DISTANCE_TO_HEIGHT = x -> -3.8 * x + 28.8;
2731
private static final double MAX_FORMULA_DISTANCE = 2.285;
@@ -73,9 +77,9 @@ public boolean isFinished() {
7377
InstantCommand setSpeakerPoseCommand = new InstantCommand(() -> {
7478
Optional<DriverStation.Alliance> alliance = DriverStation.getAlliance();
7579
if (alliance.isEmpty() || alliance.get() == DriverStation.Alliance.Blue) {
76-
speakerPose = new Pose2d(0.52, 5.59, new Rotation2d());
80+
speakerPose = BLUE_SPEAKER_POSE;
7781
} else {
78-
speakerPose = new Pose2d(16.07, 5.59, new Rotation2d());
82+
speakerPose = RED_SPEAKER_POSE;
7983
}
8084
}
8185
);

0 commit comments

Comments
 (0)