Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#493] clean pipeline calls #499

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,19 +324,18 @@ public class VisionConstants {
public static final double POINTATTAG_ALIGNMENT_TOLERANCE = 2d;
public static final PIDController TAG_AIM_CONTROLLER = new PIDController(0.2, 0, 0.015, 0.01);
public static final PIDController CHASE_CONTROLLER = new PIDController(0.05, 0, 0);
public static final int TAG_PIPELINE = 0;
public static final int SPEAKER_PIPELINE = 1;
public static final int NOTE_PIPELINE = 2;


public static final double HALF_FIELD_HEIGHT = Units.feetToMeters(13);

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 class Pipelines { // TODO get real
public static final int APRIL_TAG_3d = 0;
public static final int APRIL_TAG_2d = 1;
public static final int CHASE_PIECE = 2; // FOR the collector
public static final int TAG_PIPELINE = 0;
public static final int SPEAKER_PIPELINE = 1;
public static final int NOTE_PIPELINE = 2;

}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ protected void initializeNamedCommands() {
NamedCommands.registerCommand("Has-Piece", new HasPieceAuto(indexer));
NamedCommands.registerCommand("Stop-Drive", new stopDrive(drivetrain));
NamedCommands.registerCommand("Stop-Flywheel", new FlywheelIN(flywheel));
NamedCommands.registerCommand("Stopme-Tag", new InstantCommand(() -> limelights.setStopMePipeline(VisionConstants.TAG_PIPELINE)));
NamedCommands.registerCommand("Stopme-Speaker", new InstantCommand(() -> limelights.setStopMePipeline(VisionConstants.SPEAKER_PIPELINE)));
NamedCommands.registerCommand("Stopme-Tag", new InstantCommand(() -> limelights.setStopMePipeline(VisionConstants.Pipelines.TAG_PIPELINE)));
NamedCommands.registerCommand("Stopme-Speaker", new InstantCommand(() -> limelights.setStopMePipeline(VisionConstants.Pipelines.SPEAKER_PIPELINE)));
NamedCommands.registerCommand("Point-At-Tag", new AutonPointAtTag(drivetrain, limelights, driver));

// make sure named commands are initialized before autobuilder!
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/frc/robot/command/PointAtTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public PointAtTag(Swerve drivetrain, Limelights limelights, XboxController drive

@Override
public void initialize() {
limelights.setStopMePipeline(VisionConstants.SPEAKER_PIPELINE);
limelights.setStopMePipeline(VisionConstants.Pipelines.SPEAKER_PIPELINE);

headingController.setTolerance(VisionConstants.ALIGNMENT_TOLERANCE);

Expand All @@ -68,7 +68,7 @@ public void execute() {

targetHeading = limelights.getStopMe().getTargetX();

if (limelights.getStopMePipeline() == VisionConstants.SPEAKER_PIPELINE) {
if (limelights.getStopMePipeline() == VisionConstants.Pipelines.SPEAKER_PIPELINE) {
pidOutput = headingController.calculate(0, targetHeading);
}

Expand All @@ -90,7 +90,7 @@ public void updateLogging() {

@Override
public void end(boolean interrupted) {
limelights.setStopMePipeline(VisionConstants.TAG_PIPELINE);
limelights.setStopMePipeline(VisionConstants.Pipelines.TAG_PIPELINE);
}

/**
Expand Down
Loading