Vision System
The VisionSystem subsystem manages multiple vision cameras for robot pose estimation and target tracking.
Supports multi-camera fusion, automatic pose updates, and provides methods for accessing vision data from all connected cameras. Works with any camera implementing the Camera interface.
Usage Example:
val visionSystem = VisionSystem()
visionSystem.configure {
enablePoseUpdates = true
maxPoseAmbiguity = 0.2
}
// Add cameras
val frontCamera = PhotonModule(...)
val limelight = LimeModule("limelight")
visionSystem.addCamera(frontCamera)
visionSystem.addCamera(limelight)
// Set the pose estimator to update (typically your SwerveDrive)
visionSystem.setPoseEstimator { pose, timestamp, stdDevs ->
swerveDrive.addVisionMeasurement(pose, timestamp, stdDevs)
}Functions
Adds a Limelight camera module to the vision system.
Adds a PhotonVision camera module to the vision system.
Configures the vision system using a DSL-style configuration block.
Gets the best available vision measurement from all cameras.
Gets all cameras.
Gets a Limelight camera module by name.
Gets all Limelight camera modules.
Gets a PhotonVision camera module by name.
Gets all PhotonVision camera modules.
Gets the number of visible targets across all cameras.
Sets all Limelight LEDs to a specific mode.
Sets all Limelight pipelines.
Sets a supplier for getting the current robot pose.
Enables or disables automatic pose updates.
Sets the callback function for updating the robot's pose estimator.