Package frc.robot.services.vision
Class Vision
java.lang.Object
frc.lib.service.BaseService
frc.robot.services.vision.Vision
- All Implemented Interfaces:
Monitored
Service for processing vision data, specifically from AprilTag cameras.
Receives raw camera detections, filters them based on quality (tag count), and feeds valid measurements into the Drive subsystem's pose estimator to refine the robot's field position. Also monitors camera health and status using highly optimized zero-allocation data structures.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA functional interface for consuming vision measurements.static final recordA record representing a single vision observation. -
Field Summary
Fields inherited from class frc.lib.service.BaseService
name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcastTelemetry(IMUState imuState) Forwards a high frequency IMU packet to the vision pipeline.voidClear all faults and reset the service.booleanReturns whether or not the service is healthyvoidSets the consumer for vision measurements.voidupdate()Processes vision measurements, filters invalid data, updates the drive pose estimator, and checks camera status.Methods inherited from class frc.lib.service.BaseService
getName
-
Constructor Details
-
Vision
Creates a new Vision service.- Parameters:
io- The abstraction layer for the vision hardware.
-
-
Method Details
-
broadcastTelemetry
Forwards a high frequency IMU packet to the vision pipeline.- Parameters:
imuState- The current 6-DOF IMU state.
-
update
public void update()Processes vision measurements, filters invalid data, updates the drive pose estimator, and checks camera status.- Specified by:
updatein classBaseService
-
isHealthy
public boolean isHealthy()Returns whether or not the service is healthy -
clearFaults
public void clearFaults()Clear all faults and reset the service.- Specified by:
clearFaultsin interfaceMonitored
-
setVisionMeasurementConsumer
Sets the consumer for vision measurements.- Parameters:
consumer- A callback function that will be called with each valid vision measurement, providing the pose, timestamp, and standard deviations. This allows external systems to react to new vision data in real-time.
-