Class ObjectDetectionSubsystem
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.alotobots.library.subsystems.vision.photonvision.objectdetection.ObjectDetectionSubsystem
Subsystem that handles object detection using PhotonVision cameras. This subsystem processes
camera inputs to track and identify objects in the field, maintaining lists of both stable and
pending object detections.
-
Constructor Summary
ConstructorDescriptionObjectDetectionSubsystem
(Supplier<Pose2d> robotPose, ObjectDetectionIO... io) Creates a new ObjectDetectionSubsystem. -
Method Summary
Modifier and TypeMethodDescriptionGets a list of all detected objects, both stable and unstable.getDetectedObjects
(boolean includeUnstable, boolean includeStable) Gets a list of detected objects based on stability criteria.Gets a list of only stable detected objects.Gets a list of only unstable/pending detected objects.void
periodic()
Periodic function that updates camera inputs and processes detections.toFieldRelative
(ObjectDetectionIO.DetectedObjectRobotRelative[] robotRelative) Converts robot-relative object detections to field-relative coordinates.Pose3d[]
toPoseArray
(ObjectDetectionIO.DetectedObjectFieldRelative[] detectedObjects) Converts an array of detected objects to an array of their poses.Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystem
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
ObjectDetectionSubsystem
Creates a new ObjectDetectionSubsystem.- Parameters:
robotPose
- Supplier for the current robot poseio
- Array of ObjectDetectionIO interfaces for cameras
-
-
Method Details
-
periodic
public void periodic()Periodic function that updates camera inputs and processes detections. -
toPoseArray
Converts an array of detected objects to an array of their poses.- Parameters:
detectedObjects
- Array of detected objects- Returns:
- Array of object poses
-
toFieldRelative
public ObjectDetectionIO.DetectedObjectFieldRelative[] toFieldRelative(ObjectDetectionIO.DetectedObjectRobotRelative[] robotRelative) Converts robot-relative object detections to field-relative coordinates.- Parameters:
robotRelative
- Array of robot-relative object detections- Returns:
- Array of field-relative object detections
-
getDetectedObjects
public List<ObjectDetectionIO.DetectedObjectFieldRelative> getDetectedObjects(boolean includeUnstable, boolean includeStable) Gets a list of detected objects based on stability criteria.- Parameters:
includeUnstable
- Whether to include unstable/pending objectsincludeStable
- Whether to include stable objects- Returns:
- List of detected objects matching the criteria
-
getStableDetectedObjects
Gets a list of only stable detected objects.- Returns:
- List of stable detected objects
-
getUnstableDetectedObjects
Gets a list of only unstable/pending detected objects.- Returns:
- List of unstable detected objects
-
getAllDetectedObjects
Gets a list of all detected objects, both stable and unstable.- Returns:
- List of all detected objects
-