Class CircularRegion

java.lang.Object
com.marswars.geometry.Region
com.marswars.geometry.CircularRegion

public class CircularRegion extends Region
This class models a region of the field. It is defined by its center and radius Credit to frc-3061 for base code
  • Constructor Details

    • CircularRegion

      public CircularRegion(Translation2d center, double radius, String region_name)
      Create a CircularRegion, defined by its center and radius.
      Parameters:
      center - the center point of the circular region
      radius - the radius of the circular region in meters
      region_name - the name of the region that is used for logging
  • Method Details

    • constructRegion

      public void constructRegion()
      Description copied from class: Region
      Constructs the region and prepares it for logging.
      Specified by:
      constructRegion in class Region
    • logPoints

      public void logPoints()
      Log the circumference of the circle in 360 points. These can be visualized using AdvantageScope to confirm that the regions are properly defined.
      Specified by:
      logPoints in class Region
    • contains

      public boolean contains(Pose2d other)
      Returns true if the region contains a given Pose2d.
      Specified by:
      contains in class Region
      Parameters:
      other - the given pose2d
      Returns:
      if the pose is inside the region
    • getName

      public String getName()
      Description copied from class: Region
      Returns the name of the region for logging purposes.
      Specified by:
      getName in class Region
    • getCenter

      public Translation2d getCenter()
      Get the center of the circular region
      Returns:
      the center of the circular region
    • getRadius

      public double getRadius()
      Get the radius of the circular region
      Returns:
      the radius of the circular region