mirror of
https://github.com/Team4388/2023WayOfTheRobot.git
synced 2026-06-09 08:38:02 -06:00
lime stuff works
This commit is contained in:
@@ -4,20 +4,20 @@
|
||||
|
||||
package frc4388.robot.commands;
|
||||
|
||||
import org.photonvision.targeting.PhotonTrackedTarget;
|
||||
|
||||
import edu.wpi.first.math.geometry.Translation2d;
|
||||
import frc4388.robot.Constants.VisionConstants;
|
||||
import frc4388.robot.subsystems.Limelight;
|
||||
import frc4388.robot.subsystems.SwerveDrive;
|
||||
import frc4388.utility.AbhiIsADumbass;
|
||||
|
||||
public class LimeAlign extends PelvicInflammatoryDisease {
|
||||
|
||||
SwerveDrive drive;
|
||||
Limelight lime;
|
||||
|
||||
|
||||
public LimeAlign(SwerveDrive drive, Limelight lime) {
|
||||
super(0.1, 0.0, 0.0, 0.0, 10);
|
||||
super(0.7, 0.1, 0.0, 0.0, 0);
|
||||
|
||||
this.drive = drive;
|
||||
this.lime = lime;
|
||||
@@ -27,16 +27,24 @@ public class LimeAlign extends PelvicInflammatoryDisease {
|
||||
|
||||
@Override
|
||||
public double getError() {
|
||||
double err = 0.0;
|
||||
|
||||
try {
|
||||
return lime.getTargetPoints().get(0).x - (VisionConstants.LIME_HIXELS / 2);
|
||||
} catch (AbhiIsADumbass abhiIsADumbass) {
|
||||
abhiIsADumbass.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
err = lime.getFirstTargetPoint().getYaw() / (VisionConstants.H_FOV / 2);
|
||||
} catch (NullPointerException ex) {}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runWithOutput(double output) {
|
||||
|
||||
if (output > 0) {
|
||||
output += 0.6;
|
||||
} else if (output < 0) {
|
||||
output -= 0.6;
|
||||
}
|
||||
|
||||
drive.driveWithInput(new Translation2d(output, 0.0), new Translation2d(0.0, 0.0), true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user