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
    Modifier and Type
    Class
    Description
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    VisionSubsystem(edu.wpi.first.math.geometry.Transform2d... cameraOffsets)
    Creates a new VisionSubsystem
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    edu.wpi.first.wpilibj2.command.Command
    c_align(int targetTagId, int offsetMultiplier)
    Start aligning to an April Tag that matches the ID given
    edu.wpi.first.wpilibj2.command.Command
    c_align(VisionSubsystem.TagGroup targetTagGroup, int offsetMultiplier)
    Start aligning to an April Tag that matches the VisionSubsystem.TagGroup given
    edu.wpi.first.wpilibj2.command.Command
     
    boolean
    Check if the subsystem is currently attempting to position
    void
     
    void
    Stop the positioning process
    void
    stopPositioning(String reason, boolean failed)
    Stop the positioning process

    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, 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

      public void stopPositioning(String reason, boolean failed)
      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 to
      offsetMultiplier - 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 the VisionSubsystem.TagGroup given
      Parameters:
      targetTagGroup - A group of april tags to align to, e.g. TagGroup.REEF. The robot will align to whichever one PhotonVision considers the best
      offsetMultiplier - 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 best
      offsetMultiplier - The horizontal offset multiplier from the tag.
    • c_stop

      public edu.wpi.first.wpilibj2.command.Command c_stop()