Skip to content

Commit

Permalink
Merge pull request #522 from frc-862/520-limelight-update
Browse files Browse the repository at this point in the history
[#520] - limelight update
  • Loading branch information
MattD8957 authored Apr 4, 2024
2 parents 29491ce + e51418c commit 78adfe5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@ public class VisionConstants {
public static final Translation3d BLUE_SPEAKER_LOCATION = new Translation3d(0, 5.547593, 1.2);
public static final Translation3d RED_SPEAKER_LOCATION = new Translation3d(16.4592, 5.547593, 1.2);

public static final int[] SPEAKER_FILTERS = {4, 7};
public static final int[] ALL_TAG_FILTERS = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};


public static class LimelightOrientation {
public static final double STOPME_YAW = 180d;
public static final double STOPME_PITCH = 55.5;
public static final double STOPME_ROLL = 0d;
}

public class Pipelines { // TODO get real
public static final int TAG_PIPELINE = 0;
public static final int SPEAKER_PIPELINE = 1;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/frc/robot/command/ComboPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public void initialize() {
targetPose = swapAlliance(originalTargetPose);
}

stopMe.setPipeline(VisionConstants.Pipelines.SPEAKER_PIPELINE);
// stopMe.setPipeline(VisionConstants.Pipelines.SPEAKER_PIPELINE);
stopMe.setFiducialIDFiltersOverride(VisionConstants.SPEAKER_FILTERS);
targetBias = 0;//5.5d;

System.out.println("DRIVE - COMBO POINT START");
Expand Down Expand Up @@ -204,7 +205,8 @@ public void updateLogging() {
@Override
public void end(boolean interrupted) {
System.out.println("DRIVE - COMBO POINT END");
stopMe.setPipeline(VisionConstants.Pipelines.TAG_PIPELINE);
// stopMe.setPipeline(VisionConstants.Pipelines.TAG_PIPELINE);
stopMe.setFiducialIDFiltersOverride(VisionConstants.ALL_TAG_FILTERS);
if (DriverStation.isAutonomous()) {
drivetrain.setField(0d, 0d, 0d);
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/frc/robot/subsystems/Limelights.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants.VisionConstants;
import frc.robot.Constants.VisionConstants.LimelightOrientation;
import frc.robot.Constants.VisionConstants.Pipelines;
import frc.thunder.util.Pose4d;
import frc.thunder.vision.Limelight;
Expand All @@ -28,6 +29,8 @@ public Limelights() {
dust.setPipeline(0);
champs.setPipeline(0);

setOrientations();

this.poseProducer = new Thread(() -> {
while (true) {
try {
Expand Down Expand Up @@ -97,5 +100,15 @@ public int getChampsPipeline() {

@Override
public void periodic() {
// setOrientations();
}

public void setOrientations(){
// stopMe.setRobotOrientation(LimelightOrientation.STOPME_YAW,0,
// LimelightOrientation.STOPME_PITCH, 0,
// LimelightOrientation.STOPME_ROLL, 0);

// champs.setRobotOrientation(0, 0, 0, 0, 0, 0);
}

}
2 changes: 1 addition & 1 deletion src/main/java/frc/thunder
Submodule thunder updated 1 files
+31 −0 vision/Limelight.java

0 comments on commit 78adfe5

Please sign in to comment.