java.lang.Object
edu.wpi.first.wpilibj2.command.Command
frc.alotobots.library.subsystems.vision.photonvision.objectdetection.commands.DriveFacingBestObject
All Implemented Interfaces:
Sendable

public class DriveFacingBestObject extends Command
A command that automatically rotates the robot to face detected game objects while allowing manual translation control. The robot will face the highest priority detected game element while driving. If no objects are detected, or if manual rotation override is active, falls back to standard manual control.
  • Constructor Details

    • DriveFacingBestObject

      public DriveFacingBestObject(ObjectDetectionSubsystem objectDetectionSubsystem, SwerveDriveSubsystem swerveDriveSubsystem, GameElement... targetGameElementNames)
      Creates a new DriveFacingBestObject command.
      Parameters:
      objectDetectionSubsystem - Subsystem used for detecting game objects
      swerveDriveSubsystem - Subsystem used for robot movement
      targetGameElementNames - Array of game elements to target, in priority order
  • Method Details

    • execute

      public void execute()
      Executes the command logic. Gets the latest object detections and controls robot movement: - If objects are detected, rotates to face highest priority object while allowing manual translation - If no objects detected, allows full manual control - If manual rotation override active, starts timeout timer
      Overrides:
      execute in class Command
    • isFinished

      public boolean isFinished()
      Determines if the command should end.
      Overrides:
      isFinished in class Command
      Returns:
      true if manual rotation override timeout has elapsed