Skip to content

Commit

Permalink
Merge pull request #162 from frc937/alliance-based-target-seeking
Browse files Browse the repository at this point in the history
updated STWL with alliance based negative
  • Loading branch information
Jack-Haefele authored Mar 21, 2024
2 parents e14c944 + f0239a9 commit 8fa7f8c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/frc/robot/commands/SeekTargetWithLimelight.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

package frc.robot.commands;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.Constants;
import frc.robot.RobotContainer;
Expand Down Expand Up @@ -50,6 +51,11 @@ public SeekTargetWithLimelight(
public void initialize() {
this.oldPipelineNumber = limelight.getLimelightPipeline();
limelight.setLimelightPipeline(seekingPipelineNumber);

var alliance = DriverStation.getAlliance();
if (alliance.isPresent() ? alliance.get() == DriverStation.Alliance.Red : false) {
this.rotationRadiansPerSecond = rotationRadiansPerSecond * -1;
}
}

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

0 comments on commit 8fa7f8c

Please sign in to comment.