Track target

This commit is contained in:
Ryan Manley
2022-03-21 19:30:51 -06:00
parent f8092825f6
commit 065e48fed1
2 changed files with 10 additions and 0 deletions
@@ -67,6 +67,7 @@ public class TrackTarget extends CommandBase {
@Override @Override
public void execute() { public void execute() {
try { try {
m_visionOdometry.setDriverMode(false);
m_visionOdometry.setLEDs(true); m_visionOdometry.setLEDs(true);
points = m_visionOdometry.getTargetPoints(); points = m_visionOdometry.getTargetPoints();
@@ -153,6 +154,8 @@ public class TrackTarget extends CommandBase {
// Called once the command ends or is interrupted. // Called once the command ends or is interrupted.
@Override @Override
public void end(boolean interrupted) { public void end(boolean interrupted) {
m_visionOdometry.setLEDs(false);
m_visionOdometry.setDriverMode(true);
} }
// Returns true when the command should end. // Returns true when the command should end.
@@ -47,6 +47,9 @@ public class VisionOdometry extends SubsystemBase {
m_camera = new PhotonCamera(VisionConstants.NAME); m_camera = new PhotonCamera(VisionConstants.NAME);
m_drive = drive; m_drive = drive;
m_shooter = shooter; m_shooter = shooter;
setLEDs(false);
setDriverMode(true);
} }
/** Gets the vision points from the limelight /** Gets the vision points from the limelight
@@ -93,6 +96,10 @@ public class VisionOdometry extends SubsystemBase {
m_camera.setLED(on ? VisionLEDMode.kOn : VisionLEDMode.kOff); m_camera.setLED(on ? VisionLEDMode.kOn : VisionLEDMode.kOff);
} }
public void setDriverMode(boolean driverMode) {
m_camera.setDriverMode(driverMode);
}
public Point getTargetOffset() throws VisionObscuredException { public Point getTargetOffset() throws VisionObscuredException {
ArrayList<Point> screenPoints = getTargetPoints(); ArrayList<Point> screenPoints = getTargetPoints();