Package robot.vision
Class VisionSubsystem
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
robot.vision.VisionSubsystem
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable,edu.wpi.first.wpilibj2.command.Subsystem
public class VisionSubsystem
extends edu.wpi.first.wpilibj2.command.SubsystemBase
Sponsored by Claude™ 3.7 Sonnet by Anthropic®
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionVisionSubsystem(edu.wpi.first.math.geometry.Transform2d... cameraOffsets) Creates a new VisionSubsystem -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.wpilibj2.command.Commandc_align(int[] targetTagIds, int offsetMultiplier) Start aligning to an April Tag that matches one of the IDs givenedu.wpi.first.wpilibj2.command.Commandc_align(int targetTagId, int offsetMultiplier) Start aligning to an April Tag that matches the ID givenedu.wpi.first.wpilibj2.command.Commandc_align(VisionSubsystem.TagGroup targetTagGroup, int offsetMultiplier) Start aligning to an April Tag that matches theVisionSubsystem.TagGroupgivenedu.wpi.first.wpilibj2.command.Commandc_stop()booleanCheck if the subsystem is currently attempting to positionvoidperiodic()voidStop the positioning processvoidstopPositioning(String reason, boolean failed) Stop the positioning processMethods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
VisionSubsystem
public VisionSubsystem(edu.wpi.first.math.geometry.Transform2d... cameraOffsets) Creates a new VisionSubsystem- Parameters:
cameraOffsets- The transforms from the camera to the robot center. -X is towards the front of the robot.
-
-
Method Details
-
periodic
public void periodic() -
stopPositioning
public void stopPositioning()Stop the positioning process -
stopPositioning
Stop the positioning process- Parameters:
reason- The reason that positioning was stopped (for logging), e.g. "Success"failed- Whether positioning was stopped due to some sort of failure. Only for the purpose of fancy lights.
-
isPositioning
public boolean isPositioning()Check if the subsystem is currently attempting to position- Returns:
- true if positioning is in progress
-
c_align
public edu.wpi.first.wpilibj2.command.Command c_align(int targetTagId, int offsetMultiplier) Start aligning to an April Tag that matches the ID given- Parameters:
targetTagId- The ID of the April Tag to align tooffsetMultiplier- The horizontal offset multiplier from the tag.
-
c_align
public edu.wpi.first.wpilibj2.command.Command c_align(VisionSubsystem.TagGroup targetTagGroup, int offsetMultiplier) Start aligning to an April Tag that matches theVisionSubsystem.TagGroupgiven- Parameters:
targetTagGroup- A group of april tags to align to, e.g.TagGroup.REEF. The robot will align to whichever one PhotonVision considers the bestoffsetMultiplier- The horizontal offset multiplier from the tag.
-
c_align
public edu.wpi.first.wpilibj2.command.Command c_align(int[] targetTagIds, int offsetMultiplier) Start aligning to an April Tag that matches one of the IDs given- Parameters:
targetTagIds- A list of april tag IDs to align to. The robot will align to whichever one PhotonVision considers the bestoffsetMultiplier- The horizontal offset multiplier from the tag.
-
c_stop
public edu.wpi.first.wpilibj2.command.Command c_stop()
-